├── .idea ├── infer-paddle.iml ├── inspectionProfiles │ └── profiles_settings.xml ├── misc.xml ├── modules.xml └── workspace.xml ├── MvImport ├── CameraParams_const.py ├── CameraParams_header.py ├── MvCameraControl_class.py ├── MvCameraControl_header.py ├── MvErrorDefine_const.py ├── PixelType_const.py ├── PixelType_header.py └── __pycache__ │ ├── CameraParams_const.cpython-36.pyc │ ├── CameraParams_header.cpython-36.pyc │ ├── MvCameraControl_class.cpython-36.pyc │ ├── MvCameraControl_header.cpython-36.pyc │ ├── MvErrorDefine_const.cpython-36.pyc │ ├── PixelType_const.cpython-36.pyc │ └── PixelType_header.cpython-36.pyc ├── README.md ├── __pycache__ ├── infer_video.cpython-36.pyc └── ui_main.cpython-36.pyc ├── infer_img.py ├── infer_video.py ├── main.py ├── model ├── __model__ └── __params__ ├── pic ├── 2-result.jpg └── 2.jpg ├── requirements.txt ├── ui-main.ui └── ui_main.py /.idea/infer-paddle.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 39 | 40 | 41 | 42 | 43 | 62 | 63 | 64 | 83 | 84 | 85 | 104 | 105 | 106 | 125 | 126 | 127 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 1583390556356 163 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /MvImport/CameraParams_const.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | #Don't change this file, it was auto generated by Const_file_Generater.py. 4 | 5 | 6 | MV_UNKNOW_DEVICE = 0x00000000 # ch:未知设备类型,保留意义 | en:Unknown Device Type, Reserved 7 | MV_GIGE_DEVICE = 0x00000001 # ch:GigE设备 | en:GigE Device 8 | MV_1394_DEVICE = 0x00000002 # ch:1394-a/b 设备 | en:1394-a/b Device 9 | MV_USB_DEVICE = 0x00000004 # ch:USB3.0 设备 | en:USB3.0 Device 10 | MV_CAMERALINK_DEVICE = 0x00000008 # ch:CameraLink设备 | en:CameraLink Device 11 | INFO_MAX_BUFFER_SIZE = 64 12 | MV_MAX_TLS_NUM = 8 13 | MV_MAX_DEVICE_NUM = 256 14 | MV_IP_CFG_STATIC = 0x05000000 15 | MV_IP_CFG_DHCP = 0x06000000 16 | MV_IP_CFG_LLA = 0x04000000 17 | MV_NET_TRANS_DRIVER = 0x00000001 18 | MV_NET_TRANS_SOCKET = 0x00000002 19 | MV_MATCH_TYPE_NET_DETECT = 0x00000001 # ch:网络流量和丢包信息 | en:Network traffic and packet loss information 20 | MV_MATCH_TYPE_USB_DETECT = 0x00000002 # ch:host接收到来自U3V设备的字节总数 | en:The total number of bytes host received from U3V device 21 | MV_MAX_XML_NODE_NUM_C = 128 22 | MV_MAX_XML_NODE_STRLEN_C = 64 23 | MV_MAX_XML_STRVALUE_STRLEN_C = 64 24 | MV_MAX_XML_DISC_STRLEN_C = 512 25 | MV_MAX_XML_ENTRY_NUM = 10 26 | MV_MAX_XML_PARENTS_NUM = 8 27 | MV_MAX_XML_SYMBOLIC_STRLEN_C = 64 28 | MV_MAX_XML_SYMBOLIC_NUM = 64 29 | MV_EXCEPTION_DEV_DISCONNECT = 0x00008001 # ch:设备断开连接 | en:The device is disconnected 30 | MV_EXCEPTION_VERSION_CHECK = 0x00008002 # ch:SDK与驱动版本不匹配 | en:SDK does not match the driver version 31 | MV_ACCESS_Exclusive = 1 32 | MV_ACCESS_ExclusiveWithSwitch = 2 33 | MV_ACCESS_Control = 3 34 | MV_ACCESS_ControlWithSwitch = 4 35 | MV_ACCESS_ControlSwitchEnable = 5 36 | MV_ACCESS_ControlSwitchEnableWithKey = 6 37 | MV_ACCESS_Monitor = 7 38 | MAX_EVENT_NAME_SIZE = 128 # 相机Event事件名称最大长度 | en:Max length of event name 39 | -------------------------------------------------------------------------------- /MvImport/CameraParams_header.py: -------------------------------------------------------------------------------- 1 | # generated by 'xml2py' 2 | # flags '-c -d -v C:\test_h\CameraParams.xml -o CameraParams_header.py' 3 | from ctypes import * 4 | 5 | STRING = c_char_p 6 | 7 | 8 | MV_EXPOSURE_MODE_TRIGGER_WIDTH = 1 9 | MV_TRIGGER_SOURCE_FrequencyConverter = 8 10 | MV_TRIGGER_SOURCE_SOFTWARE = 7 11 | MV_TRIGGER_SOURCE_COUNTER0 = 4 12 | MV_BALANCEWHITE_AUTO_OFF = 0 13 | MV_TRIGGER_SOURCE_LINE3 = 3 14 | MV_TRIGGER_SOURCE_LINE2 = 2 15 | MV_TRIGGER_SOURCE_LINE1 = 1 16 | MV_EXPOSURE_MODE_TIMED = 0 17 | MV_TRIGGER_SOURCE_LINE0 = 0 18 | AM_NA = 1 19 | PixelType_Gvsp_BayerGR8 = 17301512 20 | PixelType_Gvsp_Mono16 = 17825799 21 | PixelType_Gvsp_Mono14 = 17825829 22 | PixelType_Gvsp_Mono12 = 17825797 23 | PixelType_Gvsp_Mono10 = 17825795 24 | V_Undefined = 99 25 | PixelType_Gvsp_Mono12_Packed = 17563654 26 | V_Invisible = 3 27 | PixelType_Gvsp_Mono8 = 17301505 28 | V_Guru = 2 29 | PixelType_Gvsp_Mono4p = 17039417 30 | V_Expert = 1 31 | PixelType_Gvsp_BayerGR16 = 17825838 32 | PixelType_Gvsp_Mono1p = 16842807 33 | PixelType_Gvsp_Undefined = -1 34 | MV_GAIN_MODE_CONTINUOUS = 2 35 | IFT_IString = 6 36 | PixelType_Gvsp_BayerBG10 = 17825807 37 | MV_ACQ_MODE_CONTINUOUS = 2 38 | MV_EXPOSURE_AUTO_MODE_ONCE = 1 39 | MV_Image_Png = 3 40 | MV_Image_Jpeg = 2 41 | MV_Image_Bmp = 1 42 | MV_ACQ_MODE_MUTLI = 1 43 | MV_EXPOSURE_AUTO_MODE_OFF = 0 44 | PixelType_Gvsp_Jpeg = -2145910783 45 | PixelType_Gvsp_RGB16_Planar = 36700196 46 | IFT_IPort = 11 47 | IFT_IEnumEntry = 10 48 | IFT_ICategory = 8 49 | IFT_IRegister = 7 50 | IFT_IFloat = 5 51 | IFT_IEnumeration = 9 52 | IFT_ICommand = 4 53 | IFT_IBoolean = 3 54 | IFT_IInteger = 2 55 | IFT_IBase = 1 56 | PixelType_Gvsp_COORD3D_DEPTH_PLUS_MASK = -2112094207 57 | IFT_IValue = 0 58 | PixelType_Gvsp_Coord3D_AC32f = 36176066 59 | PixelType_Gvsp_Coord3D_ABC32f_Planar = 39846081 60 | PixelType_Gvsp_Coord3D_ABC32f = 39846080 61 | PixelType_Gvsp_RGB12_Planar = 36700195 62 | PixelType_Gvsp_RGB10_Planar = 36700194 63 | PixelType_Gvsp_YCBCR709_411_8_CBYYCRYY = 34340930 64 | MV_TRIGGER_MODE_OFF = 0 65 | PixelType_Gvsp_YCBCR709_422_8_CBYCRY = 34603077 66 | PixelType_Gvsp_YCBCR709_8_CBYCR = 35127360 67 | PixelType_Gvsp_YCBCR709_422_8 = 34603073 68 | PixelType_Gvsp_YCBCR601_411_8_CBYYCRYY = 34340927 69 | PixelType_Gvsp_YCBCR601_422_8 = 34603070 70 | PixelType_Gvsp_YCBCR601_8_CBYCR = 35127357 71 | MV_TRIGGER_MODE_ON = 1 72 | PixelType_Gvsp_YCBCR411_8_CBYYCRYY = 34340924 73 | PixelType_Gvsp_YCBCR422_8_CBYCRY = 34603075 74 | PixelType_Gvsp_YCBCR422_8 = 34603067 75 | PixelType_Gvsp_YCBCR8_CBYCR = 35127354 76 | PixelType_Gvsp_YUV444_Packed = 35127328 77 | PixelType_Gvsp_YUV422_YUYV_Packed = 34603058 78 | PixelType_Gvsp_YUV422_Packed = 34603039 79 | PixelType_Gvsp_YUV411_Packed = 34340894 80 | PixelType_Gvsp_BGR565_Packed = 34603062 81 | PixelType_Gvsp_RGB565_Packed = 34603061 82 | PixelType_Gvsp_RGB12V1_Packed = 35913780 83 | PixelType_Gvsp_RGB10V2_Packed = 35651613 84 | PixelType_Gvsp_RGB16_Packed = 36700211 85 | PixelType_Gvsp_YCBCR601_422_8_CBYCRY = 34603076 86 | PixelType_Gvsp_RGB12_Packed = 36700186 87 | PixelType_Gvsp_BGR10_Packed = 36700185 88 | MV_GIGE_TRANSTYPE_UNICAST = 0 89 | PixelType_Gvsp_RGB10_Packed = 36700184 90 | PixelType_Gvsp_BGRA8_Packed = 35651607 91 | PixelType_Gvsp_RGBA8_Packed = 35651606 92 | PixelType_Gvsp_BGR8_Packed = 35127317 93 | PixelType_Gvsp_RGB8_Packed = 35127316 94 | PixelType_Gvsp_BayerBG16 = 17825841 95 | PixelType_Gvsp_BayerGB16 = 17825840 96 | PixelType_Gvsp_BayerRG16 = 17825839 97 | PixelType_Gvsp_BayerBG12_Packed = 17563693 98 | PixelType_Gvsp_BayerGB12_Packed = 17563692 99 | PixelType_Gvsp_BayerRG12_Packed = 17563691 100 | PixelType_Gvsp_BayerGR12_Packed = 17563690 101 | PixelType_Gvsp_BayerBG10_Packed = 17563689 102 | PixelType_Gvsp_BayerGB10_Packed = 17563688 103 | MV_GAIN_MODE_ONCE = 1 104 | PixelType_Gvsp_BayerRG10_Packed = 17563687 105 | PixelType_Gvsp_BayerGR10_Packed = 17563686 106 | PixelType_Gvsp_BayerBG12 = 17825811 107 | PixelType_Gvsp_BayerGB12 = 17825810 108 | PixelType_Gvsp_BayerRG12 = 17825809 109 | PixelType_Gvsp_BayerGR12 = 17825808 110 | PixelType_Gvsp_BayerGB10 = 17825806 111 | PixelType_Gvsp_BayerRG10 = 17825805 112 | PixelType_Gvsp_BayerGR10 = 17825804 113 | PixelType_Gvsp_BayerBG8 = 17301515 114 | PixelType_Gvsp_BayerGB8 = 17301514 115 | PixelType_Gvsp_BayerRG8 = 17301513 116 | MV_EXPOSURE_AUTO_MODE_CONTINUOUS = 2 117 | MV_Image_Tif = 4 118 | AM_RW = 4 119 | MV_BALANCEWHITE_AUTO_CONTINUOUS = 1 120 | MV_BALANCEWHITE_AUTO_ONCE = 2 121 | PixelType_Gvsp_Mono2p = 16908344 122 | MV_GAMMA_SELECTOR_SRGB = 2 123 | MV_GAIN_MODE_OFF = 0 124 | PixelType_Gvsp_Mono10_Packed = 17563652 125 | MV_GAMMA_SELECTOR_USER = 1 126 | PixelType_Gvsp_RGB8_Planar = 35127329 127 | PixelType_Gvsp_Mono8_Signed = 17301506 128 | MV_ACQ_MODE_SINGLE = 0 129 | AM_CycleDetect = 6 130 | MV_GIGE_TRANSTYPE_MULTICAST_WITHOUT_RECV = 65537 131 | AM_Undefined = 5 132 | MV_GIGE_TRANSTYPE_UNICAST_WITHOUT_RECV = 65536 133 | MV_GIGE_TRANSTYPE_UNICAST_DEFINED_PORT = 5 134 | AM_RO = 3 135 | MV_GIGE_TRANSTYPE_SUBNETBROADCAST = 3 136 | PixelType_Gvsp_RGB10V1_Packed = 35651612 137 | MV_GIGE_TRANSTYPE_LIMITEDBROADCAST = 2 138 | MV_GIGE_TRANSTYPE_MULTICAST = 1 139 | MV_GIGE_TRANSTYPE_CAMERADEFINED = 4 140 | AM_NI = 0 141 | PixelType_Gvsp_BGR12_Packed = 36700187 142 | MV_Image_Undefined = 0 143 | AM_WO = 2 144 | V_Beginner = 0 145 | int8_t = c_int8 146 | int16_t = c_int16 147 | int32_t = c_int32 148 | int64_t = c_int64 149 | uint8_t = c_uint8 150 | uint16_t = c_uint16 151 | uint32_t = c_uint32 152 | uint64_t = c_uint64 153 | int_least8_t = c_byte 154 | int_least16_t = c_short 155 | int_least32_t = c_int 156 | int_least64_t = c_long 157 | uint_least8_t = c_ubyte 158 | uint_least16_t = c_ushort 159 | uint_least32_t = c_uint 160 | uint_least64_t = c_ulong 161 | int_fast8_t = c_byte 162 | int_fast16_t = c_long 163 | int_fast32_t = c_long 164 | int_fast64_t = c_long 165 | uint_fast8_t = c_ubyte 166 | uint_fast16_t = c_ulong 167 | uint_fast32_t = c_ulong 168 | uint_fast64_t = c_ulong 169 | intptr_t = c_long 170 | uintptr_t = c_ulong 171 | intmax_t = c_long 172 | uintmax_t = c_ulong 173 | # CameraParams.h 21 174 | class _MV_GIGE_DEVICE_INFO_(Structure): 175 | pass 176 | _MV_GIGE_DEVICE_INFO_._fields_ = [ 177 | # CameraParams.h 21 178 | ('nIpCfgOption', c_uint), 179 | ('nIpCfgCurrent', c_uint), 180 | ('nCurrentIp', c_uint), 181 | ('nCurrentSubNetMask', c_uint), 182 | ('nDefultGateWay', c_uint), 183 | ('chManufacturerName', c_ubyte * 32), 184 | ('chModelName', c_ubyte * 32), 185 | ('chDeviceVersion', c_ubyte * 32), 186 | ('chManufacturerSpecificInfo', c_ubyte * 48), 187 | ('chSerialNumber', c_ubyte * 16), 188 | ('chUserDefinedName', c_ubyte * 16), 189 | ('nNetExport', c_uint), 190 | ('nReserved', c_uint * 4), 191 | ] 192 | MV_GIGE_DEVICE_INFO = _MV_GIGE_DEVICE_INFO_ 193 | # CameraParams.h 42 194 | class _MV_USB3_DEVICE_INFO_(Structure): 195 | pass 196 | _MV_USB3_DEVICE_INFO_._fields_ = [ 197 | # CameraParams.h 42 198 | ('CrtlInEndPoint', c_ubyte), 199 | ('CrtlOutEndPoint', c_ubyte), 200 | ('StreamEndPoint', c_ubyte), 201 | ('EventEndPoint', c_ubyte), 202 | ('idVendor', c_ushort), 203 | ('idProduct', c_ushort), 204 | ('nDeviceNumber', c_uint), 205 | ('chDeviceGUID', c_ubyte * 64), 206 | ('chVendorName', c_ubyte * 64), 207 | ('chModelName', c_ubyte * 64), 208 | ('chFamilyName', c_ubyte * 64), 209 | ('chDeviceVersion', c_ubyte * 64), 210 | ('chManufacturerName', c_ubyte * 64), 211 | ('chSerialNumber', c_ubyte * 64), 212 | ('chUserDefinedName', c_ubyte * 64), 213 | ('nbcdUSB', c_uint), 214 | ('nReserved', c_uint * 3), 215 | ] 216 | MV_USB3_DEVICE_INFO = _MV_USB3_DEVICE_INFO_ 217 | # CameraParams.h 64 218 | class _MV_CC_DEVICE_INFO_(Structure): 219 | pass 220 | # CameraParams.h 76 221 | class N19_MV_CC_DEVICE_INFO_3DOT_0E(Union): 222 | pass 223 | N19_MV_CC_DEVICE_INFO_3DOT_0E._fields_ = [ 224 | # CameraParams.h 76 225 | ('stGigEInfo', MV_GIGE_DEVICE_INFO), 226 | ('stUsb3VInfo', MV_USB3_DEVICE_INFO), 227 | ] 228 | _MV_CC_DEVICE_INFO_._fields_ = [ 229 | # CameraParams.h 64 230 | ('nMajorVer', c_ushort), 231 | ('nMinorVer', c_ushort), 232 | ('nMacAddrHigh', c_uint), 233 | ('nMacAddrLow', c_uint), 234 | ('nTLayerType', c_uint), 235 | ('nReserved', c_uint * 4), 236 | ('SpecialInfo', N19_MV_CC_DEVICE_INFO_3DOT_0E), 237 | ] 238 | MV_CC_DEVICE_INFO = _MV_CC_DEVICE_INFO_ 239 | # CameraParams.h 86 240 | class _MV_NETTRANS_INFO_(Structure): 241 | pass 242 | _MV_NETTRANS_INFO_._fields_ = [ 243 | # CameraParams.h 86 244 | ('nReviceDataSize', int64_t), 245 | ('nThrowFrameCount', c_int), 246 | ('nReserved', c_uint * 5), 247 | ] 248 | MV_NETTRANS_INFO = _MV_NETTRANS_INFO_ 249 | # CameraParams.h 101 250 | class _MV_CC_DEVICE_INFO_LIST_(Structure): 251 | pass 252 | _MV_CC_DEVICE_INFO_LIST_._fields_ = [ 253 | # CameraParams.h 101 254 | ('nDeviceNum', c_uint), 255 | ('pDeviceInfo', POINTER(MV_CC_DEVICE_INFO) * 256), 256 | ] 257 | MV_CC_DEVICE_INFO_LIST = _MV_CC_DEVICE_INFO_LIST_ 258 | # CameraParams.h 110 259 | class _MV_FRAME_OUT_INFO_(Structure): 260 | pass 261 | 262 | # values for enumeration 'MvGvspPixelType' 263 | MvGvspPixelType = c_int # enum 264 | _MV_FRAME_OUT_INFO_._fields_ = [ 265 | # CameraParams.h 110 266 | ('nWidth', c_ushort), 267 | ('nHeight', c_ushort), 268 | ('enPixelType', MvGvspPixelType), 269 | ('nFrameNum', c_uint), 270 | ('nDevTimeStampHigh', c_uint), 271 | ('nDevTimeStampLow', c_uint), 272 | ('nReserved0', c_uint), 273 | ('nHostTimeStamp', int64_t), 274 | ('nFrameLen', c_uint), 275 | ('nLostPacket', c_uint), 276 | ('nReserved', c_uint * 2), 277 | ] 278 | MV_FRAME_OUT_INFO = _MV_FRAME_OUT_INFO_ 279 | # CameraParams.h 129 280 | class _MV_FRAME_OUT_INFO_EX_(Structure): 281 | pass 282 | _MV_FRAME_OUT_INFO_EX_._fields_ = [ 283 | # CameraParams.h 129 284 | ('nWidth', c_ushort), 285 | ('nHeight', c_ushort), 286 | ('enPixelType', MvGvspPixelType), 287 | ('nFrameNum', c_uint), 288 | ('nDevTimeStampHigh', c_uint), 289 | ('nDevTimeStampLow', c_uint), 290 | ('nReserved0', c_uint), 291 | ('nHostTimeStamp', int64_t), 292 | ('nFrameLen', c_uint), 293 | ('nSecondCount', c_uint), 294 | ('nCycleCount', c_uint), 295 | ('nCycleOffset', c_uint), 296 | ('fGain', c_float), 297 | ('fExposureTime', c_float), 298 | ('nAverageBrightness', c_uint), 299 | ('nRed', c_uint), 300 | ('nGreen', c_uint), 301 | ('nBlue', c_uint), 302 | ('nFrameCounter', c_uint), 303 | ('nTriggerIndex', c_uint), 304 | ('nInput', c_uint), 305 | ('nOutput', c_uint), 306 | ('nOffsetX', c_ushort), 307 | ('nOffsetY', c_ushort), 308 | ('nChunkWidth', c_ushort), 309 | ('nChunkHeight', c_ushort), 310 | ('nLostPacket', c_uint), 311 | ('nReserved', c_uint * 39), 312 | ] 313 | MV_FRAME_OUT_INFO_EX = _MV_FRAME_OUT_INFO_EX_ 314 | # CameraParams.h 176 315 | class _MV_DISPLAY_FRAME_INFO_(Structure): 316 | pass 317 | _MV_DISPLAY_FRAME_INFO_._fields_ = [ 318 | # CameraParams.h 176 319 | ('hWnd', c_void_p), 320 | ('pData', POINTER(c_ubyte)), 321 | ('nDataLen', c_uint), 322 | ('nWidth', c_ushort), 323 | ('nHeight', c_ushort), 324 | ('enPixelType', MvGvspPixelType), 325 | ('nRes', c_uint * 4), 326 | ] 327 | MV_DISPLAY_FRAME_INFO = _MV_DISPLAY_FRAME_INFO_ 328 | 329 | # values for enumeration 'MV_SAVE_IAMGE_TYPE' 330 | MV_SAVE_IAMGE_TYPE = c_int # enum 331 | # CameraParams.h 198 332 | class _MV_SAVE_IMAGE_PARAM_T_(Structure): 333 | pass 334 | _MV_SAVE_IMAGE_PARAM_T_._fields_ = [ 335 | # CameraParams.h 198 336 | ('pData', POINTER(c_ubyte)), 337 | ('nDataLen', c_uint), 338 | ('enPixelType', MvGvspPixelType), 339 | ('nWidth', c_ushort), 340 | ('nHeight', c_ushort), 341 | ('pImageBuffer', POINTER(c_ubyte)), 342 | ('nImageLen', c_uint), 343 | ('nBufferSize', c_uint), 344 | ('enImageType', MV_SAVE_IAMGE_TYPE), 345 | ] 346 | MV_SAVE_IMAGE_PARAM = _MV_SAVE_IMAGE_PARAM_T_ 347 | # CameraParams.h 214 348 | class _MV_SAVE_IMAGE_PARAM_T_EX_(Structure): 349 | pass 350 | _MV_SAVE_IMAGE_PARAM_T_EX_._fields_ = [ 351 | # CameraParams.h 214 352 | ('pData', POINTER(c_ubyte)), 353 | ('nDataLen', c_uint), 354 | ('enPixelType', MvGvspPixelType), 355 | ('nWidth', c_ushort), 356 | ('nHeight', c_ushort), 357 | ('pImageBuffer', POINTER(c_ubyte)), 358 | ('nImageLen', c_uint), 359 | ('nBufferSize', c_uint), 360 | ('enImageType', MV_SAVE_IAMGE_TYPE), 361 | ('nJpgQuality', c_uint), 362 | ('iMethodValue', c_uint), 363 | ('nReserved', c_uint * 3), 364 | ] 365 | MV_SAVE_IMAGE_PARAM_EX = _MV_SAVE_IMAGE_PARAM_T_EX_ 366 | # CameraParams.h 236 367 | class _MV_PIXEL_CONVERT_PARAM_T_(Structure): 368 | pass 369 | _MV_PIXEL_CONVERT_PARAM_T_._fields_ = [ 370 | # CameraParams.h 236 371 | ('nWidth', c_ushort), 372 | ('nHeight', c_ushort), 373 | ('enSrcPixelType', MvGvspPixelType), 374 | ('pSrcData', POINTER(c_ubyte)), 375 | ('nSrcDataLen', c_uint), 376 | ('enDstPixelType', MvGvspPixelType), 377 | ('pDstBuffer', POINTER(c_ubyte)), 378 | ('nDstLen', c_uint), 379 | ('nDstBufferSize', c_uint), 380 | ('nRes', c_uint * 4), 381 | ] 382 | MV_CC_PIXEL_CONVERT_PARAM = _MV_PIXEL_CONVERT_PARAM_T_ 383 | 384 | # values for enumeration '_MV_CAM_ACQUISITION_MODE_' 385 | _MV_CAM_ACQUISITION_MODE_ = c_int # enum 386 | MV_CAM_ACQUISITION_MODE = _MV_CAM_ACQUISITION_MODE_ 387 | 388 | # values for enumeration '_MV_CAM_GAIN_MODE_' 389 | _MV_CAM_GAIN_MODE_ = c_int # enum 390 | MV_CAM_GAIN_MODE = _MV_CAM_GAIN_MODE_ 391 | 392 | # values for enumeration '_MV_CAM_EXPOSURE_MODE_' 393 | _MV_CAM_EXPOSURE_MODE_ = c_int # enum 394 | MV_CAM_EXPOSURE_MODE = _MV_CAM_EXPOSURE_MODE_ 395 | 396 | # values for enumeration '_MV_CAM_EXPOSURE_AUTO_MODE_' 397 | _MV_CAM_EXPOSURE_AUTO_MODE_ = c_int # enum 398 | MV_CAM_EXPOSURE_AUTO_MODE = _MV_CAM_EXPOSURE_AUTO_MODE_ 399 | 400 | # values for enumeration '_MV_CAM_TRIGGER_MODE_' 401 | _MV_CAM_TRIGGER_MODE_ = c_int # enum 402 | MV_CAM_TRIGGER_MODE = _MV_CAM_TRIGGER_MODE_ 403 | 404 | # values for enumeration '_MV_CAM_GAMMA_SELECTOR_' 405 | _MV_CAM_GAMMA_SELECTOR_ = c_int # enum 406 | MV_CAM_GAMMA_SELECTOR = _MV_CAM_GAMMA_SELECTOR_ 407 | 408 | # values for enumeration '_MV_CAM_BALANCEWHITE_AUTO_' 409 | _MV_CAM_BALANCEWHITE_AUTO_ = c_int # enum 410 | MV_CAM_BALANCEWHITE_AUTO = _MV_CAM_BALANCEWHITE_AUTO_ 411 | 412 | # values for enumeration '_MV_CAM_TRIGGER_SOURCE_' 413 | _MV_CAM_TRIGGER_SOURCE_ = c_int # enum 414 | MV_CAM_TRIGGER_SOURCE = _MV_CAM_TRIGGER_SOURCE_ 415 | 416 | # values for enumeration '_MV_GIGE_TRANSMISSION_TYPE_' 417 | _MV_GIGE_TRANSMISSION_TYPE_ = c_int # enum 418 | MV_GIGE_TRANSMISSION_TYPE = _MV_GIGE_TRANSMISSION_TYPE_ 419 | # CameraParams.h 377 420 | class _MV_ALL_MATCH_INFO_(Structure): 421 | pass 422 | _MV_ALL_MATCH_INFO_._fields_ = [ 423 | # CameraParams.h 377 424 | ('nType', c_uint), 425 | ('pInfo', c_void_p), 426 | ('nInfoSize', c_uint), 427 | ] 428 | MV_ALL_MATCH_INFO = _MV_ALL_MATCH_INFO_ 429 | # CameraParams.h 387 430 | class _MV_MATCH_INFO_NET_DETECT_(Structure): 431 | pass 432 | _MV_MATCH_INFO_NET_DETECT_._fields_ = [ 433 | # CameraParams.h 387 434 | ('nReviceDataSize', int64_t), 435 | ('nLostPacketCount', int64_t), 436 | ('nLostFrameCount', c_uint), 437 | ('nReserved', c_uint * 5), 438 | ] 439 | MV_MATCH_INFO_NET_DETECT = _MV_MATCH_INFO_NET_DETECT_ 440 | # CameraParams.h 396 441 | class _MV_MATCH_INFO_USB_DETECT_(Structure): 442 | pass 443 | _MV_MATCH_INFO_USB_DETECT_._fields_ = [ 444 | # CameraParams.h 396 445 | ('nReviceDataSize', int64_t), 446 | ('nRevicedFrameCount', c_uint), 447 | ('nErrorFrameCount', c_uint), 448 | ('nReserved', c_uint * 2), 449 | ] 450 | MV_MATCH_INFO_USB_DETECT = _MV_MATCH_INFO_USB_DETECT_ 451 | # CameraParams.h 404 452 | class _MV_IMAGE_BASIC_INFO_(Structure): 453 | pass 454 | _MV_IMAGE_BASIC_INFO_._fields_ = [ 455 | # CameraParams.h 404 456 | ('nWidthValue', c_ushort), 457 | ('nWidthMin', c_ushort), 458 | ('nWidthMax', c_uint), 459 | ('nWidthInc', c_uint), 460 | ('nHeightValue', c_uint), 461 | ('nHeightMin', c_uint), 462 | ('nHeightMax', c_uint), 463 | ('nHeightInc', c_uint), 464 | ('fFrameRateValue', c_float), 465 | ('fFrameRateMin', c_float), 466 | ('fFrameRateMax', c_float), 467 | ('enPixelType', c_uint), 468 | ('nSupportedPixelFmtNum', c_uint), 469 | ('enPixelList', c_uint * 64), 470 | ('nReserved', c_uint * 8), 471 | ] 472 | MV_IMAGE_BASIC_INFO = _MV_IMAGE_BASIC_INFO_ 473 | 474 | # values for enumeration 'MV_XML_InterfaceType' 475 | MV_XML_InterfaceType = c_int # enum 476 | 477 | # values for enumeration 'MV_XML_AccessMode' 478 | MV_XML_AccessMode = c_int # enum 479 | 480 | # values for enumeration 'MV_XML_Visibility' 481 | MV_XML_Visibility = c_int # enum 482 | # CameraParams.h 500 483 | class _MV_EVENT_OUT_INFO_(Structure): 484 | pass 485 | _MV_EVENT_OUT_INFO_._fields_ = [ 486 | # CameraParams.h 500 487 | ('EventName', c_char * 128), 488 | ('nEventID', c_ushort), 489 | ('nStreamChannel', c_ushort), 490 | ('nBlockIdHigh', c_uint), 491 | ('nBlockIdLow', c_uint), 492 | ('nTimestampHigh', c_uint), 493 | ('nTimestampLow', c_uint), 494 | ('pEventData', c_void_p), 495 | ('nEventDataSize', c_uint), 496 | ('nReserved', c_uint * 16), 497 | ] 498 | MV_EVENT_OUT_INFO = _MV_EVENT_OUT_INFO_ 499 | # CameraParams.h 520 500 | class _MV_CC_FILE_ACCESS_T(Structure): 501 | pass 502 | _MV_CC_FILE_ACCESS_T._fields_ = [ 503 | # CameraParams.h 520 504 | ('pUserFileName', STRING), 505 | ('pDevFileName', STRING), 506 | ('nReserved', c_uint * 32), 507 | ] 508 | MV_CC_FILE_ACCESS = _MV_CC_FILE_ACCESS_T 509 | # CameraParams.h 529 510 | class _MV_CC_FILE_ACCESS_PROGRESS_T(Structure): 511 | pass 512 | _MV_CC_FILE_ACCESS_PROGRESS_T._fields_ = [ 513 | # CameraParams.h 529 514 | ('nCompleted', int64_t), 515 | ('nTotal', int64_t), 516 | ('nReserved', c_uint * 8), 517 | ] 518 | MV_CC_FILE_ACCESS_PROGRESS = _MV_CC_FILE_ACCESS_PROGRESS_T 519 | # CameraParams.h 538 520 | class _MV_TRANSMISSION_TYPE_T(Structure): 521 | pass 522 | _MV_TRANSMISSION_TYPE_T._fields_ = [ 523 | # CameraParams.h 538 524 | ('enTransmissionType', MV_GIGE_TRANSMISSION_TYPE), 525 | ('nDestIp', c_uint), 526 | ('nDestPort', c_ushort), 527 | ('nReserved', c_uint * 32), 528 | ] 529 | MV_TRANSMISSION_TYPE = _MV_TRANSMISSION_TYPE_T 530 | # CameraParams.h 548 531 | class _MV_XML_NODE_FEATURE_(Structure): 532 | pass 533 | _MV_XML_NODE_FEATURE_._fields_ = [ 534 | # CameraParams.h 548 535 | ('enType', MV_XML_InterfaceType), 536 | ('enVisivility', MV_XML_Visibility), 537 | ('strDescription', c_char * 512), 538 | ('strDisplayName', c_char * 64), 539 | ('strName', c_char * 64), 540 | ('strToolTip', c_char * 512), 541 | ('nReserved', c_uint * 4), 542 | ] 543 | MV_XML_NODE_FEATURE = _MV_XML_NODE_FEATURE_ 544 | # CameraParams.h 561 545 | class _MV_XML_NODES_LIST_(Structure): 546 | pass 547 | _MV_XML_NODES_LIST_._fields_ = [ 548 | # CameraParams.h 561 549 | ('nNodeNum', c_uint), 550 | ('stNodes', MV_XML_NODE_FEATURE * 128), 551 | ] 552 | MV_XML_NODES_LIST = _MV_XML_NODES_LIST_ 553 | # CameraParams.h 569 554 | class _MV_XML_FEATURE_Value_(Structure): 555 | pass 556 | _MV_XML_FEATURE_Value_._fields_ = [ 557 | # CameraParams.h 569 558 | ('enType', MV_XML_InterfaceType), 559 | ('strDescription', c_char * 512), 560 | ('strDisplayName', c_char * 64), 561 | ('strName', c_char * 64), 562 | ('strToolTip', c_char * 512), 563 | ('nReserved', c_uint * 4), 564 | ] 565 | MV_XML_FEATURE_Value = _MV_XML_FEATURE_Value_ 566 | # CameraParams.h 579 567 | class _MV_XML_FEATURE_Base_(Structure): 568 | pass 569 | _MV_XML_FEATURE_Base_._fields_ = [ 570 | # CameraParams.h 579 571 | ('enAccessMode', MV_XML_AccessMode), 572 | ] 573 | MV_XML_FEATURE_Base = _MV_XML_FEATURE_Base_ 574 | # CameraParams.h 584 575 | class _MV_XML_FEATURE_Integer_(Structure): 576 | pass 577 | _MV_XML_FEATURE_Integer_._fields_ = [ 578 | # CameraParams.h 584 579 | ('strName', c_char * 64), 580 | ('strDisplayName', c_char * 64), 581 | ('strDescription', c_char * 512), 582 | ('strToolTip', c_char * 512), 583 | ('enVisivility', MV_XML_Visibility), 584 | ('enAccessMode', MV_XML_AccessMode), 585 | ('bIsLocked', c_int), 586 | ('nValue', int64_t), 587 | ('nMinValue', int64_t), 588 | ('nMaxValue', int64_t), 589 | ('nIncrement', int64_t), 590 | ('nReserved', c_uint * 4), 591 | ] 592 | MV_XML_FEATURE_Integer = _MV_XML_FEATURE_Integer_ 593 | # CameraParams.h 603 594 | class _MV_XML_FEATURE_Boolean_(Structure): 595 | pass 596 | _MV_XML_FEATURE_Boolean_._fields_ = [ 597 | # CameraParams.h 603 598 | ('strName', c_char * 64), 599 | ('strDisplayName', c_char * 64), 600 | ('strDescription', c_char * 512), 601 | ('strToolTip', c_char * 512), 602 | ('enVisivility', MV_XML_Visibility), 603 | ('enAccessMode', MV_XML_AccessMode), 604 | ('bIsLocked', c_int), 605 | ('bValue', c_bool), 606 | ('nReserved', c_uint * 4), 607 | ] 608 | MV_XML_FEATURE_Boolean = _MV_XML_FEATURE_Boolean_ 609 | # CameraParams.h 618 610 | class _MV_XML_FEATURE_Command_(Structure): 611 | pass 612 | _MV_XML_FEATURE_Command_._fields_ = [ 613 | # CameraParams.h 618 614 | ('strName', c_char * 64), 615 | ('strDisplayName', c_char * 64), 616 | ('strDescription', c_char * 512), 617 | ('strToolTip', c_char * 512), 618 | ('enVisivility', MV_XML_Visibility), 619 | ('enAccessMode', MV_XML_AccessMode), 620 | ('bIsLocked', c_int), 621 | ('nReserved', c_uint * 4), 622 | ] 623 | MV_XML_FEATURE_Command = _MV_XML_FEATURE_Command_ 624 | # CameraParams.h 632 625 | class _MV_XML_FEATURE_Float_(Structure): 626 | pass 627 | _MV_XML_FEATURE_Float_._fields_ = [ 628 | # CameraParams.h 632 629 | ('strName', c_char * 64), 630 | ('strDisplayName', c_char * 64), 631 | ('strDescription', c_char * 512), 632 | ('strToolTip', c_char * 512), 633 | ('enVisivility', MV_XML_Visibility), 634 | ('enAccessMode', MV_XML_AccessMode), 635 | ('bIsLocked', c_int), 636 | ('dfValue', c_double), 637 | ('dfMinValue', c_double), 638 | ('dfMaxValue', c_double), 639 | ('dfIncrement', c_double), 640 | ('nReserved', c_uint * 4), 641 | ] 642 | MV_XML_FEATURE_Float = _MV_XML_FEATURE_Float_ 643 | # CameraParams.h 650 644 | class _MV_XML_FEATURE_String_(Structure): 645 | pass 646 | _MV_XML_FEATURE_String_._fields_ = [ 647 | # CameraParams.h 650 648 | ('strName', c_char * 64), 649 | ('strDisplayName', c_char * 64), 650 | ('strDescription', c_char * 512), 651 | ('strToolTip', c_char * 512), 652 | ('enVisivility', MV_XML_Visibility), 653 | ('enAccessMode', MV_XML_AccessMode), 654 | ('bIsLocked', c_int), 655 | ('strValue', c_char * 64), 656 | ('nReserved', c_uint * 4), 657 | ] 658 | MV_XML_FEATURE_String = _MV_XML_FEATURE_String_ 659 | # CameraParams.h 665 660 | class _MV_XML_FEATURE_Register_(Structure): 661 | pass 662 | _MV_XML_FEATURE_Register_._fields_ = [ 663 | # CameraParams.h 665 664 | ('strName', c_char * 64), 665 | ('strDisplayName', c_char * 64), 666 | ('strDescription', c_char * 512), 667 | ('strToolTip', c_char * 512), 668 | ('enVisivility', MV_XML_Visibility), 669 | ('enAccessMode', MV_XML_AccessMode), 670 | ('bIsLocked', c_int), 671 | ('nAddrValue', int64_t), 672 | ('nReserved', c_uint * 4), 673 | ] 674 | MV_XML_FEATURE_Register = _MV_XML_FEATURE_Register_ 675 | # CameraParams.h 680 676 | class _MV_XML_FEATURE_Category_(Structure): 677 | pass 678 | _MV_XML_FEATURE_Category_._fields_ = [ 679 | # CameraParams.h 680 680 | ('strDescription', c_char * 512), 681 | ('strDisplayName', c_char * 64), 682 | ('strName', c_char * 64), 683 | ('strToolTip', c_char * 512), 684 | ('enVisivility', MV_XML_Visibility), 685 | ('nReserved', c_uint * 4), 686 | ] 687 | MV_XML_FEATURE_Category = _MV_XML_FEATURE_Category_ 688 | # CameraParams.h 692 689 | class _MV_XML_FEATURE_EnumEntry_(Structure): 690 | pass 691 | _MV_XML_FEATURE_EnumEntry_._fields_ = [ 692 | # CameraParams.h 692 693 | ('strName', c_char * 64), 694 | ('strDisplayName', c_char * 64), 695 | ('strDescription', c_char * 512), 696 | ('strToolTip', c_char * 512), 697 | ('bIsImplemented', c_int), 698 | ('nParentsNum', c_int), 699 | ('stParentsList', MV_XML_NODE_FEATURE * 8), 700 | ('enVisivility', MV_XML_Visibility), 701 | ('nValue', int64_t), 702 | ('enAccessMode', MV_XML_AccessMode), 703 | ('bIsLocked', c_int), 704 | ('nReserved', c_int * 8), 705 | ] 706 | MV_XML_FEATURE_EnumEntry = _MV_XML_FEATURE_EnumEntry_ 707 | # CameraParams.h 711 708 | class _MV_XML_FEATURE_Enumeration_(Structure): 709 | pass 710 | _MV_XML_FEATURE_Enumeration_._fields_ = [ 711 | # CameraParams.h 711 712 | ('enVisivility', MV_XML_Visibility), 713 | ('strDescription', c_char * 512), 714 | ('strDisplayName', c_char * 64), 715 | ('strName', c_char * 64), 716 | ('strToolTip', c_char * 512), 717 | ('nSymbolicNum', c_int), 718 | ('strCurrentSymbolic', c_char * 64), 719 | ('strSymbolic', c_char * 64 * 64), 720 | ('enAccessMode', MV_XML_AccessMode), 721 | ('bIsLocked', c_int), 722 | ('nValue', int64_t), 723 | ('nReserved', c_uint * 4), 724 | ] 725 | MV_XML_FEATURE_Enumeration = _MV_XML_FEATURE_Enumeration_ 726 | # CameraParams.h 730 727 | class _MV_XML_FEATURE_Port_(Structure): 728 | pass 729 | _MV_XML_FEATURE_Port_._fields_ = [ 730 | # CameraParams.h 730 731 | ('enVisivility', MV_XML_Visibility), 732 | ('strDescription', c_char * 512), 733 | ('strDisplayName', c_char * 64), 734 | ('strName', c_char * 64), 735 | ('strToolTip', c_char * 512), 736 | ('enAccessMode', MV_XML_AccessMode), 737 | ('bIsLocked', c_int), 738 | ('nReserved', c_uint * 4), 739 | ] 740 | MV_XML_FEATURE_Port = _MV_XML_FEATURE_Port_ 741 | # CameraParams.h 746 742 | class _MV_XML_CAMERA_FEATURE_(Structure): 743 | pass 744 | # CameraParams.h 749 745 | class N23_MV_XML_CAMERA_FEATURE_3DOT_1E(Union): 746 | pass 747 | N23_MV_XML_CAMERA_FEATURE_3DOT_1E._fields_ = [ 748 | # CameraParams.h 749 749 | ('stIntegerFeature', MV_XML_FEATURE_Integer), 750 | ('stFloatFeature', MV_XML_FEATURE_Float), 751 | ('stEnumerationFeature', MV_XML_FEATURE_Enumeration), 752 | ('stStringFeature', MV_XML_FEATURE_String), 753 | ] 754 | _MV_XML_CAMERA_FEATURE_._fields_ = [ 755 | # CameraParams.h 746 756 | ('enType', MV_XML_InterfaceType), 757 | ('SpecialFeature', N23_MV_XML_CAMERA_FEATURE_3DOT_1E), 758 | ] 759 | MV_XML_CAMERA_FEATURE = _MV_XML_CAMERA_FEATURE_ 760 | # CameraParams.h 760 761 | class _MVCC_ENUMVALUE_T(Structure): 762 | pass 763 | _MVCC_ENUMVALUE_T._fields_ = [ 764 | # CameraParams.h 760 765 | ('nCurValue', c_uint), 766 | ('nSupportedNum', c_uint), 767 | ('nSupportValue', c_uint * 64), 768 | ('nReserved', c_uint * 4), 769 | ] 770 | MVCC_ENUMVALUE = _MVCC_ENUMVALUE_T 771 | # CameraParams.h 769 772 | class _MVCC_INTVALUE_T(Structure): 773 | pass 774 | _MVCC_INTVALUE_T._fields_ = [ 775 | # CameraParams.h 769 776 | ('nCurValue', c_uint), 777 | ('nMax', c_uint), 778 | ('nMin', c_uint), 779 | ('nInc', c_uint), 780 | ('nReserved', c_uint * 4), 781 | ] 782 | MVCC_INTVALUE = _MVCC_INTVALUE_T 783 | # CameraParams.h 779 784 | class _MVCC_INTVALUE_EX_T(Structure): 785 | pass 786 | _MVCC_INTVALUE_EX_T._fields_ = [ 787 | # CameraParams.h 779 788 | ('nCurValue', int64_t), 789 | ('nMax', int64_t), 790 | ('nMin', int64_t), 791 | ('nInc', int64_t), 792 | ('nReserved', c_uint * 16), 793 | ] 794 | MVCC_INTVALUE_EX = _MVCC_INTVALUE_EX_T 795 | # CameraParams.h 789 796 | class _MVCC_FLOATVALUE_T(Structure): 797 | pass 798 | _MVCC_FLOATVALUE_T._fields_ = [ 799 | # CameraParams.h 789 800 | ('fCurValue', c_float), 801 | ('fMax', c_float), 802 | ('fMin', c_float), 803 | ('nReserved', c_uint * 4), 804 | ] 805 | MVCC_FLOATVALUE = _MVCC_FLOATVALUE_T 806 | # CameraParams.h 798 807 | class _MVCC_STRINGVALUE_T(Structure): 808 | pass 809 | _MVCC_STRINGVALUE_T._fields_ = [ 810 | # CameraParams.h 798 811 | ('chCurValue', c_char * 256), 812 | ('nMaxLength', int64_t), 813 | ('nReserved', c_uint * 2), 814 | ] 815 | MVCC_STRINGVALUE = _MVCC_STRINGVALUE_T 816 | __all__ = ['_MV_ALL_MATCH_INFO_', '_MV_XML_FEATURE_Integer_', 817 | 'MV_CC_FILE_ACCESS_PROGRESS', 818 | 'N19_MV_CC_DEVICE_INFO_3DOT_0E', 819 | 'MV_CAM_EXPOSURE_AUTO_MODE', 'PixelType_Gvsp_BayerRG8', 820 | 'MV_CAM_GAIN_MODE', 821 | 'MV_GIGE_TRANSTYPE_UNICAST_WITHOUT_RECV', 822 | 'PixelType_Gvsp_BayerGB12_Packed', 823 | 'MV_TRIGGER_SOURCE_LINE0', 'MV_TRIGGER_SOURCE_LINE1', 824 | 'MV_TRIGGER_SOURCE_LINE2', 'MV_TRIGGER_SOURCE_LINE3', 825 | 'AM_CycleDetect', 'PixelType_Gvsp_YCBCR422_8', 826 | 'IFT_IFloat', 'MV_TRANSMISSION_TYPE', 827 | '_MV_XML_FEATURE_Command_', '_MV_XML_FEATURE_String_', 828 | '_MV_CAM_TRIGGER_SOURCE_', 829 | 'PixelType_Gvsp_COORD3D_DEPTH_PLUS_MASK', 830 | 'PixelType_Gvsp_RGB10V1_Packed', 831 | 'PixelType_Gvsp_RGB10_Packed', 832 | 'PixelType_Gvsp_RGB8_Planar', 'AM_RO', 'IFT_IPort', 833 | 'uint_least16_t', '_MV_FRAME_OUT_INFO_EX_', 834 | '_MV_TRANSMISSION_TYPE_T', 'MV_SAVE_IMAGE_PARAM_EX', 835 | 'AM_RW', 'MV_XML_InterfaceType', '_MV_XML_CAMERA_FEATURE_', 836 | 'intptr_t', 'uint_least64_t', 'V_Guru', 837 | '_MV_CAM_TRIGGER_MODE_', 'MV_CAM_EXPOSURE_MODE', 838 | 'int_least32_t', 'MV_GIGE_TRANSTYPE_SUBNETBROADCAST', 839 | '_MV_XML_FEATURE_Boolean_', 840 | 'MV_BALANCEWHITE_AUTO_CONTINUOUS', 'MV_XML_NODE_FEATURE', 841 | '_MV_FRAME_OUT_INFO_', 'MV_ALL_MATCH_INFO', 842 | '_MV_XML_FEATURE_EnumEntry_', '_MV_PIXEL_CONVERT_PARAM_T_', 843 | 'PixelType_Gvsp_RGB16_Packed', 844 | 'PixelType_Gvsp_RGBA8_Packed', 845 | 'PixelType_Gvsp_RGB8_Packed', 'MV_ACQ_MODE_SINGLE', 846 | 'MV_TRIGGER_MODE_ON', '_MV_XML_FEATURE_Base_', 847 | 'PixelType_Gvsp_Mono8_Signed', 'int_least16_t', 848 | 'MV_GIGE_TRANSTYPE_LIMITEDBROADCAST', 'int_fast32_t', 849 | '_MV_CAM_GAIN_MODE_', 'uint_fast16_t', 850 | '_MV_DISPLAY_FRAME_INFO_', 'IFT_ICommand', 851 | 'PixelType_Gvsp_BayerBG10_Packed', 852 | '_MV_CAM_ACQUISITION_MODE_', 853 | 'PixelType_Gvsp_YCBCR709_422_8_CBYCRY', 'V_Beginner', 854 | 'PixelType_Gvsp_BayerBG16', 855 | 'MV_GIGE_TRANSTYPE_MULTICAST_WITHOUT_RECV', 856 | 'MVCC_INTVALUE', '_MV_XML_FEATURE_Port_', 857 | '_MV_GIGE_TRANSMISSION_TYPE_', 'MV_GIGE_TRANSMISSION_TYPE', 858 | 'PixelType_Gvsp_YUV411_Packed', 859 | '_MV_XML_FEATURE_Register_', 'MV_EXPOSURE_MODE_TIMED', 860 | 'intmax_t', 'PixelType_Gvsp_BayerBG12_Packed', 'int16_t', 861 | 'MV_DISPLAY_FRAME_INFO', 'MV_XML_FEATURE_Integer', 862 | '_MV_CC_FILE_ACCESS_PROGRESS_T', 'MV_XML_Visibility', 863 | 'IFT_IEnumEntry', 'int_fast64_t', 864 | 'PixelType_Gvsp_BayerRG12', 'PixelType_Gvsp_BayerRG10', 865 | 'MV_XML_AccessMode', 'V_Expert', 'MV_GAIN_MODE_ONCE', 866 | 'IFT_IInteger', 'PixelType_Gvsp_YCBCR709_411_8_CBYYCRYY', 867 | 'MV_CAM_BALANCEWHITE_AUTO', 'int_least8_t', 'IFT_IBase', 868 | 'MV_XML_NODES_LIST', 'MV_TRIGGER_MODE_OFF', 'MV_Image_Bmp', 869 | 'MV_XML_FEATURE_String', 'MV_CC_FILE_ACCESS', 870 | '_MV_CAM_EXPOSURE_AUTO_MODE_', 871 | 'PixelType_Gvsp_Coord3D_AC32f', 'uint_least8_t', 872 | 'PixelType_Gvsp_BayerRG12_Packed', 873 | '_MV_XML_FEATURE_Float_', '_MV_XML_NODE_FEATURE_', 874 | 'MV_XML_FEATURE_Float', 'PixelType_Gvsp_BGR12_Packed', 875 | 'PixelType_Gvsp_YUV422_Packed', 'MV_SAVE_IMAGE_PARAM', 876 | 'MV_EVENT_OUT_INFO', 'IFT_IEnumeration', 'uint64_t', 877 | 'uint8_t', 'PixelType_Gvsp_RGB12_Planar', 'V_Undefined', 878 | '_MVCC_STRINGVALUE_T', 'PixelType_Gvsp_YCBCR709_422_8', 879 | 'MV_CAM_TRIGGER_MODE', 'PixelType_Gvsp_BayerRG10_Packed', 880 | 'N23_MV_XML_CAMERA_FEATURE_3DOT_1E', 'uint16_t', 881 | 'uint_fast8_t', '_MV_SAVE_IMAGE_PARAM_T_', 882 | 'PixelType_Gvsp_BGR8_Packed', '_MVCC_ENUMVALUE_T', 883 | '_MV_MATCH_INFO_USB_DETECT_', 'MV_XML_FEATURE_Category', 884 | 'PixelType_Gvsp_Jpeg', 'int32_t', 885 | 'PixelType_Gvsp_BayerGR10_Packed', 886 | 'MV_XML_FEATURE_EnumEntry', '_MV_CC_DEVICE_INFO_', 887 | 'PixelType_Gvsp_BayerBG12', 'PixelType_Gvsp_BayerBG10', 888 | 'IFT_IBoolean', 'PixelType_Gvsp_Mono12', 889 | 'MV_MATCH_INFO_USB_DETECT', 'PixelType_Gvsp_RGB16_Planar', 890 | 'MVCC_ENUMVALUE', 'IFT_IString', 891 | 'PixelType_Gvsp_BayerRG16', '_MV_XML_FEATURE_Value_', 892 | 'MV_ACQ_MODE_CONTINUOUS', 893 | 'MV_TRIGGER_SOURCE_FrequencyConverter', 894 | 'PixelType_Gvsp_Mono4p', 'MV_TRIGGER_SOURCE_COUNTER0', 895 | 'MV_GAIN_MODE_OFF', 'MV_Image_Png', 896 | '_MV_CC_DEVICE_INFO_LIST_', 'MV_GIGE_DEVICE_INFO', 897 | '_MV_SAVE_IMAGE_PARAM_T_EX_', 'PixelType_Gvsp_Mono8', 898 | 'uint_least32_t', 'PixelType_Gvsp_BayerGR16', 899 | 'MV_FRAME_OUT_INFO', 'PixelType_Gvsp_BayerGR10', 900 | 'PixelType_Gvsp_BGRA8_Packed', 'PixelType_Gvsp_BayerGR12', 901 | '_MVCC_INTVALUE_EX_T', 'uintptr_t', 902 | 'PixelType_Gvsp_Mono12_Packed', 'MVCC_FLOATVALUE', 903 | 'MV_GIGE_TRANSTYPE_CAMERADEFINED', '_MV_XML_NODES_LIST_', 904 | 'MV_NETTRANS_INFO', 'IFT_IRegister', 'AM_NA', 905 | 'MV_GIGE_TRANSTYPE_UNICAST', 'int8_t', 906 | '_MV_GIGE_DEVICE_INFO_', 'IFT_IValue', 'IFT_ICategory', 907 | 'int_fast8_t', 'PixelType_Gvsp_YCBCR709_8_CBYCR', 908 | 'MV_XML_FEATURE_Enumeration', 'MV_GAMMA_SELECTOR_SRGB', 909 | 'PixelType_Gvsp_YCBCR601_422_8', 910 | 'PixelType_Gvsp_YCBCR411_8_CBYYCRYY', 'int_least64_t', 911 | 'MV_EXPOSURE_AUTO_MODE_OFF', 'MV_CC_PIXEL_CONVERT_PARAM', 912 | 'MV_EXPOSURE_AUTO_MODE_CONTINUOUS', 913 | 'MV_CAM_ACQUISITION_MODE', '_MVCC_INTVALUE_T', 914 | 'MV_XML_FEATURE_Value', 'AM_Undefined', 915 | 'MV_MATCH_INFO_NET_DETECT', 'PixelType_Gvsp_Undefined', 916 | '_MV_CC_FILE_ACCESS_T', 'AM_NI', 917 | 'PixelType_Gvsp_BayerGR12_Packed', 'V_Invisible', 918 | 'PixelType_Gvsp_YCBCR601_411_8_CBYYCRYY', 919 | 'PixelType_Gvsp_RGB10_Planar', 'MV_CAM_GAMMA_SELECTOR', 920 | 'MV_TRIGGER_SOURCE_SOFTWARE', 'PixelType_Gvsp_BayerGB16', 921 | 'MV_BALANCEWHITE_AUTO_ONCE', 'PixelType_Gvsp_BayerGB10', 922 | 'uintmax_t', 'PixelType_Gvsp_BayerGB12', 'int_fast16_t', 923 | '_MV_CAM_EXPOSURE_MODE_', 'MV_Image_Tif', 924 | 'PixelType_Gvsp_BGR565_Packed', 'MV_BALANCEWHITE_AUTO_OFF', 925 | 'int64_t', 'MV_Image_Undefined', '_MV_NETTRANS_INFO_', 926 | 'MV_GAIN_MODE_CONTINUOUS', 'PixelType_Gvsp_Mono1p', 927 | 'uint_fast32_t', 'MV_CAM_TRIGGER_SOURCE', 928 | 'PixelType_Gvsp_YUV444_Packed', 'MV_Image_Jpeg', 929 | '_MVCC_FLOATVALUE_T', 'MV_XML_FEATURE_Port', 930 | 'PixelType_Gvsp_YUV422_YUYV_Packed', 931 | 'MV_FRAME_OUT_INFO_EX', '_MV_IMAGE_BASIC_INFO_', 932 | '_MV_CAM_BALANCEWHITE_AUTO_', 'MV_XML_FEATURE_Base', 933 | '_MV_USB3_DEVICE_INFO_', 'PixelType_Gvsp_BayerBG8', 934 | 'MVCC_INTVALUE_EX', 'MV_XML_FEATURE_Register', 'AM_WO', 935 | 'MV_GIGE_TRANSTYPE_UNICAST_DEFINED_PORT', 936 | '_MV_XML_FEATURE_Enumeration_', 937 | '_MV_MATCH_INFO_NET_DETECT_', 'MV_SAVE_IAMGE_TYPE', 938 | 'MV_EXPOSURE_AUTO_MODE_ONCE', 939 | 'PixelType_Gvsp_BGR10_Packed', 940 | 'PixelType_Gvsp_BayerGB10_Packed', 941 | 'PixelType_Gvsp_Coord3D_ABC32f_Planar', 942 | 'MV_GIGE_TRANSTYPE_MULTICAST', 'MV_XML_CAMERA_FEATURE', 943 | 'PixelType_Gvsp_Coord3D_ABC32f', 'MVCC_STRINGVALUE', 944 | 'MV_CC_DEVICE_INFO', 'PixelType_Gvsp_YCBCR422_8_CBYCRY', 945 | 'PixelType_Gvsp_RGB12_Packed', 'PixelType_Gvsp_BayerGR8', 946 | 'MvGvspPixelType', 'PixelType_Gvsp_Mono10', 947 | 'MV_IMAGE_BASIC_INFO', 'PixelType_Gvsp_Mono16', 948 | 'PixelType_Gvsp_Mono2p', 'PixelType_Gvsp_Mono14', 949 | 'PixelType_Gvsp_RGB10V2_Packed', 'MV_CC_DEVICE_INFO_LIST', 950 | 'PixelType_Gvsp_RGB12V1_Packed', 951 | 'PixelType_Gvsp_Mono10_Packed', 'uint_fast64_t', 952 | 'PixelType_Gvsp_YCBCR601_8_CBYCR', 953 | 'PixelType_Gvsp_BayerGB8', '_MV_XML_FEATURE_Category_', 954 | 'MV_EXPOSURE_MODE_TRIGGER_WIDTH', 955 | 'PixelType_Gvsp_YCBCR8_CBYCR', 'MV_XML_FEATURE_Boolean', 956 | 'MV_GAMMA_SELECTOR_USER', 'PixelType_Gvsp_RGB565_Packed', 957 | 'uint32_t', 'MV_XML_FEATURE_Command', 958 | '_MV_CAM_GAMMA_SELECTOR_', 'MV_ACQ_MODE_MUTLI', 959 | 'PixelType_Gvsp_YCBCR601_422_8_CBYCRY', 960 | 'MV_USB3_DEVICE_INFO', '_MV_EVENT_OUT_INFO_'] 961 | -------------------------------------------------------------------------------- /MvImport/MvCameraControl_class.py: -------------------------------------------------------------------------------- 1 | # -- coding: utf-8 -- 2 | 3 | import sys 4 | import copy 5 | import ctypes 6 | 7 | from ctypes import * 8 | from CameraParams_const import * 9 | from CameraParams_header import * 10 | from MvCameraControl_header import * 11 | from MvErrorDefine_const import * 12 | from PixelType_const import * 13 | from PixelType_header import * 14 | 15 | MvCamCtrldll = WinDLL("MvCameraControl.dll") 16 | 17 | # 用于回调函数传入相机实例 18 | class _MV_PY_OBJECT_(Structure): 19 | pass 20 | _MV_PY_OBJECT_._fields_ = [ 21 | ('PyObject', py_object), 22 | ] 23 | MV_PY_OBJECT = _MV_PY_OBJECT_ 24 | 25 | class MvCamera(): 26 | 27 | def __init__(self): 28 | self._handle = c_void_p() # 记录当前连接设备的句柄 29 | self.handle = pointer(self._handle) # 创建句柄指针 30 | 31 | # 枚举设备 32 | @staticmethod 33 | def MV_CC_EnumDevices(nTLayerType, stDevList): 34 | MvCamCtrldll.MV_CC_EnumDevices.argtype = (c_uint, c_void_p) 35 | MvCamCtrldll.MV_CC_EnumDevices.restype = c_uint 36 | # C原型:int MV_CC_EnumDevices(unsigned int nTLayerType, MV_CC_DEVICE_INFO_LIST* pstDevList) 37 | return MvCamCtrldll.MV_CC_EnumDevices(c_uint(nTLayerType), byref(stDevList)) 38 | 39 | # 创建句柄 40 | def MV_CC_CreateHandle(self, stDevInfo): 41 | MvCamCtrldll.MV_CC_DestroyHandle.argtype = c_void_p 42 | MvCamCtrldll.MV_CC_DestroyHandle.restype = c_uint 43 | MvCamCtrldll.MV_CC_DestroyHandle(self.handle) 44 | 45 | MvCamCtrldll.MV_CC_CreateHandle.argtype = (c_void_p, c_void_p) 46 | MvCamCtrldll.MV_CC_CreateHandle.restype = c_uint 47 | # C原型:int MV_CC_CreateHandle(void ** handle, MV_CC_DEVICE_INFO* pstDevInfo) 48 | return MvCamCtrldll.MV_CC_CreateHandle(byref(self.handle), byref(stDevInfo)) 49 | 50 | # 创建句柄(不生成日志) 51 | def MV_CC_CreateHandleWithoutLog(self, stDevInfo): 52 | MvCamCtrldll.MV_CC_DestroyHandle.argtype = c_void_p 53 | MvCamCtrldll.MV_CC_DestroyHandle.restype = c_uint 54 | MvCamCtrldll.MV_CC_DestroyHandle(self.handle) 55 | 56 | MvCamCtrldll.MV_CC_CreateHandleWithoutLog.argtype = (c_void_p, c_void_p) 57 | MvCamCtrldll.MV_CC_CreateHandleWithoutLog.restype = c_uint 58 | # C原型:int MV_CC_CreateHandleWithoutLog(void ** handle, MV_CC_DEVICE_INFO* pstDevInfo) 59 | return MvCamCtrldll.MV_CC_CreateHandleWithoutLog(byref(self.handle), byref(stDevInfo)) 60 | 61 | # 销毁句柄 62 | def MV_CC_DestroyHandle(self): 63 | MvCamCtrldll.MV_CC_DestroyHandle.argtype = c_void_p 64 | MvCamCtrldll.MV_CC_DestroyHandle.restype = c_uint 65 | return MvCamCtrldll.MV_CC_DestroyHandle(self.handle) 66 | 67 | # 打开设备 68 | def MV_CC_OpenDevice(self, nAccessMode=MV_ACCESS_Exclusive, nSwitchoverKey=0): 69 | MvCamCtrldll.MV_CC_OpenDevice.argtype = (c_void_p, c_uint32, c_uint16) 70 | MvCamCtrldll.MV_CC_OpenDevice.restype = c_uint 71 | # C原型:int MV_CC_OpenDevice(void* handle, unsigned int nAccessMode, unsigned short nSwitchoverKey) 72 | return MvCamCtrldll.MV_CC_OpenDevice(self.handle, nAccessMode, nSwitchoverKey) 73 | 74 | # 关闭设备 75 | def MV_CC_CloseDevice(self): 76 | MvCamCtrldll.MV_CC_CloseDevice.argtype = c_void_p 77 | MvCamCtrldll.MV_CC_CloseDevice.restype = c_uint 78 | return MvCamCtrldll.MV_CC_CloseDevice(self.handle) 79 | 80 | # 注册取流回调 81 | def MV_CC_RegisterImageCallBackEx(self, CallBackFun, pUser): 82 | MvCamCtrldll.MV_CC_RegisterImageCallBackEx.argtype = (c_void_p, c_void_p, c_void_p) 83 | MvCamCtrldll.MV_CC_RegisterImageCallBackEx.restype = c_uint 84 | # C原型:int MV_CC_RegisterImageCallBackEx(void* handle, void(* cbOutput)(unsigned char * pData, MV_FRAME_OUT_INFO_EX* pFrameInfo, void* pUser),void* pUser); 85 | return MvCamCtrldll.MV_CC_RegisterImageCallBackEx(self.handle, CallBackFun, pUser) 86 | 87 | # 开始取流 88 | def MV_CC_StartGrabbing(self): 89 | MvCamCtrldll.MV_CC_StartGrabbing.argtype = c_void_p 90 | MvCamCtrldll.MV_CC_StartGrabbing.restype = c_uint 91 | return MvCamCtrldll.MV_CC_StartGrabbing(self.handle) 92 | 93 | # 停止取流 94 | def MV_CC_StopGrabbing(self): 95 | MvCamCtrldll.MV_CC_StopGrabbing.argtype = c_void_p 96 | MvCamCtrldll.MV_CC_StopGrabbing.restype = c_uint 97 | return MvCamCtrldll.MV_CC_StopGrabbing(self.handle) 98 | 99 | # 主动方式取流 100 | def MV_CC_GetOneFrameTimeout(self, pData, nDataSize, stFrameInfo, nMsec=1000): 101 | MvCamCtrldll.MV_CC_GetOneFrameTimeout.argtype = (c_void_p, c_void_p, c_uint, c_void_p, c_uint) 102 | MvCamCtrldll.MV_CC_GetOneFrameTimeout.restype = c_uint 103 | # C原型:int MV_CC_GetOneFrameTimeout(void* handle, unsigned char * pData , unsigned int nDataSize, MV_FRAME_OUT_INFO_EX* pFrameInfo, unsigned int nMsec) 104 | return MvCamCtrldll.MV_CC_GetOneFrameTimeout(self.handle, pData, nDataSize, byref(stFrameInfo), nMsec) 105 | 106 | # 设置SDK内部图像缓存节点个数,范围[1, 30],在抓图前调用 107 | def MV_CC_SetImageNodeNum(self, nNum): 108 | MvCamCtrldll.MV_CC_SetImageNodeNum.argtype = (c_void_p, c_uint) 109 | MvCamCtrldll.MV_CC_SetImageNodeNum.restype = c_uint 110 | # C原型:int MV_CC_SetImageNodeNum(void* handle, unsigned int nNum) 111 | return MvCamCtrldll.MV_CC_SetImageNodeNum(self.handle, nNum) 112 | 113 | # 获取Integer型属性值 114 | def MV_CC_GetIntValue(self, strKey, stIntValue): 115 | MvCamCtrldll.MV_CC_GetIntValue.argtype = (c_void_p, c_void_p, c_void_p) 116 | MvCamCtrldll.MV_CC_GetIntValue.restype = c_uint 117 | # C原型:int MV_CC_GetIntValue(void* handle,char* strKey,MVCC_INTVALUE *pIntValue) 118 | return MvCamCtrldll.MV_CC_GetIntValue(self.handle, strKey.encode('ascii'), byref(stIntValue)) 119 | 120 | # 设置Integer型属性值 121 | def MV_CC_SetIntValue(self, strKey, nValue): 122 | MvCamCtrldll.MV_CC_SetIntValue.argtype = (c_void_p, c_void_p, c_uint32) 123 | MvCamCtrldll.MV_CC_SetIntValue.restype = c_uint 124 | # C原型:int MV_CC_SetIntValue(void* handle,char* strKey,unsigned int nValue) 125 | return MvCamCtrldll.MV_CC_SetIntValue(self.handle, strKey.encode('ascii'), c_uint32(nValue)) 126 | 127 | # 获取Enum型属性值 128 | def MV_CC_GetEnumValue(self, strKey, stEnumValue): 129 | MvCamCtrldll.MV_CC_GetEnumValue.argtype = (c_void_p, c_void_p, c_void_p) 130 | MvCamCtrldll.MV_CC_GetEnumValue.restype = c_uint 131 | # C原型:int MV_CC_GetEnumValue(void* handle,char* strKey,MVCC_ENUMVALUE *pEnumValue) 132 | return MvCamCtrldll.MV_CC_GetEnumValue(self.handle, strKey.encode('ascii'), byref(stEnumValue)) 133 | 134 | # 设置Enum型属性值 135 | def MV_CC_SetEnumValue(self, strKey, nValue): 136 | MvCamCtrldll.MV_CC_SetEnumValue.argtype = (c_void_p, c_void_p, c_uint32) 137 | MvCamCtrldll.MV_CC_SetEnumValue.restype = c_uint 138 | # C原型:int MV_CC_SetEnumValue(void* handle,char* strKey,unsigned int nValue) 139 | return MvCamCtrldll.MV_CC_SetEnumValue(self.handle, strKey.encode('ascii'), c_uint32(nValue)) 140 | 141 | # 设置Enum型属性值 142 | def MV_CC_SetEnumValueByString(self, strKey, sValue): 143 | MvCamCtrldll.MV_CC_SetEnumValueByString.argtype = (c_void_p, c_void_p, c_void_p) 144 | MvCamCtrldll.MV_CC_SetEnumValueByString.restype = c_uint 145 | # C原型:int MV_CC_SetEnumValueByString(void* handle,char* strKey,char* sValue) 146 | return MvCamCtrldll.MV_CC_SetEnumValueByString(self.handle, strKey.encode('ascii'), sValue.encode('ascii')) 147 | 148 | # 获取Float型属性值 149 | def MV_CC_GetFloatValue(self, strKey, stFloatValue): 150 | MvCamCtrldll.MV_CC_GetFloatValue.argtype = (c_void_p, c_void_p, c_void_p) 151 | MvCamCtrldll.MV_CC_GetFloatValue.restype = c_uint 152 | # C原型:int MV_CC_GetFloatValue(void* handle,char* strKey,MVCC_FLOATVALUE *pFloatValue) 153 | return MvCamCtrldll.MV_CC_GetFloatValue(self.handle, strKey.encode('ascii'), byref(stFloatValue)) 154 | 155 | # 设置Float型属性值 156 | def MV_CC_SetFloatValue(self, strKey, fValue): 157 | MvCamCtrldll.MV_CC_SetFloatValue.argtype = (c_void_p, c_void_p, c_float) 158 | MvCamCtrldll.MV_CC_SetFloatValue.restype = c_uint 159 | # C原型:int MV_CC_SetFloatValue(void* handle,char* strKey,float fValue) 160 | return MvCamCtrldll.MV_CC_SetFloatValue(self.handle, strKey.encode('ascii'), c_float(fValue)) 161 | 162 | # 获取Boolean型属性值 163 | def MV_CC_GetBoolValue(self, strKey, BoolValue): 164 | MvCamCtrldll.MV_CC_GetBoolValue.argtype = (c_void_p, c_void_p, c_void_p) 165 | MvCamCtrldll.MV_CC_GetBoolValue.restype = c_uint 166 | # C原型:int MV_CC_GetBoolValue(void* handle,char* strKey,bool *pBoolValue) 167 | return MvCamCtrldll.MV_CC_GetBoolValue(self.handle, strKey.encode('ascii'), byref(BoolValue)) 168 | 169 | # 设置Boolean型属性值 170 | def MV_CC_SetBoolValue(self, strKey, bValue): 171 | MvCamCtrldll.MV_CC_SetBoolValue.argtype = (c_void_p, c_void_p, c_bool) 172 | MvCamCtrldll.MV_CC_SetBoolValue.restype = c_uint 173 | # C原型:int MV_CC_SetBoolValue(void* handle,char* strKey,bool bValue) 174 | return MvCamCtrldll.MV_CC_SetBoolValue(self.handle, strKey.encode('ascii'), bValue) 175 | 176 | # 获取String型属性值 177 | def MV_CC_GetStringValue(self, strKey, StringValue): 178 | MvCamCtrldll.MV_CC_GetStringValue.argtype = (c_void_p, c_void_p, c_void_p) 179 | MvCamCtrldll.MV_CC_GetStringValue.restype = c_uint 180 | # C原型:int MV_CC_GetStringValue(void* handle,char* strKey,MVCC_STRINGVALUE *pStringValue) 181 | return MvCamCtrldll.MV_CC_GetStringValue(self.handle, strKey.encode('ascii'), byref(StringValue)) 182 | 183 | # 设置String型属性值 184 | def MV_CC_SetStringValue(self, strKey, sValue): 185 | MvCamCtrldll.MV_CC_SetStringValue.argtype = (c_void_p, c_void_p, c_void_p) 186 | MvCamCtrldll.MV_CC_SetStringValue.restype = c_uint 187 | # C原型:int MV_CC_SetStringValue(void* handle,char* strKey,char * sValue) 188 | return MvCamCtrldll.MV_CC_SetStringValue(self.handle, strKey.encode('ascii'), sValue.encode('ascii')) 189 | 190 | # 设置Command型属性值 191 | def MV_CC_SetCommandValue(self, strKey): 192 | MvCamCtrldll.MV_CC_SetCommandValue.argtype = (c_void_p, c_void_p) 193 | MvCamCtrldll.MV_CC_SetCommandValue.restype = c_uint 194 | # C原型:int MV_CC_SetCommandValue(void* handle,char* strKey) 195 | return MvCamCtrldll.MV_CC_SetCommandValue(self.handle, strKey.encode('ascii')) 196 | 197 | # 注册异常消息回调 198 | def MV_CC_RegisterExceptionCallBack(self, ExceptionCallBackFun, pUser): 199 | MvCamCtrldll.MV_CC_RegisterExceptionCallBack.argtype = (c_void_p, c_void_p, c_void_p) 200 | MvCamCtrldll.MV_CC_RegisterExceptionCallBack.restype = c_uint 201 | # C原型:int MV_CC_RegisterExceptionCallBack(void* handle, void(* cbException)(unsigned int nMsgType, void* pUser),void* pUser) 202 | return MvCamCtrldll.MV_CC_RegisterExceptionCallBack(self.handle, ExceptionCallBackFun, pUser) 203 | 204 | # 注册事件回调 205 | def MV_CC_RegisterEventCallBackEx(self, pEventName, EventCallBackFun, pUser): 206 | MvCamCtrldll.MV_CC_RegisterEventCallBackEx.argtype = (c_void_p, c_void_p, c_void_p, c_void_p) 207 | MvCamCtrldll.MV_CC_RegisterEventCallBackEx.restype = c_uint 208 | # C原型:int MV_CC_RegisterEventCallBackEx(void* handle, char* pEventName,void(* cbEvent)(MV_EVENT_OUT_INFO * pEventInfo, void* pUser),void* pUser) 209 | return MvCamCtrldll.MV_CC_RegisterEventCallBackEx(self.handle, pEventName.encode('ascii'), EventCallBackFun, pUser) 210 | 211 | # 强制IP 212 | def MV_GIGE_ForceIpEx(self, nIP, nSubNetMask, nDefaultGateWay): 213 | MvCamCtrldll.MV_GIGE_ForceIpEx.argtype = (c_void_p, c_uint, c_uint, c_uint) 214 | MvCamCtrldll.MV_GIGE_ForceIpEx.restype = c_uint 215 | # C原型:int MV_GIGE_ForceIpEx(void* handle, unsigned int nIP, unsigned int nSubNetMask, unsigned int nDefaultGateWay) 216 | return MvCamCtrldll.MV_GIGE_ForceIpEx(self.handle, c_uint(nIP), c_uint(nSubNetMask), c_uint(nDefaultGateWay)) 217 | 218 | # 配置IP方式 219 | def MV_GIGE_SetIpConfig(self, nType): 220 | MvCamCtrldll.MV_GIGE_SetIpConfig.argtype = (c_void_p, c_uint) 221 | MvCamCtrldll.MV_GIGE_SetIpConfig.restype = c_uint 222 | # C原型:int MV_GIGE_SetIpConfig(void* handle, unsigned int nType) 223 | return MvCamCtrldll.MV_GIGE_SetIpConfig(self.handle, c_uint(nType)) 224 | 225 | # 设置传输模式,可以为单播模式、组播模式等 226 | def MV_GIGE_SetTransmissionType(self, stTransmissionType): 227 | MvCamCtrldll.MV_GIGE_SetTransmissionType.argtype = (c_void_p, c_void_p) 228 | MvCamCtrldll.MV_GIGE_SetTransmissionType.restype = c_uint 229 | # C原型:int MV_GIGE_SetTransmissionType(void* handle, MV_TRANSMISSION_TYPE * pstTransmissionType) 230 | return MvCamCtrldll.MV_GIGE_SetTransmissionType(self.handle, byref(stTransmissionType)) 231 | 232 | # 保存一张图片 233 | def MV_CC_SaveImageEx2(self, stSaveParam): 234 | MvCamCtrldll.MV_CC_SaveImageEx2.argtype = (c_void_p, c_void_p) 235 | MvCamCtrldll.MV_CC_SaveImageEx2.restype = c_uint 236 | # C原型:int MV_CC_SaveImageEx2(void* handle, MV_SAVE_IMAGE_PARAM_EX* pSaveParam) 237 | return MvCamCtrldll.MV_CC_SaveImageEx2(self.handle, byref(stSaveParam)) 238 | 239 | # 像素格式转换 240 | def MV_CC_ConvertPixelType(self, stConvertParam): 241 | MvCamCtrldll.MV_CC_ConvertPixelType.argtype = (c_void_p, c_void_p) 242 | MvCamCtrldll.MV_CC_ConvertPixelType.restype = c_uint 243 | # C原型:int MV_CC_ConvertPixelType(void* handle, MV_CC_PIXEL_CONVERT_PARAM* pstCvtParam) 244 | return MvCamCtrldll.MV_CC_ConvertPixelType(self.handle, byref(stConvertParam)) 245 | 246 | # 保存属性节点 247 | def MV_CC_FeatureSave(self, pFileName): 248 | MvCamCtrldll.MV_CC_FeatureSave.argtype = (c_void_p, c_void_p) 249 | MvCamCtrldll.MV_CC_FeatureSave.restype = c_uint 250 | # C原型:int MV_CC_FeatureSave(void* handle, char* pFileName) 251 | return MvCamCtrldll.MV_CC_FeatureSave(self.handle, pFileName.encode('ascii')) 252 | 253 | # 加载属性节点 254 | def MV_CC_FeatureLoad(self, pFileName): 255 | MvCamCtrldll.MV_CC_FeatureLoad.argtype = (c_void_p, c_void_p) 256 | MvCamCtrldll.MV_CC_FeatureLoad.restype = c_uint 257 | # C原型:int MV_CC_FeatureLoad(void* handle, char* pFileName) 258 | return MvCamCtrldll.MV_CC_FeatureLoad(self.handle, pFileName.encode('ascii')) 259 | 260 | # fileaccess read 261 | def MV_CC_FileAccessRead(self, stFileAccess): 262 | MvCamCtrldll.MV_CC_FileAccessRead.argtype = (c_void_p, c_void_p) 263 | MvCamCtrldll.MV_CC_FileAccessRead.restype = c_uint 264 | # C原型:int MV_CC_FileAccessRead(void* handle, MV_CC_FILE_ACCESS * pstFileAccess) 265 | return MvCamCtrldll.MV_CC_FileAccessRead(self.handle, byref(stFileAccess)) 266 | 267 | # fileaccess write 268 | def MV_CC_FileAccessWrite(self, stFileAccess): 269 | MvCamCtrldll.MV_CC_FileAccessWrite.argtype = (c_void_p, c_void_p) 270 | MvCamCtrldll.MV_CC_FileAccessWrite.restype = c_uint 271 | # C原型:int MV_CC_FileAccessWrite(void* handle, MV_CC_FILE_ACCESS * pstFileAccess) 272 | return MvCamCtrldll.MV_CC_FileAccessWrite(self.handle, byref(stFileAccess)) 273 | 274 | # 获取文件存取进度 275 | def MV_CC_GetFileAccessProgress(self, stFileAccessProgress): 276 | MvCamCtrldll.MV_CC_GetFileAccessProgress.argtype = (c_void_p, c_void_p) 277 | MvCamCtrldll.MV_CC_GetFileAccessProgress.restype = c_uint 278 | # C原型:int MV_CC_GetFileAccessProgress(void* handle, MV_CC_FILE_ACCESS_PROGRESS * pstFileAccessProgress) 279 | return MvCamCtrldll.MV_CC_GetFileAccessProgress(self.handle, byref(stFileAccessProgress)) 280 | 281 | # 获取网络最佳包大小 282 | def MV_CC_GetOptimalPacketSize(self): 283 | MvCamCtrldll.MV_CC_GetOptimalPacketSize.argtype = (c_void_p) 284 | MvCamCtrldll.MV_CC_GetOptimalPacketSize.restype = c_uint 285 | # C原型:int __stdcall MV_CC_GetOptimalPacketSize(void* handle); 286 | return MvCamCtrldll.MV_CC_GetOptimalPacketSize(self.handle) 287 | 288 | 289 | -------------------------------------------------------------------------------- /MvImport/MvCameraControl_header.py: -------------------------------------------------------------------------------- 1 | # generated by 'xml2py' 2 | # flags '-c -d -v C:\test_h\MvCameraControl.xml -o MvCameraControl_header.py' 3 | from ctypes import * 4 | 5 | STRING = c_char_p 6 | 7 | 8 | PixelType_Gvsp_BayerBG12 = 17825811 9 | MV_TRIGGER_SOURCE_LINE1 = 1 10 | PixelType_Gvsp_Mono8_Signed = 17301506 11 | MV_BALANCEWHITE_AUTO_ONCE = 2 12 | PixelType_Gvsp_BayerGB8 = 17301514 13 | MV_BALANCEWHITE_AUTO_OFF = 0 14 | MV_Image_Jpeg = 2 15 | PixelType_Gvsp_Mono12 = 17825797 16 | MV_GAMMA_SELECTOR_SRGB = 2 17 | PixelType_Gvsp_Coord3D_ABC32f_Planar = 39846081 18 | PixelType_Gvsp_Coord3D_AC32f = 36176066 19 | MV_EXPOSURE_AUTO_MODE_ONCE = 1 20 | MV_GAMMA_SELECTOR_USER = 1 21 | AM_WO = 2 22 | PixelType_Gvsp_BayerBG10 = 17825807 23 | PixelType_Gvsp_RGB10_Planar = 36700194 24 | PixelType_Gvsp_BayerGB12 = 17825810 25 | MV_BALANCEWHITE_AUTO_CONTINUOUS = 1 26 | PixelType_Gvsp_BayerRG8 = 17301513 27 | PixelType_Gvsp_COORD3D_DEPTH_PLUS_MASK = -2112094207 28 | PixelType_Gvsp_RGB12_Planar = 36700195 29 | PixelType_Gvsp_Mono10 = 17825795 30 | PixelType_Gvsp_Undefined = -1 31 | PixelType_Gvsp_BayerRG10_Packed = 17563687 32 | PixelType_Gvsp_BayerGR16 = 17825838 33 | PixelType_Gvsp_BayerBG12_Packed = 17563693 34 | PixelType_Gvsp_BayerGB16 = 17825840 35 | MV_TRIGGER_MODE_OFF = 0 36 | PixelType_Gvsp_BayerRG16 = 17825839 37 | PixelType_Gvsp_YCBCR709_411_8_CBYYCRYY = 34340930 38 | PixelType_Gvsp_BayerBG16 = 17825841 39 | PixelType_Gvsp_RGB8_Planar = 35127329 40 | PixelType_Gvsp_RGB8_Packed = 35127316 41 | PixelType_Gvsp_BGR8_Packed = 35127317 42 | PixelType_Gvsp_RGBA8_Packed = 35651606 43 | PixelType_Gvsp_YCBCR422_8_CBYCRY = 34603075 44 | PixelType_Gvsp_RGB565_Packed = 34603061 45 | PixelType_Gvsp_YCBCR422_8 = 34603067 46 | PixelType_Gvsp_YUV444_Packed = 35127328 47 | PixelType_Gvsp_YCBCR709_422_8_CBYCRY = 34603077 48 | PixelType_Gvsp_YCBCR709_422_8 = 34603073 49 | PixelType_Gvsp_RGB10_Packed = 36700184 50 | PixelType_Gvsp_YCBCR8_CBYCR = 35127354 51 | PixelType_Gvsp_YCBCR709_8_CBYCR = 35127360 52 | PixelType_Gvsp_YCBCR601_411_8_CBYYCRYY = 34340927 53 | IFT_IBoolean = 3 54 | PixelType_Gvsp_RGB12_Packed = 36700186 55 | PixelType_Gvsp_YUV422_YUYV_Packed = 34603058 56 | PixelType_Gvsp_YCBCR601_422_8 = 34603070 57 | PixelType_Gvsp_RGB16_Packed = 36700211 58 | PixelType_Gvsp_BGR12_Packed = 36700187 59 | PixelType_Gvsp_BayerGB12_Packed = 17563692 60 | PixelType_Gvsp_BGR565_Packed = 34603062 61 | PixelType_Gvsp_YCBCR601_422_8_CBYCRY = 34603076 62 | PixelType_Gvsp_YUV411_Packed = 34340894 63 | PixelType_Gvsp_BayerRG12_Packed = 17563691 64 | PixelType_Gvsp_RGB10V1_Packed = 35651612 65 | PixelType_Gvsp_YUV422_Packed = 34603039 66 | MV_GAIN_MODE_ONCE = 1 67 | MV_GAIN_MODE_CONTINUOUS = 2 68 | MV_GAIN_MODE_OFF = 0 69 | MV_GIGE_TRANSTYPE_MULTICAST = 1 70 | MV_GIGE_TRANSTYPE_UNICAST = 0 71 | AM_NI = 0 72 | IFT_IValue = 0 73 | PixelType_Gvsp_BGRA8_Packed = 35651607 74 | MV_GIGE_TRANSTYPE_LIMITEDBROADCAST = 2 75 | MV_GIGE_TRANSTYPE_CAMERADEFINED = 4 76 | MV_GIGE_TRANSTYPE_SUBNETBROADCAST = 3 77 | PixelType_Gvsp_BGR10_Packed = 36700185 78 | MV_GIGE_TRANSTYPE_UNICAST_WITHOUT_RECV = 65536 79 | V_Guru = 2 80 | MV_GIGE_TRANSTYPE_UNICAST_DEFINED_PORT = 5 81 | MV_GIGE_TRANSTYPE_MULTICAST_WITHOUT_RECV = 65537 82 | PixelType_Gvsp_BayerGB10 = 17825806 83 | IFT_ICategory = 8 84 | PixelType_Gvsp_Coord3D_ABC32f = 39846080 85 | MV_EXPOSURE_MODE_TRIGGER_WIDTH = 1 86 | PixelType_Gvsp_BayerRG10 = 17825805 87 | IFT_IEnumeration = 9 88 | IFT_IFloat = 5 89 | PixelType_Gvsp_RGB16_Planar = 36700196 90 | PixelType_Gvsp_Mono14 = 17825829 91 | IFT_IString = 6 92 | PixelType_Gvsp_YCBCR411_8_CBYYCRYY = 34340924 93 | PixelType_Gvsp_Mono12_Packed = 17563654 94 | PixelType_Gvsp_Mono8 = 17301505 95 | AM_CycleDetect = 6 96 | PixelType_Gvsp_Mono4p = 17039417 97 | PixelType_Gvsp_Mono10_Packed = 17563652 98 | AM_Undefined = 5 99 | MV_EXPOSURE_MODE_TIMED = 0 100 | PixelType_Gvsp_BayerRG12 = 17825809 101 | PixelType_Gvsp_BayerGR12 = 17825808 102 | IFT_IEnumEntry = 10 103 | AM_RW = 4 104 | PixelType_Gvsp_Mono16 = 17825799 105 | PixelType_Gvsp_BayerGR8 = 17301512 106 | IFT_IInteger = 2 107 | AM_RO = 3 108 | MV_EXPOSURE_AUTO_MODE_OFF = 0 109 | PixelType_Gvsp_Mono2p = 16908344 110 | PixelType_Gvsp_BayerGR12_Packed = 17563690 111 | PixelType_Gvsp_BayerGB10_Packed = 17563688 112 | PixelType_Gvsp_BayerGR10_Packed = 17563686 113 | PixelType_Gvsp_BayerBG10_Packed = 17563689 114 | PixelType_Gvsp_YCBCR601_8_CBYCR = 35127357 115 | IFT_IPort = 11 116 | IFT_IBase = 1 117 | V_Invisible = 3 118 | V_Beginner = 0 119 | PixelType_Gvsp_Jpeg = -2145910783 120 | MV_Image_Undefined = 0 121 | MV_EXPOSURE_AUTO_MODE_CONTINUOUS = 2 122 | MV_Image_Bmp = 1 123 | MV_TRIGGER_SOURCE_SOFTWARE = 7 124 | IFT_IRegister = 7 125 | MV_Image_Png = 3 126 | MV_ACQ_MODE_SINGLE = 0 127 | MV_Image_Tif = 4 128 | V_Expert = 1 129 | MV_ACQ_MODE_CONTINUOUS = 2 130 | MV_ACQ_MODE_MUTLI = 1 131 | PixelType_Gvsp_BayerGR10 = 17825804 132 | AM_NA = 1 133 | V_Undefined = 99 134 | MV_TRIGGER_SOURCE_FrequencyConverter = 8 135 | IFT_ICommand = 4 136 | MV_TRIGGER_MODE_ON = 1 137 | PixelType_Gvsp_RGB10V2_Packed = 35651613 138 | PixelType_Gvsp_BayerBG8 = 17301515 139 | MV_TRIGGER_SOURCE_LINE2 = 2 140 | PixelType_Gvsp_RGB12V1_Packed = 35913780 141 | MV_TRIGGER_SOURCE_LINE3 = 3 142 | MV_TRIGGER_SOURCE_COUNTER0 = 4 143 | MV_TRIGGER_SOURCE_LINE0 = 0 144 | PixelType_Gvsp_Mono1p = 16842807 145 | int8_t = c_int8 146 | int16_t = c_int16 147 | int32_t = c_int32 148 | int64_t = c_int64 149 | uint8_t = c_uint8 150 | uint16_t = c_uint16 151 | uint32_t = c_uint32 152 | uint64_t = c_uint64 153 | int_least8_t = c_byte 154 | int_least16_t = c_short 155 | int_least32_t = c_int 156 | int_least64_t = c_long 157 | uint_least8_t = c_ubyte 158 | uint_least16_t = c_ushort 159 | uint_least32_t = c_uint 160 | uint_least64_t = c_ulong 161 | int_fast8_t = c_byte 162 | int_fast16_t = c_long 163 | int_fast32_t = c_long 164 | int_fast64_t = c_long 165 | uint_fast8_t = c_ubyte 166 | uint_fast16_t = c_ulong 167 | uint_fast32_t = c_ulong 168 | uint_fast64_t = c_ulong 169 | intptr_t = c_long 170 | uintptr_t = c_ulong 171 | intmax_t = c_long 172 | uintmax_t = c_ulong 173 | # CameraParams.h 21 174 | class _MV_GIGE_DEVICE_INFO_(Structure): 175 | pass 176 | _MV_GIGE_DEVICE_INFO_._fields_ = [ 177 | # CameraParams.h 21 178 | ('nIpCfgOption', c_uint), 179 | ('nIpCfgCurrent', c_uint), 180 | ('nCurrentIp', c_uint), 181 | ('nCurrentSubNetMask', c_uint), 182 | ('nDefultGateWay', c_uint), 183 | ('chManufacturerName', c_ubyte * 32), 184 | ('chModelName', c_ubyte * 32), 185 | ('chDeviceVersion', c_ubyte * 32), 186 | ('chManufacturerSpecificInfo', c_ubyte * 48), 187 | ('chSerialNumber', c_ubyte * 16), 188 | ('chUserDefinedName', c_ubyte * 16), 189 | ('nNetExport', c_uint), 190 | ('nReserved', c_uint * 4), 191 | ] 192 | MV_GIGE_DEVICE_INFO = _MV_GIGE_DEVICE_INFO_ 193 | # CameraParams.h 42 194 | class _MV_USB3_DEVICE_INFO_(Structure): 195 | pass 196 | _MV_USB3_DEVICE_INFO_._fields_ = [ 197 | # CameraParams.h 42 198 | ('CrtlInEndPoint', c_ubyte), 199 | ('CrtlOutEndPoint', c_ubyte), 200 | ('StreamEndPoint', c_ubyte), 201 | ('EventEndPoint', c_ubyte), 202 | ('idVendor', c_ushort), 203 | ('idProduct', c_ushort), 204 | ('nDeviceNumber', c_uint), 205 | ('chDeviceGUID', c_ubyte * 64), 206 | ('chVendorName', c_ubyte * 64), 207 | ('chModelName', c_ubyte * 64), 208 | ('chFamilyName', c_ubyte * 64), 209 | ('chDeviceVersion', c_ubyte * 64), 210 | ('chManufacturerName', c_ubyte * 64), 211 | ('chSerialNumber', c_ubyte * 64), 212 | ('chUserDefinedName', c_ubyte * 64), 213 | ('nbcdUSB', c_uint), 214 | ('nReserved', c_uint * 3), 215 | ] 216 | MV_USB3_DEVICE_INFO = _MV_USB3_DEVICE_INFO_ 217 | # CameraParams.h 64 218 | class _MV_CC_DEVICE_INFO_(Structure): 219 | pass 220 | # CameraParams.h 76 221 | class N19_MV_CC_DEVICE_INFO_3DOT_0E(Union): 222 | pass 223 | N19_MV_CC_DEVICE_INFO_3DOT_0E._fields_ = [ 224 | # CameraParams.h 76 225 | ('stGigEInfo', MV_GIGE_DEVICE_INFO), 226 | ('stUsb3VInfo', MV_USB3_DEVICE_INFO), 227 | ] 228 | _MV_CC_DEVICE_INFO_._fields_ = [ 229 | # CameraParams.h 64 230 | ('nMajorVer', c_ushort), 231 | ('nMinorVer', c_ushort), 232 | ('nMacAddrHigh', c_uint), 233 | ('nMacAddrLow', c_uint), 234 | ('nTLayerType', c_uint), 235 | ('nReserved', c_uint * 4), 236 | ('SpecialInfo', N19_MV_CC_DEVICE_INFO_3DOT_0E), 237 | ] 238 | MV_CC_DEVICE_INFO = _MV_CC_DEVICE_INFO_ 239 | # CameraParams.h 86 240 | class _MV_NETTRANS_INFO_(Structure): 241 | pass 242 | _MV_NETTRANS_INFO_._fields_ = [ 243 | # CameraParams.h 86 244 | ('nReviceDataSize', int64_t), 245 | ('nThrowFrameCount', c_int), 246 | ('nReserved', c_uint * 5), 247 | ] 248 | MV_NETTRANS_INFO = _MV_NETTRANS_INFO_ 249 | # CameraParams.h 101 250 | class _MV_CC_DEVICE_INFO_LIST_(Structure): 251 | pass 252 | _MV_CC_DEVICE_INFO_LIST_._fields_ = [ 253 | # CameraParams.h 101 254 | ('nDeviceNum', c_uint), 255 | ('pDeviceInfo', POINTER(MV_CC_DEVICE_INFO) * 256), 256 | ] 257 | MV_CC_DEVICE_INFO_LIST = _MV_CC_DEVICE_INFO_LIST_ 258 | # CameraParams.h 110 259 | class _MV_FRAME_OUT_INFO_(Structure): 260 | pass 261 | 262 | # values for enumeration 'MvGvspPixelType' 263 | MvGvspPixelType = c_int # enum 264 | _MV_FRAME_OUT_INFO_._fields_ = [ 265 | # CameraParams.h 110 266 | ('nWidth', c_ushort), 267 | ('nHeight', c_ushort), 268 | ('enPixelType', MvGvspPixelType), 269 | ('nFrameNum', c_uint), 270 | ('nDevTimeStampHigh', c_uint), 271 | ('nDevTimeStampLow', c_uint), 272 | ('nReserved0', c_uint), 273 | ('nHostTimeStamp', int64_t), 274 | ('nFrameLen', c_uint), 275 | ('nLostPacket', c_uint), 276 | ('nReserved', c_uint * 2), 277 | ] 278 | MV_FRAME_OUT_INFO = _MV_FRAME_OUT_INFO_ 279 | # CameraParams.h 129 280 | class _MV_FRAME_OUT_INFO_EX_(Structure): 281 | pass 282 | _MV_FRAME_OUT_INFO_EX_._fields_ = [ 283 | # CameraParams.h 129 284 | ('nWidth', c_ushort), 285 | ('nHeight', c_ushort), 286 | ('enPixelType', MvGvspPixelType), 287 | ('nFrameNum', c_uint), 288 | ('nDevTimeStampHigh', c_uint), 289 | ('nDevTimeStampLow', c_uint), 290 | ('nReserved0', c_uint), 291 | ('nHostTimeStamp', int64_t), 292 | ('nFrameLen', c_uint), 293 | ('nSecondCount', c_uint), 294 | ('nCycleCount', c_uint), 295 | ('nCycleOffset', c_uint), 296 | ('fGain', c_float), 297 | ('fExposureTime', c_float), 298 | ('nAverageBrightness', c_uint), 299 | ('nRed', c_uint), 300 | ('nGreen', c_uint), 301 | ('nBlue', c_uint), 302 | ('nFrameCounter', c_uint), 303 | ('nTriggerIndex', c_uint), 304 | ('nInput', c_uint), 305 | ('nOutput', c_uint), 306 | ('nOffsetX', c_ushort), 307 | ('nOffsetY', c_ushort), 308 | ('nChunkWidth', c_ushort), 309 | ('nChunkHeight', c_ushort), 310 | ('nLostPacket', c_uint), 311 | ('nReserved', c_uint * 39), 312 | ] 313 | MV_FRAME_OUT_INFO_EX = _MV_FRAME_OUT_INFO_EX_ 314 | # CameraParams.h 176 315 | class _MV_DISPLAY_FRAME_INFO_(Structure): 316 | pass 317 | _MV_DISPLAY_FRAME_INFO_._fields_ = [ 318 | # CameraParams.h 176 319 | ('hWnd', c_void_p), 320 | ('pData', POINTER(c_ubyte)), 321 | ('nDataLen', c_uint), 322 | ('nWidth', c_ushort), 323 | ('nHeight', c_ushort), 324 | ('enPixelType', MvGvspPixelType), 325 | ('nRes', c_uint * 4), 326 | ] 327 | MV_DISPLAY_FRAME_INFO = _MV_DISPLAY_FRAME_INFO_ 328 | 329 | # values for enumeration 'MV_SAVE_IAMGE_TYPE' 330 | MV_SAVE_IAMGE_TYPE = c_int # enum 331 | # CameraParams.h 198 332 | class _MV_SAVE_IMAGE_PARAM_T_(Structure): 333 | pass 334 | _MV_SAVE_IMAGE_PARAM_T_._fields_ = [ 335 | # CameraParams.h 198 336 | ('pData', POINTER(c_ubyte)), 337 | ('nDataLen', c_uint), 338 | ('enPixelType', MvGvspPixelType), 339 | ('nWidth', c_ushort), 340 | ('nHeight', c_ushort), 341 | ('pImageBuffer', POINTER(c_ubyte)), 342 | ('nImageLen', c_uint), 343 | ('nBufferSize', c_uint), 344 | ('enImageType', MV_SAVE_IAMGE_TYPE), 345 | ] 346 | MV_SAVE_IMAGE_PARAM = _MV_SAVE_IMAGE_PARAM_T_ 347 | # CameraParams.h 214 348 | class _MV_SAVE_IMAGE_PARAM_T_EX_(Structure): 349 | pass 350 | _MV_SAVE_IMAGE_PARAM_T_EX_._fields_ = [ 351 | # CameraParams.h 214 352 | ('pData', POINTER(c_ubyte)), 353 | ('nDataLen', c_uint), 354 | ('enPixelType', MvGvspPixelType), 355 | ('nWidth', c_ushort), 356 | ('nHeight', c_ushort), 357 | ('pImageBuffer', POINTER(c_ubyte)), 358 | ('nImageLen', c_uint), 359 | ('nBufferSize', c_uint), 360 | ('enImageType', MV_SAVE_IAMGE_TYPE), 361 | ('nJpgQuality', c_uint), 362 | ('iMethodValue', c_uint), 363 | ('nReserved', c_uint * 3), 364 | ] 365 | MV_SAVE_IMAGE_PARAM_EX = _MV_SAVE_IMAGE_PARAM_T_EX_ 366 | # CameraParams.h 236 367 | class _MV_PIXEL_CONVERT_PARAM_T_(Structure): 368 | pass 369 | _MV_PIXEL_CONVERT_PARAM_T_._fields_ = [ 370 | # CameraParams.h 236 371 | ('nWidth', c_ushort), 372 | ('nHeight', c_ushort), 373 | ('enSrcPixelType', MvGvspPixelType), 374 | ('pSrcData', POINTER(c_ubyte)), 375 | ('nSrcDataLen', c_uint), 376 | ('enDstPixelType', MvGvspPixelType), 377 | ('pDstBuffer', POINTER(c_ubyte)), 378 | ('nDstLen', c_uint), 379 | ('nDstBufferSize', c_uint), 380 | ('nRes', c_uint * 4), 381 | ] 382 | MV_CC_PIXEL_CONVERT_PARAM = _MV_PIXEL_CONVERT_PARAM_T_ 383 | 384 | # values for enumeration '_MV_CAM_ACQUISITION_MODE_' 385 | _MV_CAM_ACQUISITION_MODE_ = c_int # enum 386 | MV_CAM_ACQUISITION_MODE = _MV_CAM_ACQUISITION_MODE_ 387 | 388 | # values for enumeration '_MV_CAM_GAIN_MODE_' 389 | _MV_CAM_GAIN_MODE_ = c_int # enum 390 | MV_CAM_GAIN_MODE = _MV_CAM_GAIN_MODE_ 391 | 392 | # values for enumeration '_MV_CAM_EXPOSURE_MODE_' 393 | _MV_CAM_EXPOSURE_MODE_ = c_int # enum 394 | MV_CAM_EXPOSURE_MODE = _MV_CAM_EXPOSURE_MODE_ 395 | 396 | # values for enumeration '_MV_CAM_EXPOSURE_AUTO_MODE_' 397 | _MV_CAM_EXPOSURE_AUTO_MODE_ = c_int # enum 398 | MV_CAM_EXPOSURE_AUTO_MODE = _MV_CAM_EXPOSURE_AUTO_MODE_ 399 | 400 | # values for enumeration '_MV_CAM_TRIGGER_MODE_' 401 | _MV_CAM_TRIGGER_MODE_ = c_int # enum 402 | MV_CAM_TRIGGER_MODE = _MV_CAM_TRIGGER_MODE_ 403 | 404 | # values for enumeration '_MV_CAM_GAMMA_SELECTOR_' 405 | _MV_CAM_GAMMA_SELECTOR_ = c_int # enum 406 | MV_CAM_GAMMA_SELECTOR = _MV_CAM_GAMMA_SELECTOR_ 407 | 408 | # values for enumeration '_MV_CAM_BALANCEWHITE_AUTO_' 409 | _MV_CAM_BALANCEWHITE_AUTO_ = c_int # enum 410 | MV_CAM_BALANCEWHITE_AUTO = _MV_CAM_BALANCEWHITE_AUTO_ 411 | 412 | # values for enumeration '_MV_CAM_TRIGGER_SOURCE_' 413 | _MV_CAM_TRIGGER_SOURCE_ = c_int # enum 414 | MV_CAM_TRIGGER_SOURCE = _MV_CAM_TRIGGER_SOURCE_ 415 | 416 | # values for enumeration '_MV_GIGE_TRANSMISSION_TYPE_' 417 | _MV_GIGE_TRANSMISSION_TYPE_ = c_int # enum 418 | MV_GIGE_TRANSMISSION_TYPE = _MV_GIGE_TRANSMISSION_TYPE_ 419 | # CameraParams.h 377 420 | class _MV_ALL_MATCH_INFO_(Structure): 421 | pass 422 | _MV_ALL_MATCH_INFO_._fields_ = [ 423 | # CameraParams.h 377 424 | ('nType', c_uint), 425 | ('pInfo', c_void_p), 426 | ('nInfoSize', c_uint), 427 | ] 428 | MV_ALL_MATCH_INFO = _MV_ALL_MATCH_INFO_ 429 | # CameraParams.h 387 430 | class _MV_MATCH_INFO_NET_DETECT_(Structure): 431 | pass 432 | _MV_MATCH_INFO_NET_DETECT_._fields_ = [ 433 | # CameraParams.h 387 434 | ('nReviceDataSize', int64_t), 435 | ('nLostPacketCount', int64_t), 436 | ('nLostFrameCount', c_uint), 437 | ('nReserved', c_uint * 5), 438 | ] 439 | MV_MATCH_INFO_NET_DETECT = _MV_MATCH_INFO_NET_DETECT_ 440 | # CameraParams.h 396 441 | class _MV_MATCH_INFO_USB_DETECT_(Structure): 442 | pass 443 | _MV_MATCH_INFO_USB_DETECT_._fields_ = [ 444 | # CameraParams.h 396 445 | ('nReviceDataSize', int64_t), 446 | ('nRevicedFrameCount', c_uint), 447 | ('nErrorFrameCount', c_uint), 448 | ('nReserved', c_uint * 2), 449 | ] 450 | MV_MATCH_INFO_USB_DETECT = _MV_MATCH_INFO_USB_DETECT_ 451 | # CameraParams.h 404 452 | class _MV_IMAGE_BASIC_INFO_(Structure): 453 | pass 454 | _MV_IMAGE_BASIC_INFO_._fields_ = [ 455 | # CameraParams.h 404 456 | ('nWidthValue', c_ushort), 457 | ('nWidthMin', c_ushort), 458 | ('nWidthMax', c_uint), 459 | ('nWidthInc', c_uint), 460 | ('nHeightValue', c_uint), 461 | ('nHeightMin', c_uint), 462 | ('nHeightMax', c_uint), 463 | ('nHeightInc', c_uint), 464 | ('fFrameRateValue', c_float), 465 | ('fFrameRateMin', c_float), 466 | ('fFrameRateMax', c_float), 467 | ('enPixelType', c_uint), 468 | ('nSupportedPixelFmtNum', c_uint), 469 | ('enPixelList', c_uint * 64), 470 | ('nReserved', c_uint * 8), 471 | ] 472 | MV_IMAGE_BASIC_INFO = _MV_IMAGE_BASIC_INFO_ 473 | 474 | # values for enumeration 'MV_XML_InterfaceType' 475 | MV_XML_InterfaceType = c_int # enum 476 | 477 | # values for enumeration 'MV_XML_AccessMode' 478 | MV_XML_AccessMode = c_int # enum 479 | 480 | # values for enumeration 'MV_XML_Visibility' 481 | MV_XML_Visibility = c_int # enum 482 | # CameraParams.h 500 483 | class _MV_EVENT_OUT_INFO_(Structure): 484 | pass 485 | _MV_EVENT_OUT_INFO_._fields_ = [ 486 | # CameraParams.h 500 487 | ('EventName', c_char * 128), 488 | ('nEventID', c_ushort), 489 | ('nStreamChannel', c_ushort), 490 | ('nBlockIdHigh', c_uint), 491 | ('nBlockIdLow', c_uint), 492 | ('nTimestampHigh', c_uint), 493 | ('nTimestampLow', c_uint), 494 | ('pEventData', c_void_p), 495 | ('nEventDataSize', c_uint), 496 | ('nReserved', c_uint * 16), 497 | ] 498 | MV_EVENT_OUT_INFO = _MV_EVENT_OUT_INFO_ 499 | # CameraParams.h 520 500 | class _MV_CC_FILE_ACCESS_T(Structure): 501 | pass 502 | _MV_CC_FILE_ACCESS_T._fields_ = [ 503 | # CameraParams.h 520 504 | ('pUserFileName', STRING), 505 | ('pDevFileName', STRING), 506 | ('nReserved', c_uint * 32), 507 | ] 508 | MV_CC_FILE_ACCESS = _MV_CC_FILE_ACCESS_T 509 | # CameraParams.h 529 510 | class _MV_CC_FILE_ACCESS_PROGRESS_T(Structure): 511 | pass 512 | _MV_CC_FILE_ACCESS_PROGRESS_T._fields_ = [ 513 | # CameraParams.h 529 514 | ('nCompleted', int64_t), 515 | ('nTotal', int64_t), 516 | ('nReserved', c_uint * 8), 517 | ] 518 | MV_CC_FILE_ACCESS_PROGRESS = _MV_CC_FILE_ACCESS_PROGRESS_T 519 | # CameraParams.h 538 520 | class _MV_TRANSMISSION_TYPE_T(Structure): 521 | pass 522 | _MV_TRANSMISSION_TYPE_T._fields_ = [ 523 | # CameraParams.h 538 524 | ('enTransmissionType', MV_GIGE_TRANSMISSION_TYPE), 525 | ('nDestIp', c_uint), 526 | ('nDestPort', c_ushort), 527 | ('nReserved', c_uint * 32), 528 | ] 529 | MV_TRANSMISSION_TYPE = _MV_TRANSMISSION_TYPE_T 530 | # CameraParams.h 548 531 | class _MV_XML_NODE_FEATURE_(Structure): 532 | pass 533 | _MV_XML_NODE_FEATURE_._fields_ = [ 534 | # CameraParams.h 548 535 | ('enType', MV_XML_InterfaceType), 536 | ('enVisivility', MV_XML_Visibility), 537 | ('strDescription', c_char * 512), 538 | ('strDisplayName', c_char * 64), 539 | ('strName', c_char * 64), 540 | ('strToolTip', c_char * 512), 541 | ('nReserved', c_uint * 4), 542 | ] 543 | MV_XML_NODE_FEATURE = _MV_XML_NODE_FEATURE_ 544 | # CameraParams.h 561 545 | class _MV_XML_NODES_LIST_(Structure): 546 | pass 547 | _MV_XML_NODES_LIST_._fields_ = [ 548 | # CameraParams.h 561 549 | ('nNodeNum', c_uint), 550 | ('stNodes', MV_XML_NODE_FEATURE * 128), 551 | ] 552 | MV_XML_NODES_LIST = _MV_XML_NODES_LIST_ 553 | # CameraParams.h 569 554 | class _MV_XML_FEATURE_Value_(Structure): 555 | pass 556 | _MV_XML_FEATURE_Value_._fields_ = [ 557 | # CameraParams.h 569 558 | ('enType', MV_XML_InterfaceType), 559 | ('strDescription', c_char * 512), 560 | ('strDisplayName', c_char * 64), 561 | ('strName', c_char * 64), 562 | ('strToolTip', c_char * 512), 563 | ('nReserved', c_uint * 4), 564 | ] 565 | MV_XML_FEATURE_Value = _MV_XML_FEATURE_Value_ 566 | # CameraParams.h 579 567 | class _MV_XML_FEATURE_Base_(Structure): 568 | pass 569 | _MV_XML_FEATURE_Base_._fields_ = [ 570 | # CameraParams.h 579 571 | ('enAccessMode', MV_XML_AccessMode), 572 | ] 573 | MV_XML_FEATURE_Base = _MV_XML_FEATURE_Base_ 574 | # CameraParams.h 584 575 | class _MV_XML_FEATURE_Integer_(Structure): 576 | pass 577 | _MV_XML_FEATURE_Integer_._fields_ = [ 578 | # CameraParams.h 584 579 | ('strName', c_char * 64), 580 | ('strDisplayName', c_char * 64), 581 | ('strDescription', c_char * 512), 582 | ('strToolTip', c_char * 512), 583 | ('enVisivility', MV_XML_Visibility), 584 | ('enAccessMode', MV_XML_AccessMode), 585 | ('bIsLocked', c_int), 586 | ('nValue', int64_t), 587 | ('nMinValue', int64_t), 588 | ('nMaxValue', int64_t), 589 | ('nIncrement', int64_t), 590 | ('nReserved', c_uint * 4), 591 | ] 592 | MV_XML_FEATURE_Integer = _MV_XML_FEATURE_Integer_ 593 | # CameraParams.h 603 594 | class _MV_XML_FEATURE_Boolean_(Structure): 595 | pass 596 | _MV_XML_FEATURE_Boolean_._fields_ = [ 597 | # CameraParams.h 603 598 | ('strName', c_char * 64), 599 | ('strDisplayName', c_char * 64), 600 | ('strDescription', c_char * 512), 601 | ('strToolTip', c_char * 512), 602 | ('enVisivility', MV_XML_Visibility), 603 | ('enAccessMode', MV_XML_AccessMode), 604 | ('bIsLocked', c_int), 605 | ('bValue', c_bool), 606 | ('nReserved', c_uint * 4), 607 | ] 608 | MV_XML_FEATURE_Boolean = _MV_XML_FEATURE_Boolean_ 609 | # CameraParams.h 618 610 | class _MV_XML_FEATURE_Command_(Structure): 611 | pass 612 | _MV_XML_FEATURE_Command_._fields_ = [ 613 | # CameraParams.h 618 614 | ('strName', c_char * 64), 615 | ('strDisplayName', c_char * 64), 616 | ('strDescription', c_char * 512), 617 | ('strToolTip', c_char * 512), 618 | ('enVisivility', MV_XML_Visibility), 619 | ('enAccessMode', MV_XML_AccessMode), 620 | ('bIsLocked', c_int), 621 | ('nReserved', c_uint * 4), 622 | ] 623 | MV_XML_FEATURE_Command = _MV_XML_FEATURE_Command_ 624 | # CameraParams.h 632 625 | class _MV_XML_FEATURE_Float_(Structure): 626 | pass 627 | _MV_XML_FEATURE_Float_._fields_ = [ 628 | # CameraParams.h 632 629 | ('strName', c_char * 64), 630 | ('strDisplayName', c_char * 64), 631 | ('strDescription', c_char * 512), 632 | ('strToolTip', c_char * 512), 633 | ('enVisivility', MV_XML_Visibility), 634 | ('enAccessMode', MV_XML_AccessMode), 635 | ('bIsLocked', c_int), 636 | ('dfValue', c_double), 637 | ('dfMinValue', c_double), 638 | ('dfMaxValue', c_double), 639 | ('dfIncrement', c_double), 640 | ('nReserved', c_uint * 4), 641 | ] 642 | MV_XML_FEATURE_Float = _MV_XML_FEATURE_Float_ 643 | # CameraParams.h 650 644 | class _MV_XML_FEATURE_String_(Structure): 645 | pass 646 | _MV_XML_FEATURE_String_._fields_ = [ 647 | # CameraParams.h 650 648 | ('strName', c_char * 64), 649 | ('strDisplayName', c_char * 64), 650 | ('strDescription', c_char * 512), 651 | ('strToolTip', c_char * 512), 652 | ('enVisivility', MV_XML_Visibility), 653 | ('enAccessMode', MV_XML_AccessMode), 654 | ('bIsLocked', c_int), 655 | ('strValue', c_char * 64), 656 | ('nReserved', c_uint * 4), 657 | ] 658 | MV_XML_FEATURE_String = _MV_XML_FEATURE_String_ 659 | # CameraParams.h 665 660 | class _MV_XML_FEATURE_Register_(Structure): 661 | pass 662 | _MV_XML_FEATURE_Register_._fields_ = [ 663 | # CameraParams.h 665 664 | ('strName', c_char * 64), 665 | ('strDisplayName', c_char * 64), 666 | ('strDescription', c_char * 512), 667 | ('strToolTip', c_char * 512), 668 | ('enVisivility', MV_XML_Visibility), 669 | ('enAccessMode', MV_XML_AccessMode), 670 | ('bIsLocked', c_int), 671 | ('nAddrValue', int64_t), 672 | ('nReserved', c_uint * 4), 673 | ] 674 | MV_XML_FEATURE_Register = _MV_XML_FEATURE_Register_ 675 | # CameraParams.h 680 676 | class _MV_XML_FEATURE_Category_(Structure): 677 | pass 678 | _MV_XML_FEATURE_Category_._fields_ = [ 679 | # CameraParams.h 680 680 | ('strDescription', c_char * 512), 681 | ('strDisplayName', c_char * 64), 682 | ('strName', c_char * 64), 683 | ('strToolTip', c_char * 512), 684 | ('enVisivility', MV_XML_Visibility), 685 | ('nReserved', c_uint * 4), 686 | ] 687 | MV_XML_FEATURE_Category = _MV_XML_FEATURE_Category_ 688 | # CameraParams.h 692 689 | class _MV_XML_FEATURE_EnumEntry_(Structure): 690 | pass 691 | _MV_XML_FEATURE_EnumEntry_._fields_ = [ 692 | # CameraParams.h 692 693 | ('strName', c_char * 64), 694 | ('strDisplayName', c_char * 64), 695 | ('strDescription', c_char * 512), 696 | ('strToolTip', c_char * 512), 697 | ('bIsImplemented', c_int), 698 | ('nParentsNum', c_int), 699 | ('stParentsList', MV_XML_NODE_FEATURE * 8), 700 | ('enVisivility', MV_XML_Visibility), 701 | ('nValue', int64_t), 702 | ('enAccessMode', MV_XML_AccessMode), 703 | ('bIsLocked', c_int), 704 | ('nReserved', c_int * 8), 705 | ] 706 | MV_XML_FEATURE_EnumEntry = _MV_XML_FEATURE_EnumEntry_ 707 | # CameraParams.h 711 708 | class _MV_XML_FEATURE_Enumeration_(Structure): 709 | pass 710 | _MV_XML_FEATURE_Enumeration_._fields_ = [ 711 | # CameraParams.h 711 712 | ('enVisivility', MV_XML_Visibility), 713 | ('strDescription', c_char * 512), 714 | ('strDisplayName', c_char * 64), 715 | ('strName', c_char * 64), 716 | ('strToolTip', c_char * 512), 717 | ('nSymbolicNum', c_int), 718 | ('strCurrentSymbolic', c_char * 64), 719 | ('strSymbolic', c_char * 64 * 64), 720 | ('enAccessMode', MV_XML_AccessMode), 721 | ('bIsLocked', c_int), 722 | ('nValue', int64_t), 723 | ('nReserved', c_uint * 4), 724 | ] 725 | MV_XML_FEATURE_Enumeration = _MV_XML_FEATURE_Enumeration_ 726 | # CameraParams.h 730 727 | class _MV_XML_FEATURE_Port_(Structure): 728 | pass 729 | _MV_XML_FEATURE_Port_._fields_ = [ 730 | # CameraParams.h 730 731 | ('enVisivility', MV_XML_Visibility), 732 | ('strDescription', c_char * 512), 733 | ('strDisplayName', c_char * 64), 734 | ('strName', c_char * 64), 735 | ('strToolTip', c_char * 512), 736 | ('enAccessMode', MV_XML_AccessMode), 737 | ('bIsLocked', c_int), 738 | ('nReserved', c_uint * 4), 739 | ] 740 | MV_XML_FEATURE_Port = _MV_XML_FEATURE_Port_ 741 | # CameraParams.h 746 742 | class _MV_XML_CAMERA_FEATURE_(Structure): 743 | pass 744 | # CameraParams.h 749 745 | class N23_MV_XML_CAMERA_FEATURE_3DOT_1E(Union): 746 | pass 747 | N23_MV_XML_CAMERA_FEATURE_3DOT_1E._fields_ = [ 748 | # CameraParams.h 749 749 | ('stIntegerFeature', MV_XML_FEATURE_Integer), 750 | ('stFloatFeature', MV_XML_FEATURE_Float), 751 | ('stEnumerationFeature', MV_XML_FEATURE_Enumeration), 752 | ('stStringFeature', MV_XML_FEATURE_String), 753 | ] 754 | _MV_XML_CAMERA_FEATURE_._fields_ = [ 755 | # CameraParams.h 746 756 | ('enType', MV_XML_InterfaceType), 757 | ('SpecialFeature', N23_MV_XML_CAMERA_FEATURE_3DOT_1E), 758 | ] 759 | MV_XML_CAMERA_FEATURE = _MV_XML_CAMERA_FEATURE_ 760 | # CameraParams.h 760 761 | class _MVCC_ENUMVALUE_T(Structure): 762 | pass 763 | _MVCC_ENUMVALUE_T._fields_ = [ 764 | # CameraParams.h 760 765 | ('nCurValue', c_uint), 766 | ('nSupportedNum', c_uint), 767 | ('nSupportValue', c_uint * 64), 768 | ('nReserved', c_uint * 4), 769 | ] 770 | MVCC_ENUMVALUE = _MVCC_ENUMVALUE_T 771 | # CameraParams.h 769 772 | class _MVCC_INTVALUE_T(Structure): 773 | pass 774 | _MVCC_INTVALUE_T._fields_ = [ 775 | # CameraParams.h 769 776 | ('nCurValue', c_uint), 777 | ('nMax', c_uint), 778 | ('nMin', c_uint), 779 | ('nInc', c_uint), 780 | ('nReserved', c_uint * 4), 781 | ] 782 | MVCC_INTVALUE = _MVCC_INTVALUE_T 783 | # CameraParams.h 779 784 | class _MVCC_INTVALUE_EX_T(Structure): 785 | pass 786 | _MVCC_INTVALUE_EX_T._fields_ = [ 787 | # CameraParams.h 779 788 | ('nCurValue', int64_t), 789 | ('nMax', int64_t), 790 | ('nMin', int64_t), 791 | ('nInc', int64_t), 792 | ('nReserved', c_uint * 16), 793 | ] 794 | MVCC_INTVALUE_EX = _MVCC_INTVALUE_EX_T 795 | # CameraParams.h 789 796 | class _MVCC_FLOATVALUE_T(Structure): 797 | pass 798 | _MVCC_FLOATVALUE_T._fields_ = [ 799 | # CameraParams.h 789 800 | ('fCurValue', c_float), 801 | ('fMax', c_float), 802 | ('fMin', c_float), 803 | ('nReserved', c_uint * 4), 804 | ] 805 | MVCC_FLOATVALUE = _MVCC_FLOATVALUE_T 806 | # CameraParams.h 798 807 | class _MVCC_STRINGVALUE_T(Structure): 808 | pass 809 | _MVCC_STRINGVALUE_T._fields_ = [ 810 | # CameraParams.h 798 811 | ('chCurValue', c_char * 256), 812 | ('nMaxLength', int64_t), 813 | ('nReserved', c_uint * 2), 814 | ] 815 | MVCC_STRINGVALUE = _MVCC_STRINGVALUE_T 816 | __all__ = ['_MV_ALL_MATCH_INFO_', '_MV_XML_FEATURE_Integer_', 817 | 'MV_CC_FILE_ACCESS_PROGRESS', 818 | 'N19_MV_CC_DEVICE_INFO_3DOT_0E', 819 | 'MV_CAM_EXPOSURE_AUTO_MODE', 'PixelType_Gvsp_BayerRG8', 820 | 'MV_CAM_GAIN_MODE', 821 | 'MV_GIGE_TRANSTYPE_UNICAST_WITHOUT_RECV', 'IFT_IBase', 822 | 'MV_TRIGGER_SOURCE_LINE0', 'MV_TRIGGER_SOURCE_LINE1', 823 | 'MV_TRIGGER_SOURCE_LINE2', 'MV_TRIGGER_SOURCE_LINE3', 824 | 'AM_CycleDetect', 'PixelType_Gvsp_YCBCR422_8', 825 | 'IFT_IFloat', 'MV_TRANSMISSION_TYPE', 826 | '_MV_XML_FEATURE_Command_', '_MV_XML_FEATURE_String_', 827 | '_MV_CAM_TRIGGER_SOURCE_', 828 | 'PixelType_Gvsp_COORD3D_DEPTH_PLUS_MASK', 829 | 'PixelType_Gvsp_RGB10V1_Packed', 830 | 'PixelType_Gvsp_RGB10_Packed', 831 | 'PixelType_Gvsp_RGB8_Planar', 'AM_RO', 'IFT_IPort', 832 | 'uint_least16_t', '_MV_FRAME_OUT_INFO_EX_', 833 | '_MV_TRANSMISSION_TYPE_T', 'MV_SAVE_IMAGE_PARAM_EX', 834 | 'MV_XML_FEATURE_Integer', 'AM_RW', 'MV_XML_InterfaceType', 835 | '_MV_XML_CAMERA_FEATURE_', 'intptr_t', 'uint_least64_t', 836 | 'V_Guru', '_MV_CAM_TRIGGER_MODE_', 'int_least32_t', 837 | 'PixelType_Gvsp_BayerBG8', '_MV_XML_FEATURE_Boolean_', 838 | 'MV_BALANCEWHITE_AUTO_CONTINUOUS', 'MV_XML_NODE_FEATURE', 839 | '_MV_FRAME_OUT_INFO_', 'MV_ALL_MATCH_INFO', 840 | '_MV_XML_FEATURE_EnumEntry_', '_MV_PIXEL_CONVERT_PARAM_T_', 841 | 'PixelType_Gvsp_RGB16_Packed', 842 | 'PixelType_Gvsp_RGBA8_Packed', 843 | 'PixelType_Gvsp_RGB8_Packed', 'MV_ACQ_MODE_SINGLE', 844 | 'MV_TRIGGER_MODE_ON', '_MV_XML_FEATURE_Base_', 845 | 'PixelType_Gvsp_Mono8_Signed', 'int_least16_t', 846 | 'MV_GIGE_TRANSTYPE_LIMITEDBROADCAST', 'int_fast32_t', 847 | '_MV_CAM_GAIN_MODE_', 'uint_fast16_t', 848 | '_MV_DISPLAY_FRAME_INFO_', 'IFT_ICommand', 849 | 'PixelType_Gvsp_BayerBG10_Packed', 850 | '_MV_CAM_ACQUISITION_MODE_', 851 | 'PixelType_Gvsp_YCBCR709_422_8_CBYCRY', 'V_Beginner', 852 | 'PixelType_Gvsp_BayerBG16', 853 | 'MV_GIGE_TRANSTYPE_MULTICAST_WITHOUT_RECV', 854 | 'MVCC_INTVALUE', '_MV_XML_FEATURE_Port_', 855 | '_MV_GIGE_TRANSMISSION_TYPE_', 'MV_Image_Tif', 856 | 'MV_GIGE_TRANSMISSION_TYPE', 857 | 'PixelType_Gvsp_YUV411_Packed', 858 | '_MV_XML_FEATURE_Register_', 'MV_EXPOSURE_MODE_TIMED', 859 | 'intmax_t', 'PixelType_Gvsp_BayerBG12_Packed', 'int16_t', 860 | 'MV_DISPLAY_FRAME_INFO', 'V_Expert', 861 | '_MV_CC_FILE_ACCESS_PROGRESS_T', 'MV_XML_Visibility', 862 | 'IFT_IEnumEntry', 'int_fast64_t', 863 | 'PixelType_Gvsp_BayerRG12', 'PixelType_Gvsp_BayerRG10', 864 | 'MV_XML_AccessMode', 'PixelType_Gvsp_BayerRG16', 865 | 'MV_GAIN_MODE_ONCE', 'IFT_IInteger', 866 | 'PixelType_Gvsp_YCBCR709_411_8_CBYYCRYY', 867 | 'MV_CAM_BALANCEWHITE_AUTO', 'int_least8_t', 868 | 'PixelType_Gvsp_BayerGB12_Packed', 'MV_XML_NODES_LIST', 869 | 'MV_TRIGGER_MODE_OFF', 'MV_Image_Bmp', 870 | 'MV_XML_FEATURE_String', '_MV_CAM_EXPOSURE_AUTO_MODE_', 871 | 'PixelType_Gvsp_Coord3D_AC32f', 'uint_least8_t', 872 | 'PixelType_Gvsp_BayerRG12_Packed', 873 | 'MV_TRIGGER_SOURCE_COUNTER0', '_MV_XML_FEATURE_Float_', 874 | '_MV_XML_NODE_FEATURE_', 'MV_XML_FEATURE_Float', 875 | 'PixelType_Gvsp_Undefined', 'MV_CC_PIXEL_CONVERT_PARAM', 876 | 'PixelType_Gvsp_YUV422_Packed', 'MV_SAVE_IMAGE_PARAM', 877 | 'MV_EVENT_OUT_INFO', 'IFT_IEnumeration', 'uint64_t', 878 | 'PixelType_Gvsp_Mono1p', 'uint8_t', 879 | 'PixelType_Gvsp_RGB12_Planar', 'V_Undefined', 880 | '_MVCC_STRINGVALUE_T', 'PixelType_Gvsp_YCBCR709_422_8', 881 | 'MV_CAM_TRIGGER_MODE', 'MV_GIGE_TRANSTYPE_MULTICAST', 882 | 'N23_MV_XML_CAMERA_FEATURE_3DOT_1E', 'uint16_t', 883 | 'uint_fast8_t', '_MV_SAVE_IMAGE_PARAM_T_', 884 | 'PixelType_Gvsp_BGR8_Packed', '_MVCC_ENUMVALUE_T', 885 | '_MV_MATCH_INFO_USB_DETECT_', 'MV_XML_FEATURE_Category', 886 | 'PixelType_Gvsp_Jpeg', 'int32_t', 887 | 'PixelType_Gvsp_BayerGR10_Packed', 888 | 'MV_XML_FEATURE_EnumEntry', '_MV_CC_DEVICE_INFO_', 889 | 'PixelType_Gvsp_BayerBG12', 'PixelType_Gvsp_BayerBG10', 890 | 'IFT_IBoolean', 'PixelType_Gvsp_BayerGR8', 891 | 'MV_MATCH_INFO_USB_DETECT', 'PixelType_Gvsp_RGB16_Planar', 892 | 'MVCC_ENUMVALUE', 'IFT_IString', '_MV_XML_FEATURE_Value_', 893 | 'MV_ACQ_MODE_CONTINUOUS', 894 | 'MV_TRIGGER_SOURCE_FrequencyConverter', 895 | 'PixelType_Gvsp_Mono4p', 'PixelType_Gvsp_BayerRG10_Packed', 896 | 'MV_GAIN_MODE_OFF', 'AM_NA', 'MV_GIGE_DEVICE_INFO', 897 | '_MV_SAVE_IMAGE_PARAM_T_EX_', 'PixelType_Gvsp_Mono8', 898 | 'uint_least32_t', 'PixelType_Gvsp_BayerGR16', 899 | 'IFT_ICategory', 'PixelType_Gvsp_BayerGR10', 900 | 'PixelType_Gvsp_BGRA8_Packed', 'AM_NI', 901 | '_MVCC_INTVALUE_EX_T', 'uintptr_t', 902 | 'PixelType_Gvsp_Mono12_Packed', 'MVCC_FLOATVALUE', 903 | 'MV_GIGE_TRANSTYPE_CAMERADEFINED', '_MV_XML_NODES_LIST_', 904 | 'MV_NETTRANS_INFO', 'IFT_IRegister', 905 | 'MV_EXPOSURE_AUTO_MODE_ONCE', 'MV_GIGE_TRANSTYPE_UNICAST', 906 | 'int8_t', '_MV_GIGE_DEVICE_INFO_', 'IFT_IValue', 'AM_WO', 907 | 'int_fast8_t', 'PixelType_Gvsp_YCBCR709_8_CBYCR', 908 | 'MV_XML_FEATURE_Enumeration', 'MV_GAMMA_SELECTOR_SRGB', 909 | 'PixelType_Gvsp_YCBCR601_422_8', 910 | 'PixelType_Gvsp_YCBCR411_8_CBYYCRYY', 'int_least64_t', 911 | 'MV_EXPOSURE_AUTO_MODE_OFF', 'MV_FRAME_OUT_INFO', 912 | 'MV_EXPOSURE_AUTO_MODE_CONTINUOUS', 913 | 'MV_CAM_ACQUISITION_MODE', '_MVCC_INTVALUE_T', 914 | 'MV_XML_FEATURE_Value', 'MV_CC_FILE_ACCESS', 915 | 'MV_MATCH_INFO_NET_DETECT', 'PixelType_Gvsp_BGR12_Packed', 916 | '_MV_CC_FILE_ACCESS_T', 'PixelType_Gvsp_BayerGR12', 917 | 'PixelType_Gvsp_BayerGR12_Packed', 'V_Invisible', 918 | 'PixelType_Gvsp_YCBCR601_411_8_CBYYCRYY', 919 | 'PixelType_Gvsp_RGB10_Planar', 'MV_CAM_GAMMA_SELECTOR', 920 | 'MV_TRIGGER_SOURCE_SOFTWARE', 'PixelType_Gvsp_BayerGB16', 921 | 'MV_BALANCEWHITE_AUTO_ONCE', 'PixelType_Gvsp_BayerGB10', 922 | 'uintmax_t', 'PixelType_Gvsp_BayerGB12', 'int_fast16_t', 923 | '_MV_CAM_EXPOSURE_MODE_', 'AM_Undefined', 924 | 'PixelType_Gvsp_BGR565_Packed', 'MV_BALANCEWHITE_AUTO_OFF', 925 | 'int64_t', 'MV_Image_Undefined', '_MV_NETTRANS_INFO_', 926 | 'MV_GAIN_MODE_CONTINUOUS', 'MV_Image_Png', 'uint_fast32_t', 927 | 'MV_CAM_TRIGGER_SOURCE', '_MV_CC_DEVICE_INFO_LIST_', 928 | 'PixelType_Gvsp_YUV444_Packed', 'MV_Image_Jpeg', 929 | '_MVCC_FLOATVALUE_T', 'MV_XML_FEATURE_Port', 930 | 'PixelType_Gvsp_YUV422_YUYV_Packed', 931 | 'MV_FRAME_OUT_INFO_EX', '_MV_IMAGE_BASIC_INFO_', 932 | '_MV_CAM_BALANCEWHITE_AUTO_', 'MV_XML_FEATURE_Base', 933 | '_MV_USB3_DEVICE_INFO_', 934 | 'MV_GIGE_TRANSTYPE_SUBNETBROADCAST', 'MVCC_INTVALUE_EX', 935 | 'MV_XML_FEATURE_Register', 936 | 'MV_GIGE_TRANSTYPE_UNICAST_DEFINED_PORT', 937 | '_MV_XML_FEATURE_Enumeration_', 938 | '_MV_MATCH_INFO_NET_DETECT_', 'MV_SAVE_IAMGE_TYPE', 939 | 'PixelType_Gvsp_BGR10_Packed', 940 | 'PixelType_Gvsp_BayerGB10_Packed', 941 | 'PixelType_Gvsp_Coord3D_ABC32f_Planar', 942 | 'MV_CAM_EXPOSURE_MODE', 'MV_XML_CAMERA_FEATURE', 943 | 'PixelType_Gvsp_Coord3D_ABC32f', 'MVCC_STRINGVALUE', 944 | 'MV_CC_DEVICE_INFO', 'PixelType_Gvsp_YCBCR422_8_CBYCRY', 945 | 'PixelType_Gvsp_RGB12_Packed', 'PixelType_Gvsp_Mono12', 946 | 'MvGvspPixelType', 'PixelType_Gvsp_Mono10', 947 | 'MV_IMAGE_BASIC_INFO', 'PixelType_Gvsp_Mono16', 948 | 'PixelType_Gvsp_Mono2p', 'PixelType_Gvsp_Mono14', 949 | 'PixelType_Gvsp_RGB10V2_Packed', 'MV_CC_DEVICE_INFO_LIST', 950 | 'PixelType_Gvsp_RGB12V1_Packed', 951 | 'PixelType_Gvsp_Mono10_Packed', 'uint_fast64_t', 952 | 'PixelType_Gvsp_YCBCR601_8_CBYCR', 953 | 'PixelType_Gvsp_BayerGB8', '_MV_XML_FEATURE_Category_', 954 | 'MV_EXPOSURE_MODE_TRIGGER_WIDTH', 955 | 'PixelType_Gvsp_YCBCR8_CBYCR', 'MV_XML_FEATURE_Boolean', 956 | 'MV_GAMMA_SELECTOR_USER', 'PixelType_Gvsp_RGB565_Packed', 957 | 'uint32_t', 'MV_XML_FEATURE_Command', 958 | '_MV_CAM_GAMMA_SELECTOR_', 'MV_ACQ_MODE_MUTLI', 959 | 'PixelType_Gvsp_YCBCR601_422_8_CBYCRY', 960 | 'MV_USB3_DEVICE_INFO', '_MV_EVENT_OUT_INFO_'] 961 | -------------------------------------------------------------------------------- /MvImport/MvErrorDefine_const.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | #Don't change this file, it was auto generated by Const_file_Generater.py. 4 | 5 | 6 | MV_OK = 0x00000000 # < 成功,无错误 | en:Successed, no error 7 | MV_E_HANDLE = 0x80000000 # < 错误或无效的句柄 | en:Error or invalid handle 8 | MV_E_SUPPORT = 0x80000001 # < 不支持的功能 | en:Not supported function 9 | MV_E_BUFOVER = 0x80000002 # < 缓存已满 | en:Cache is full 10 | MV_E_CALLORDER = 0x80000003 # < 函数调用顺序错误 | en:Function calling order error 11 | MV_E_PARAMETER = 0x80000004 # < 错误的参数 | en:Incorrect parameter 12 | MV_E_RESOURCE = 0x80000006 # < 资源申请失败 | en:Applying resource failed 13 | MV_E_NODATA = 0x80000007 # < 无数据 | en:No data 14 | MV_E_PRECONDITION = 0x80000008 # < 前置条件有误,或运行环境已发生变化 | en:Precondition error, or running environment changed 15 | MV_E_VERSION = 0x80000009 # < 版本不匹配 | en:Version mismatches 16 | MV_E_NOENOUGH_BUF = 0x8000000A # < 传入的内存空间不足 | en:Insufficient memory 17 | MV_E_ABNORMAL_IMAGE = 0x8000000B # < 异常图像,可能是丢包导致图像不完整 | en:Abnormal image, maybe incomplete image because of lost packet 18 | MV_E_LOAD_LIBRARY = 0x8000000C # < 动态导入DLL失败 | en:Load library failed 19 | MV_E_UNKNOW = 0x800000FF # < 未知的错误 | en:Unknown error 20 | MV_E_GC_GENERIC = 0x80000100 # < 通用错误 | en:General error 21 | MV_E_GC_ARGUMENT = 0x80000101 # < 参数非法 | en:Illegal parameters 22 | MV_E_GC_RANGE = 0x80000102 # < 值超出范围 | en:The value is out of range 23 | MV_E_GC_PROPERTY = 0x80000103 # < 属性 | en:Property 24 | MV_E_GC_RUNTIME = 0x80000104 # < 运行环境有问题 | en:Running environment error 25 | MV_E_GC_LOGICAL = 0x80000105 # < 逻辑错误 | en:Logical error 26 | MV_E_GC_ACCESS = 0x80000106 # < 节点访问条件有误 | en:Node accessing condition error 27 | MV_E_GC_TIMEOUT = 0x80000107 # < 超时 | en:Timeout 28 | MV_E_GC_DYNAMICCAST = 0x80000108 # < 转换异常 | en:Transformation exception 29 | MV_E_GC_UNKNOW = 0x800001FF # < GenICam未知错误 | en:GenICam unknown error 30 | MV_E_NOT_IMPLEMENTED = 0x80000200 # < 命令不被设备支持 | en:The command is not supported by device 31 | MV_E_INVALID_ADDRESS = 0x80000201 # < 访问的目标地址不存在 | en:The target address being accessed does not exist 32 | MV_E_WRITE_PROTECT = 0x80000202 # < 目标地址不可写 | en:The target address is not writable 33 | MV_E_ACCESS_DENIED = 0x80000203 # < 设备无访问权限 | en:No permission 34 | MV_E_BUSY = 0x80000204 # < 设备忙,或网络断开 | en:Device is busy, or network disconnected 35 | MV_E_PACKET = 0x80000205 # < 网络包数据错误 | en:Network data packet error 36 | MV_E_NETER = 0x80000206 # < 网络相关错误 | en:Network error 37 | MV_E_IP_CONFLICT = 0x80000221 # < 设备IP冲突 | en:Device IP conflict 38 | MV_E_USB_READ = 0x80000300 # < 读usb出错 | en:Reading USB error 39 | MV_E_USB_WRITE = 0x80000301 # < 写usb出错 | en:Writing USB error 40 | MV_E_USB_DEVICE = 0x80000302 # < 设备异常 | en:Device exception 41 | MV_E_USB_GENICAM = 0x80000303 # < GenICam相关错误 | en:GenICam error 42 | MV_E_USB_BANDWIDTH = 0x80000304 # < 带宽不足 该错误码新增 | en:Insufficient bandwidth, this error code is newly added 43 | MV_E_USB_DRIVER = 0x80000305 # < 驱动不匹配或者未装驱动 | en:Driver mismatch or unmounted drive 44 | MV_E_USB_UNKNOW = 0x800003FF # < USB未知的错误 | en:USB unknown error 45 | MV_E_UPG_FILE_MISMATCH = 0x80000400 # < 升级固件不匹配 | en:Firmware mismatches 46 | MV_E_UPG_LANGUSGE_MISMATCH = 0x80000401 # < 升级固件语言不匹配 | en:Firmware language mismatches 47 | MV_E_UPG_CONFLICT = 0x80000402 # < 升级冲突(设备已经在升级了再次请求升级即返回此错误) | en:Upgrading conflicted (repeated upgrading requests during device upgrade) 48 | MV_E_UPG_INNER_ERR = 0x80000403 # < 升级时相机内部出现错误 | en:Camera internal error during upgrade 49 | MV_E_UPG_UNKNOW = 0x800004FF # < 升级时未知错误 | en:Unknown error during upgrade 50 | -------------------------------------------------------------------------------- /MvImport/PixelType_const.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | #Don't change this file, it was auto generated by Const_file_Generater.py. 4 | 5 | 6 | MV_GVSP_PIX_MONO = 0x01000000 7 | MV_GVSP_PIX_RGB = 0x02000000 # deprecated in version 1.1 8 | MV_GVSP_PIX_COLOR = 0x02000000 9 | MV_GVSP_PIX_CUSTOM = 0x80000000 10 | MV_GVSP_PIX_COLOR_MASK = 0xFF000000 11 | MV_GVSP_PIX_EFFECTIVE_PIXEL_SIZE_MASK = 0x00FF0000 12 | MV_GVSP_PIX_EFFECTIVE_PIXEL_SIZE_SHIFT = 16 13 | MV_GVSP_PIX_ID_MASK = 0x0000FFFF 14 | MV_GVSP_PIX_COUNT = 0x46 # next Pixel ID available 15 | -------------------------------------------------------------------------------- /MvImport/PixelType_header.py: -------------------------------------------------------------------------------- 1 | # generated by 'xml2py' 2 | # flags '-c -d -v C:\test_h\PixelType.xml -o PixelType_header.py' 3 | from ctypes import * 4 | 5 | 6 | 7 | PixelType_Gvsp_YUV411_Packed = 34340894 8 | PixelType_Gvsp_Mono1p = 16842807 9 | PixelType_Gvsp_YCBCR422_8 = 34603067 10 | PixelType_Gvsp_BayerGR10 = 17825804 11 | PixelType_Gvsp_BayerGR12_Packed = 17563690 12 | PixelType_Gvsp_BayerGB8 = 17301514 13 | PixelType_Gvsp_BayerGB16 = 17825840 14 | PixelType_Gvsp_YCBCR601_422_8 = 34603070 15 | PixelType_Gvsp_YCBCR709_8_CBYCR = 35127360 16 | PixelType_Gvsp_BayerRG10 = 17825805 17 | PixelType_Gvsp_RGB10_Packed = 36700184 18 | PixelType_Gvsp_COORD3D_DEPTH_PLUS_MASK = -2112094207 19 | PixelType_Gvsp_YCBCR601_422_8_CBYCRY = 34603076 20 | PixelType_Gvsp_Mono14 = 17825829 21 | PixelType_Gvsp_YCBCR601_411_8_CBYYCRYY = 34340927 22 | PixelType_Gvsp_BayerGB10_Packed = 17563688 23 | PixelType_Gvsp_BayerGB12 = 17825810 24 | PixelType_Gvsp_YUV422_YUYV_Packed = 34603058 25 | PixelType_Gvsp_Mono8 = 17301505 26 | PixelType_Gvsp_BayerGR12 = 17825808 27 | PixelType_Gvsp_YCBCR709_422_8 = 34603073 28 | PixelType_Gvsp_RGB10V1_Packed = 35651612 29 | PixelType_Gvsp_BayerBG12 = 17825811 30 | PixelType_Gvsp_BayerRG12 = 17825809 31 | PixelType_Gvsp_BayerBG10 = 17825807 32 | PixelType_Gvsp_RGB8_Packed = 35127316 33 | PixelType_Gvsp_BGR565_Packed = 34603062 34 | PixelType_Gvsp_Coord3D_ABC32f_Planar = 39846081 35 | PixelType_Gvsp_YCBCR601_8_CBYCR = 35127357 36 | PixelType_Gvsp_BayerGB10 = 17825806 37 | PixelType_Gvsp_YCBCR8_CBYCR = 35127354 38 | PixelType_Gvsp_BayerRG8 = 17301513 39 | PixelType_Gvsp_BayerBG12_Packed = 17563693 40 | PixelType_Gvsp_BayerRG16 = 17825839 41 | PixelType_Gvsp_BayerBG16 = 17825841 42 | PixelType_Gvsp_BayerGR16 = 17825838 43 | PixelType_Gvsp_Undefined = -1 44 | PixelType_Gvsp_BayerBG10_Packed = 17563689 45 | PixelType_Gvsp_BayerGB12_Packed = 17563692 46 | PixelType_Gvsp_BayerBG8 = 17301515 47 | PixelType_Gvsp_YCBCR422_8_CBYCRY = 34603075 48 | PixelType_Gvsp_RGB10_Planar = 36700194 49 | PixelType_Gvsp_BayerGR10_Packed = 17563686 50 | PixelType_Gvsp_RGB16_Planar = 36700196 51 | PixelType_Gvsp_RGB565_Packed = 34603061 52 | PixelType_Gvsp_Mono4p = 17039417 53 | PixelType_Gvsp_Coord3D_ABC32f = 39846080 54 | PixelType_Gvsp_BGR10_Packed = 36700185 55 | PixelType_Gvsp_YCBCR411_8_CBYYCRYY = 34340924 56 | PixelType_Gvsp_BayerRG12_Packed = 17563691 57 | PixelType_Gvsp_YUV422_Packed = 34603039 58 | PixelType_Gvsp_YCBCR709_411_8_CBYYCRYY = 34340930 59 | PixelType_Gvsp_RGB8_Planar = 35127329 60 | PixelType_Gvsp_Mono10 = 17825795 61 | PixelType_Gvsp_BayerGR8 = 17301512 62 | PixelType_Gvsp_YCBCR709_422_8_CBYCRY = 34603077 63 | PixelType_Gvsp_Jpeg = -2145910783 64 | PixelType_Gvsp_RGB12_Packed = 36700186 65 | PixelType_Gvsp_RGB12_Planar = 36700195 66 | PixelType_Gvsp_Mono2p = 16908344 67 | PixelType_Gvsp_BGR12_Packed = 36700187 68 | PixelType_Gvsp_RGB12V1_Packed = 35913780 69 | PixelType_Gvsp_BGR8_Packed = 35127317 70 | PixelType_Gvsp_RGBA8_Packed = 35651606 71 | PixelType_Gvsp_RGB16_Packed = 36700211 72 | PixelType_Gvsp_YUV444_Packed = 35127328 73 | PixelType_Gvsp_RGB10V2_Packed = 35651613 74 | PixelType_Gvsp_Mono16 = 17825799 75 | PixelType_Gvsp_Mono8_Signed = 17301506 76 | PixelType_Gvsp_Mono10_Packed = 17563652 77 | PixelType_Gvsp_BGRA8_Packed = 35651607 78 | PixelType_Gvsp_Mono12_Packed = 17563654 79 | PixelType_Gvsp_Mono12 = 17825797 80 | PixelType_Gvsp_BayerRG10_Packed = 17563687 81 | PixelType_Gvsp_Coord3D_AC32f = 36176066 82 | int8_t = c_int8 83 | int16_t = c_int16 84 | int32_t = c_int32 85 | int64_t = c_int64 86 | uint8_t = c_uint8 87 | uint16_t = c_uint16 88 | uint32_t = c_uint32 89 | uint64_t = c_uint64 90 | int_least8_t = c_byte 91 | int_least16_t = c_short 92 | int_least32_t = c_int 93 | int_least64_t = c_long 94 | uint_least8_t = c_ubyte 95 | uint_least16_t = c_ushort 96 | uint_least32_t = c_uint 97 | uint_least64_t = c_ulong 98 | int_fast8_t = c_byte 99 | int_fast16_t = c_long 100 | int_fast32_t = c_long 101 | int_fast64_t = c_long 102 | uint_fast8_t = c_ubyte 103 | uint_fast16_t = c_ulong 104 | uint_fast32_t = c_ulong 105 | uint_fast64_t = c_ulong 106 | intptr_t = c_long 107 | uintptr_t = c_ulong 108 | intmax_t = c_long 109 | uintmax_t = c_ulong 110 | 111 | # values for enumeration 'MvGvspPixelType' 112 | MvGvspPixelType = c_int # enum 113 | __all__ = ['PixelType_Gvsp_BayerRG8', 'int_fast32_t', 114 | 'PixelType_Gvsp_YCBCR422_8', 115 | 'PixelType_Gvsp_COORD3D_DEPTH_PLUS_MASK', 'uint8_t', 116 | 'PixelType_Gvsp_RGB10V1_Packed', 'uint_least16_t', 117 | 'PixelType_Gvsp_RGB8_Planar', 'intptr_t', 'uint_least64_t', 118 | 'int_least32_t', 'PixelType_Gvsp_RGB16_Packed', 119 | 'PixelType_Gvsp_RGBA8_Packed', 120 | 'PixelType_Gvsp_RGB8_Packed', 121 | 'PixelType_Gvsp_Mono8_Signed', 'int_least16_t', 122 | 'uint_fast16_t', 'PixelType_Gvsp_BayerBG10_Packed', 123 | 'PixelType_Gvsp_YCBCR709_422_8_CBYCRY', 124 | 'PixelType_Gvsp_YUV411_Packed', 'intmax_t', 125 | 'PixelType_Gvsp_BayerBG12_Packed', 'int16_t', 126 | 'int_fast64_t', 'PixelType_Gvsp_BayerRG12', 127 | 'PixelType_Gvsp_BayerRG10', 'PixelType_Gvsp_BayerRG16', 128 | 'uint_fast32_t', 'PixelType_Gvsp_YCBCR709_411_8_CBYYCRYY', 129 | 'int_least8_t', 'PixelType_Gvsp_BayerGB12_Packed', 130 | 'PixelType_Gvsp_Coord3D_AC32f', 'uint_least8_t', 131 | 'PixelType_Gvsp_BayerRG12_Packed', 132 | 'PixelType_Gvsp_Undefined', 'PixelType_Gvsp_YUV422_Packed', 133 | 'PixelType_Gvsp_RGB10_Packed', 134 | 'PixelType_Gvsp_RGB12_Planar', 135 | 'PixelType_Gvsp_YCBCR709_422_8', 'uint16_t', 136 | 'uint_fast8_t', 'PixelType_Gvsp_BGR8_Packed', 137 | 'PixelType_Gvsp_Jpeg', 'int32_t', 138 | 'PixelType_Gvsp_BayerGR10_Packed', 139 | 'PixelType_Gvsp_BayerBG12', 'PixelType_Gvsp_BayerBG10', 140 | 'PixelType_Gvsp_BayerBG16', 'PixelType_Gvsp_Mono12', 141 | 'PixelType_Gvsp_RGB16_Planar', 'PixelType_Gvsp_Mono4p', 142 | 'PixelType_Gvsp_BayerRG10_Packed', 'PixelType_Gvsp_Mono8', 143 | 'uint_least32_t', 'PixelType_Gvsp_BayerGR16', 144 | 'PixelType_Gvsp_BayerGR10', 'PixelType_Gvsp_BGRA8_Packed', 145 | 'PixelType_Gvsp_BayerGR12', 'uintptr_t', 146 | 'PixelType_Gvsp_Mono12_Packed', 'int8_t', 147 | 'PixelType_Gvsp_YCBCR709_8_CBYCR', 148 | 'PixelType_Gvsp_YCBCR601_422_8', 149 | 'PixelType_Gvsp_YCBCR411_8_CBYYCRYY', 'int_least64_t', 150 | 'PixelType_Gvsp_BGR12_Packed', 'uint64_t', 151 | 'PixelType_Gvsp_BayerGR12_Packed', 152 | 'PixelType_Gvsp_YCBCR601_411_8_CBYYCRYY', 153 | 'PixelType_Gvsp_RGB10_Planar', 'PixelType_Gvsp_BayerGB16', 154 | 'PixelType_Gvsp_BayerGB10', 'uintmax_t', 155 | 'PixelType_Gvsp_BayerGB12', 'PixelType_Gvsp_BGR565_Packed', 156 | 'int64_t', 'int_fast16_t', 'PixelType_Gvsp_Mono1p', 157 | 'PixelType_Gvsp_YUV444_Packed', 158 | 'PixelType_Gvsp_YUV422_YUYV_Packed', 159 | 'PixelType_Gvsp_BayerBG8', 'int_fast8_t', 160 | 'PixelType_Gvsp_BGR10_Packed', 161 | 'PixelType_Gvsp_BayerGB10_Packed', 162 | 'PixelType_Gvsp_Coord3D_ABC32f_Planar', 163 | 'PixelType_Gvsp_Coord3D_ABC32f', 164 | 'PixelType_Gvsp_YCBCR422_8_CBYCRY', 165 | 'PixelType_Gvsp_RGB12_Packed', 'PixelType_Gvsp_BayerGR8', 166 | 'MvGvspPixelType', 'PixelType_Gvsp_Mono10', 167 | 'PixelType_Gvsp_Mono16', 'PixelType_Gvsp_Mono2p', 168 | 'PixelType_Gvsp_Mono14', 'PixelType_Gvsp_RGB10V2_Packed', 169 | 'PixelType_Gvsp_RGB12V1_Packed', 170 | 'PixelType_Gvsp_Mono10_Packed', 'uint_fast64_t', 171 | 'PixelType_Gvsp_YCBCR601_8_CBYCR', 172 | 'PixelType_Gvsp_BayerGB8', 'PixelType_Gvsp_YCBCR8_CBYCR', 173 | 'PixelType_Gvsp_RGB565_Packed', 'uint32_t', 174 | 'PixelType_Gvsp_YCBCR601_422_8_CBYCRY'] 175 | -------------------------------------------------------------------------------- /MvImport/__pycache__/CameraParams_const.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/MvImport/__pycache__/CameraParams_const.cpython-36.pyc -------------------------------------------------------------------------------- /MvImport/__pycache__/CameraParams_header.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/MvImport/__pycache__/CameraParams_header.cpython-36.pyc -------------------------------------------------------------------------------- /MvImport/__pycache__/MvCameraControl_class.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/MvImport/__pycache__/MvCameraControl_class.cpython-36.pyc -------------------------------------------------------------------------------- /MvImport/__pycache__/MvCameraControl_header.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/MvImport/__pycache__/MvCameraControl_header.cpython-36.pyc -------------------------------------------------------------------------------- /MvImport/__pycache__/MvErrorDefine_const.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/MvImport/__pycache__/MvErrorDefine_const.cpython-36.pyc -------------------------------------------------------------------------------- /MvImport/__pycache__/PixelType_const.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/MvImport/__pycache__/PixelType_const.cpython-36.pyc -------------------------------------------------------------------------------- /MvImport/__pycache__/PixelType_header.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/MvImport/__pycache__/PixelType_header.cpython-36.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Paddle_infer_python 2 | 1、本文提供了如何在paddle单帧图像进行预测的方式以及连接相机实时检测功能。 3 | 4 | 2、infer_img.py是传入单帧图像去检测,传入预测函数里面是一个numpy数组。 5 | 6 | 3、infer_video.py是利用pyqt搭建的一个小的界面程序,连接摄像头进行实时采集。 7 | -------------------------------------------------------------------------------- /__pycache__/infer_video.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/__pycache__/infer_video.cpython-36.pyc -------------------------------------------------------------------------------- /__pycache__/ui_main.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/__pycache__/ui_main.cpython-36.pyc -------------------------------------------------------------------------------- /infer_img.py: -------------------------------------------------------------------------------- 1 | 2 | import numpy as np 3 | import time 4 | import paddle.fluid as fluid 5 | from PIL import Image 6 | from PIL import ImageDraw 7 | 8 | train_parameters = { 9 | "label_dict": {0:"apple",1:"banana",2:"orange"}, 10 | "use_gpu": True, 11 | "input_size": [3, 608, 608], # 原版的边长大小为608,为了提高训练速度和预测速度,此处压缩为448 12 | } 13 | 14 | target_size = train_parameters['input_size'] 15 | 16 | label_dict = train_parameters['label_dict'] 17 | print(label_dict[1]) 18 | # class_dim = train_parameters['class_dim'] 19 | # print("label_dict:{} class dim:{}".format(label_dict, class_dim)) 20 | place = fluid.CUDAPlace(0) if train_parameters['use_gpu'] else fluid.CPUPlace() 21 | exe = fluid.Executor(place) 22 | path="C:\\Users\\zhili\\Desktop\\infer-paddle\\model"#_mobilenet_v1 23 | [inference_program, feed_target_names, fetch_targets] = fluid.io.load_inference_model\ 24 | (dirname=path, executor=exe,model_filename='__model__', params_filename='__params__') 25 | 26 | 27 | 28 | class inference(): 29 | def __init__(self): 30 | print("8888888888") 31 | 32 | def read_image(self, img_path): 33 | origin = Image.open(img_path) 34 | img = self.resize_img(origin, target_size) 35 | resized_img = img.copy() 36 | if img.mode != 'RGB': 37 | img = img.convert('RGB') 38 | img = np.array(img).astype('float32').transpose((2, 0, 1)) # HWC to CHW 让矩阵进行方向的转置 39 | img = img / 255.0 40 | 41 | img[0, :, :] -= 0.485 42 | img[1, :, :] -= 0.456 43 | img[2, :, :] -= 0.406 44 | 45 | img[0, :, :] /= 0.229 46 | img[1, :, :] /= 0.224 47 | img[2, :, :] /= 0.225 48 | img = img[np.newaxis, :] 49 | return origin, img, resized_img 50 | 51 | def draw_bbox_image(self,img, boxes, labels,scores, save_name): 52 | """ 53 | 给图片画上外接矩形框 54 | :param img: 55 | :param boxes: 56 | :param save_name: 57 | :param labels 58 | :return: 59 | """ 60 | draw = ImageDraw.Draw(img) 61 | for box, label,score in zip(boxes, labels,scores): 62 | print(box, label, score) 63 | if(score >0.9): 64 | xmin, ymin, xmax, ymax = box[0], box[1], box[2], box[3] 65 | draw.rectangle((xmin, ymin, xmax, ymax), None, 'red') 66 | draw.text((xmin, ymin), label_dict[label], (255, 255, 0)) 67 | img.save(save_name) 68 | 69 | def resize_img(self,img, target_size):#将图片resize到target_size 70 | """ 71 | 保持比例的缩放图片 72 | :param img: 73 | :param target_size: 74 | :return: 75 | """ 76 | img = img.resize(target_size[1:], Image.BILINEAR) 77 | return img 78 | 79 | 80 | def read_image(self,img_path): 81 | 82 | origin = Image.open(img_path) 83 | img = self.resize_img(origin, target_size) 84 | resized_img = img.copy() 85 | if img.mode != 'RGB': 86 | img = img.convert('RGB') 87 | img = np.array(img).astype('float32').transpose((2, 0, 1)) # HWC to CHW 让矩阵进行方向的转置 88 | img = img / 255.0 89 | 90 | img[0, :, :] -= 0.485 91 | img[1, :, :] -= 0.456 92 | img[2, :, :] -= 0.406 93 | 94 | img[0, :, :] /=0.229 95 | img[1, :, :] /=0.224 96 | img[2, :, :] /=0.225 97 | img = img[np.newaxis, :] 98 | return origin, img, resized_img 99 | 100 | def infer(self,image_path): 101 | """ 102 | 预测,将结果保存到一副新的图片中 103 | :param image_path: 104 | :return: 105 | """ 106 | origin, tensor_img, resized_img = self.read_image(image_path) 107 | input_w, input_h = origin.size[0], origin.size[1] 108 | image_shape = np.array([input_h, input_w], dtype='int32') 109 | t1 = time.time() 110 | batch_outputs = exe.run(inference_program, 111 | feed={feed_target_names[0]: tensor_img, 112 | feed_target_names[1]: image_shape[np.newaxis, :]}, 113 | fetch_list=fetch_targets, 114 | return_numpy=False) 115 | 116 | period = time.time() - t1 117 | print("predict cost time:{0}".format("%2.2f sec" % period)) 118 | bboxes = np.array(batch_outputs[0]) 119 | 120 | if bboxes.shape[1] != 6: 121 | print("No object found in {}".format(image_path)) 122 | return 123 | labels = bboxes[:, 0].astype('int32') 124 | scores = bboxes[:, 1].astype('float32') 125 | boxes = bboxes[:, 2:].astype('float32') 126 | 127 | last_dot_index = image_path.rfind('.') 128 | out_path = image_path[:last_dot_index] 129 | out_path += '-result.jpg' 130 | self.draw_bbox_image(origin, boxes, labels,scores, out_path) 131 | 132 | if __name__ == '__main__': 133 | image_path= "C:\\Users\\zhili\\Desktop\\infer-paddle\\pic\\2.jpg" 134 | a=inference() 135 | a.infer(image_path) -------------------------------------------------------------------------------- /infer_video.py: -------------------------------------------------------------------------------- 1 | 2 | import numpy as np 3 | import time 4 | import paddle.fluid as fluid 5 | from PIL import Image 6 | from PIL import ImageDraw 7 | 8 | def read_image(img_path): 9 | """ 10 | 读取图片 11 | :param img_path: 12 | :return: 13 | """ 14 | origin = Image.open(img_path) 15 | return origin 16 | 17 | 18 | 19 | 20 | class inference(): 21 | def __init__(self): 22 | 23 | 24 | train_parameters = { 25 | "label_dict": {0: "apple", 1: "banana", 2: "orange"}, 26 | "use_gpu": True, 27 | "input_size": [3, 608, 608], # 原版的边长大小为608,为了提高训练速度和预测速度,此处压缩为448 28 | } 29 | 30 | self.target_size = train_parameters['input_size'] 31 | 32 | self.label_dict = train_parameters['label_dict'] 33 | 34 | # class_dim = train_parameters['class_dim'] 35 | # print("label_dict:{} class dim:{}".format(label_dict, class_dim)) 36 | place = fluid.CUDAPlace(0) if train_parameters['use_gpu'] else fluid.CPUPlace() 37 | self.exe = fluid.Executor(place) 38 | path = "C:\\Users\\zhili\\Desktop\\infer-paddle\\model" # _mobilenet_v1 39 | [self.inference_program, self.feed_target_names, self.fetch_targets] = fluid.io.load_inference_model \ 40 | (dirname=path, executor=self.exe, model_filename='__model__', params_filename='__params__') 41 | 42 | 43 | def draw_bbox_image(self,img, boxes, labels,scores): 44 | """ 45 | 给图片画上外接矩形框 46 | :param img: 47 | :param boxes: 48 | :param save_name: 49 | :param labels 50 | :return: 51 | """ 52 | draw = ImageDraw.Draw(img) 53 | for box, label,score in zip(boxes, labels,scores): 54 | print(box, label, score) 55 | if(score >0.3): 56 | xmin, ymin, xmax, ymax = box[0], box[1], box[2], box[3] 57 | draw.rectangle((xmin, ymin, xmax, ymax), None, 'red') 58 | draw.text((xmin, ymin), self.label_dict[label], (255, 255, 0)) 59 | # img.save(save_name) 60 | 61 | def resize_img(self,img, target_size):#将图片resize到target_size 62 | """ 63 | 保持比例的缩放图片 64 | :param img: 65 | :param target_size: 66 | :return: 67 | """ 68 | img = img.resize(target_size[1:], Image.BILINEAR) 69 | return img 70 | 71 | def tensor(self, img): 72 | img = self.resize_img(img, self.target_size) 73 | resized_img = img.copy() 74 | if img.mode != 'RGB': 75 | img = img.convert('RGB') 76 | img = np.array(img).astype('float32').transpose((2, 0, 1)) # HWC to CHW 77 | 78 | img = img / 255.0 79 | 80 | img[0, :, :] -= 0.485 81 | img[1, :, :] -= 0.456 82 | img[2, :, :] -= 0.406 83 | 84 | img[0, :, :] /= 0.229 85 | img[1, :, :] /= 0.224 86 | img[2, :, :] /= 0.225 87 | tensor_img = img[np.newaxis, :] 88 | return tensor_img 89 | 90 | 91 | 92 | def infer(self,origin): 93 | """ 94 | 预测,将结果保存到一副新的图片中 95 | :param image_path: 96 | :return: 97 | """ 98 | 99 | input_w, input_h = origin.size[0], origin.size[1] 100 | image_shape = np.array([input_h, input_w], dtype='int32') 101 | t1 = time.time() 102 | tensor_img = self.tensor(origin) 103 | batch_outputs = self.exe.run(self.inference_program, 104 | feed={self.feed_target_names[0]: tensor_img, 105 | self.feed_target_names[1]: image_shape[np.newaxis, :]}, 106 | fetch_list=self.fetch_targets, 107 | return_numpy=False) 108 | 109 | period = time.time() - t1 110 | print("predict cost time:{0}".format("%2.2f sec" % period)) 111 | bboxes = np.array(batch_outputs[0]) 112 | 113 | if bboxes.shape[1] != 6: 114 | print("No object found in {}".format(image_path)) 115 | return 116 | labels = bboxes[:, 0].astype('int32') 117 | scores = bboxes[:, 1].astype('float32') 118 | boxes = bboxes[:, 2:].astype('float32') 119 | 120 | # last_dot_index = image_path.rfind('.') 121 | # out_path = image_path[:last_dot_index] 122 | # out_path += '-result.jpg' 123 | self.draw_bbox_image(origin, boxes, labels,scores) 124 | return origin 125 | 126 | 127 | 128 | if __name__ == '__main__': 129 | img_path= "C:\\Users\\zhili\\Desktop\\infer-paddle\\pic\\2.jpg" 130 | origin = read_image(img_path) 131 | a=inference() 132 | a.infer(origin) -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | 2 | import sys, time 3 | from PyQt5.QtCore import pyqtSlot 4 | from PyQt5.QtWidgets import QMainWindow, QApplication 5 | 6 | from PyQt5.QtCore import * 7 | from PyQt5.QtWidgets import * 8 | from PyQt5.QtGui import * 9 | 10 | import copy 11 | import msvcrt 12 | import numpy 13 | import cv2 14 | sys.path.append("./MvImport") 15 | from MvCameraControl_class import * 16 | from infer_video import inference 17 | from PIL import Image 18 | 19 | from ui_main import Ui_MainWindow 20 | 21 | 22 | class MainWindow(QMainWindow, Ui_MainWindow): 23 | """ 24 | Class documentation goes here. 25 | """ 26 | 27 | def __init__(self, parent=None): 28 | """ 29 | Constructor 30 | 31 | @param parent reference to the parent widget 32 | @type QWidget 33 | """ 34 | super(MainWindow, self).__init__(parent) 35 | self.setupUi(self) 36 | self.VideoTimer = Video() # videotimer是一个对象 37 | self.VideoTimer.changePixmap.connect(self.setImage) # changePixmap信号,槽函数是setImage 38 | self.VideoTimer.detectPixmap.connect(self.setDetect) # detectPixmap是一个信号,槽函数是SetDetect 39 | 40 | def setImage(self, frame): 41 | rgbImage = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) 42 | convertToQtFormat = QImage(rgbImage.data, rgbImage.shape[1], rgbImage.shape[0], 43 | QImage.Format_RGB888) # 在这里可以对每帧图像进行处理, 44 | p = convertToQtFormat.scaled(900, 650) # Qt.KeepAspectRatio 保持图片的尺寸 45 | self.label.setPixmap(QPixmap.fromImage(p).scaled(self.label.width(), self.label.height())) 46 | 47 | def setDetect(self, image): 48 | self.img = image 49 | rgbImage = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) 50 | convertToQtFormat = QImage(rgbImage.data, rgbImage.shape[1], rgbImage.shape[0], 51 | QImage.Format_RGB888) # 在这里可以对每帧图像进行处理, 52 | p = convertToQtFormat.scaled(900, 650) # Qt.KeepAspectRatio 保持图片的尺寸 53 | self.label_2.setPixmap(QPixmap.fromImage(p).scaled(self.label_2.width(), self.label_2.height())) 54 | 55 | @pyqtSlot() 56 | def on_pushButton_clicked(self): 57 | """ 58 | Slot documentation goes here. 59 | """ 60 | # TODO: not implemented yet 61 | self.VideoTimer.start() # 展示线程 62 | 63 | @pyqtSlot() 64 | def on_pushButton_2_clicked(self): 65 | """ 66 | Slot documentation goes here. 67 | """ 68 | # TODO: not implemented yet 69 | self.VideoTimer.setDetect() # 检测线程 70 | 71 | # @pyqtSlot() 72 | # def on_pushButtonSave_clicked(self): 73 | # """ 74 | # Slot documentation goes here. 75 | # """ 76 | # # TODO: not implemented yet 77 | # # self.VideoTimer.setSave() 78 | # 79 | # name = int(time.time()) 80 | # cv2.imwrite('./result/' + str(name) + '.jpg', self.img) 81 | 82 | 83 | class Video(QThread): 84 | changePixmap = pyqtSignal(numpy.ndarray) # 一般来说最简单的信号有clicked pressed released 现在相当于是自定义 pyqtSignal是高级自定义信号 85 | detectPixmap = pyqtSignal(numpy.ndarray) # 86 | 87 | def __init__(self): 88 | QThread.__init__(self) 89 | self.detect = 0 90 | self.saveflag = 0 91 | self.de =inference() 92 | 93 | def run(self): 94 | deviceList = MV_CC_DEVICE_INFO_LIST() # 相机列表 95 | tlayerType = MV_GIGE_DEVICE | MV_USB_DEVICE # 相机类型 96 | 97 | # ch:枚举设备 | en:Enum device 98 | ret = MvCamera.MV_CC_EnumDevices(tlayerType, deviceList) 99 | if ret != 0: 100 | print("enum devices fail! ret[0x%x]" % ret) 101 | sys.exit() 102 | 103 | if deviceList.nDeviceNum == 0: 104 | print("find no device!") 105 | sys.exit() 106 | 107 | print("find %d devices!" % deviceList.nDeviceNum) 108 | 109 | for i in range(0, deviceList.nDeviceNum): 110 | mvcc_dev_info = cast(deviceList.pDeviceInfo[i], POINTER(MV_CC_DEVICE_INFO)).contents 111 | if mvcc_dev_info.nTLayerType == MV_GIGE_DEVICE: 112 | print("\ngige device: [%d]" % i) 113 | strModeName = "" 114 | for per in mvcc_dev_info.SpecialInfo.stGigEInfo.chModelName: 115 | strModeName = strModeName + chr(per) 116 | print("device model name: %s" % strModeName) 117 | 118 | nip1 = ((mvcc_dev_info.SpecialInfo.stGigEInfo.nCurrentIp & 0xff000000) >> 24) 119 | nip2 = ((mvcc_dev_info.SpecialInfo.stGigEInfo.nCurrentIp & 0x00ff0000) >> 16) 120 | nip3 = ((mvcc_dev_info.SpecialInfo.stGigEInfo.nCurrentIp & 0x0000ff00) >> 8) 121 | nip4 = (mvcc_dev_info.SpecialInfo.stGigEInfo.nCurrentIp & 0x000000ff) 122 | print("current ip: %d.%d.%d.%d\n" % (nip1, nip2, nip3, nip4)) 123 | elif mvcc_dev_info.nTLayerType == MV_UWSB_DEVICE: 124 | print("\nu3v device: [%d]" % i) 125 | strModeName = "" 126 | for per in mvcc_dev_info.SpecialInfo.stUsb3VInfo.chModelName: 127 | if per == 0: 128 | break 129 | strModeName = strModeName + chr(per) 130 | print("device model name: %s" % strModeName) 131 | 132 | strSerialNumber = "" 133 | for per in mvcc_dev_info.SpecialInfo.stUsb3VInfo.chSerialNumber: 134 | if per == 0: 135 | break 136 | strSerialNumber = strSerialNumber + chr(per) 137 | print("user serial number: %s" % strSerialNumber) 138 | 139 | nConnectionNum = 0 # input("please input the number of the device to connect:") 140 | 141 | if int(nConnectionNum) >= deviceList.nDeviceNum: 142 | print("intput error!") 143 | sys.exit() 144 | 145 | # ch:创建相机实例 | en:Creat Camera Object 146 | cam = MvCamera() 147 | 148 | # ch:选择设备并创建句柄 | en:Select device and create handle 149 | stDeviceList = cast(deviceList.pDeviceInfo[int(nConnectionNum)], POINTER(MV_CC_DEVICE_INFO)).contents 150 | 151 | ret = cam.MV_CC_CreateHandle(stDeviceList) 152 | if ret != 0: 153 | print("create handle fail! ret[0x%x]" % ret) 154 | sys.exit() 155 | 156 | # ch:打开设备 | en:Open device 157 | ret = cam.MV_CC_OpenDevice(MV_ACCESS_Exclusive, 0) 158 | if ret != 0: 159 | print("open device fail! ret[0x%x]" % ret) 160 | sys.exit() 161 | 162 | # ch:探测网络最佳包大小(只对GigE相机有效) | en:Detection network optimal package size(It only works for the GigE camera) 163 | if stDeviceList.nTLayerType == MV_GIGE_DEVICE: 164 | nPacketSize = cam.MV_CC_GetOptimalPacketSize() 165 | if int(nPacketSize) > 0: 166 | ret = cam.MV_CC_SetIntValue("GevSCPSPacketSize", nPacketSize) 167 | if ret != 0: 168 | print("Warning: Set Packet Size fail! ret[0x%x]" % ret) 169 | else: 170 | print("Warning: Get Packet Size fail! ret[0x%x]" % nPacketSize) 171 | 172 | # ch:设置触发模式为off | en:Set trigger mode as off 173 | ret = cam.MV_CC_SetEnumValue("TriggerMode", MV_TRIGGER_MODE_OFF) 174 | if ret != 0: 175 | print("set trigger mode fail! ret[0x%x]" % ret) 176 | sys.exit() 177 | 178 | # ch:获取数据包大小 | en:Get payload size 179 | stParam = MVCC_INTVALUE() 180 | memset(byref(stParam), 0, sizeof(MVCC_INTVALUE)) 181 | 182 | ret = cam.MV_CC_GetIntValue("PayloadSize", stParam) 183 | if ret != 0: 184 | print("get payload size fail! ret[0x%x]" % ret) 185 | sys.exit() 186 | nPayloadSize = stParam.nCurValue 187 | 188 | # ch:开始取流 | en:Start grab image 189 | ret = cam.MV_CC_StartGrabbing() 190 | if ret != 0: 191 | print("start grabbing fail! ret[0x%x]" % ret) 192 | sys.exit() 193 | 194 | stDeviceList = MV_FRAME_OUT_INFO_EX() 195 | memset(byref(stDeviceList), 0, sizeof(stDeviceList)) 196 | data_buf = (c_ubyte * nPayloadSize)() 197 | count = 0 198 | while True: 199 | ret = cam.MV_CC_GetOneFrameTimeout(byref(data_buf), nPayloadSize, stDeviceList, 1000) 200 | if ret == 0: 201 | # print ("get one frame: Width[%d], Height[%d], nFrameNum[%d]" % (stDeviceList.nWidth, stDeviceList.nHeight, stDeviceList.nFrameNum)) 202 | count += 1 203 | nRGBSize = stDeviceList.nWidth * stDeviceList.nHeight * 3 204 | stConvertParam = MV_CC_PIXEL_CONVERT_PARAM() 205 | memset(byref(stConvertParam), 0, sizeof(stConvertParam)) 206 | stConvertParam.nWidth = stDeviceList.nWidth 207 | stConvertParam.nHeight = stDeviceList.nHeight 208 | stConvertParam.pSrcData = data_buf 209 | stConvertParam.nSrcDataLen = stDeviceList.nFrameLen 210 | stConvertParam.enSrcPixelType = stDeviceList.enPixelType 211 | stConvertParam.enDstPixelType = PixelType_Gvsp_RGB8_Packed 212 | stConvertParam.pDstBuffer = (c_ubyte * nRGBSize)() 213 | stConvertParam.nDstBufferSize = nRGBSize 214 | 215 | ret = cam.MV_CC_ConvertPixelType(stConvertParam) 216 | if ret != 0: 217 | # print ("convert pixel fail! ret[0x%x]" % ret) 218 | del data_buf 219 | sys.exit() 220 | 221 | # file_path = "AfterConvert_RGB.raw" 222 | # file_open = open(file_path.encode('ascii'), 'wb+') 223 | try: 224 | # cap = cv2.VideoCapture("0") 225 | 226 | img_buff = (c_ubyte * stConvertParam.nDstLen)() 227 | cdll.msvcrt.memcpy(byref(img_buff), stConvertParam.pDstBuffer, stConvertParam.nDstLen) 228 | b = numpy.array(img_buff) 229 | c = b.reshape(2048, 2448, 3) 230 | self.changePixmap.emit(c) # 理解发射,我触发changepixmap的目的是setimage ,但是我没有参数,所以需要信号先带去收集一个参数 231 | if self.detect == 1: 232 | # img = numpy.zeros(c.shape) 233 | img = c.copy() 234 | image = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB)) 235 | m = self.de.infer(image) 236 | imgResult = cv2.cvtColor(numpy.asarray(m), cv2.COLOR_RGB2BGR) 237 | print("return results") 238 | self.detectPixmap.emit(imgResult) 239 | 240 | # name = './result/'+str(count)+'.jpg' 241 | # count+=1 242 | # cv2.imwrite(name,c) 243 | # file_open.write(img_buff) 244 | except: 245 | raise Exception("save file executed failed:%s" % e.message) 246 | 247 | # file_open.close() 248 | else: 249 | print("get one frame fail, ret[0x%x]" % ret) 250 | 251 | # print ("convert pixeltype succeed!") 252 | 253 | # print ("press a key to continue.") 254 | # msvcrt.getch() 255 | 256 | # ch:停止取流 | en:Stop grab image 257 | ret = cam.MV_CC_StopGrabbing() 258 | if ret != 0: 259 | print("stop grabbing fail! ret[0x%x]" % ret) 260 | del data_buf 261 | sys.exit() 262 | 263 | # ch:关闭设备 | Close device 264 | ret = cam.MV_CC_CloseDevice() 265 | if ret != 0: 266 | print("close deivce fail! ret[0x%x]" % ret) 267 | del data_buf 268 | sys.exit() 269 | 270 | # ch:销毁句柄 | Destroy handle 271 | ret = cam.MV_CC_DestroyHandle() 272 | if ret != 0: 273 | print("destroy handle fail! ret[0x%x]" % ret) 274 | del data_buf 275 | sys.exit() 276 | 277 | del data_buf 278 | 279 | def setDetect(self): 280 | self.detect = 1 281 | 282 | 283 | if __name__ == '__main__': 284 | app = QApplication(sys.argv) 285 | main = MainWindow() 286 | main.show() 287 | sys.exit(app.exec_()) 288 | 289 | -------------------------------------------------------------------------------- /model/__model__: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/model/__model__ -------------------------------------------------------------------------------- /model/__params__: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/model/__params__ -------------------------------------------------------------------------------- /pic/2-result.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/pic/2-result.jpg -------------------------------------------------------------------------------- /pic/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzl19940819/Paddle_infer_python/11af1e28e95fee38dd4a4c13782d8a4c2136657e/pic/2.jpg -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | paddlepaddle -------------------------------------------------------------------------------- /ui-main.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1120 10 | 865 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 40 21 | 10 22 | 111 23 | 41 24 | 25 | 26 | 27 | 打开相机 28 | 29 | 30 | 31 | 32 | 33 | 210 34 | 10 35 | 141 36 | 41 37 | 38 | 39 | 40 | 执行检测 41 | 42 | 43 | 44 | 45 | 46 | 70 47 | 300 48 | 441 49 | 421 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 590 60 | 300 61 | 441 62 | 421 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 0 74 | 0 75 | 1120 76 | 26 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /ui_main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'ui-main.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.13.0 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_MainWindow(object): 14 | def setupUi(self, MainWindow): 15 | MainWindow.setObjectName("MainWindow") 16 | MainWindow.resize(1120, 865) 17 | self.centralwidget = QtWidgets.QWidget(MainWindow) 18 | self.centralwidget.setObjectName("centralwidget") 19 | self.pushButton = QtWidgets.QPushButton(self.centralwidget) 20 | self.pushButton.setGeometry(QtCore.QRect(40, 10, 111, 41)) 21 | self.pushButton.setObjectName("pushButton") 22 | self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) 23 | self.pushButton_2.setGeometry(QtCore.QRect(210, 10, 141, 41)) 24 | self.pushButton_2.setObjectName("pushButton_2") 25 | self.label = QtWidgets.QLabel(self.centralwidget) 26 | self.label.setGeometry(QtCore.QRect(70, 300, 441, 421)) 27 | self.label.setObjectName("label") 28 | self.label_2 = QtWidgets.QLabel(self.centralwidget) 29 | self.label_2.setGeometry(QtCore.QRect(590, 300, 441, 421)) 30 | self.label_2.setObjectName("label_2") 31 | MainWindow.setCentralWidget(self.centralwidget) 32 | self.menubar = QtWidgets.QMenuBar(MainWindow) 33 | self.menubar.setGeometry(QtCore.QRect(0, 0, 1120, 26)) 34 | self.menubar.setObjectName("menubar") 35 | MainWindow.setMenuBar(self.menubar) 36 | self.statusbar = QtWidgets.QStatusBar(MainWindow) 37 | self.statusbar.setObjectName("statusbar") 38 | MainWindow.setStatusBar(self.statusbar) 39 | 40 | self.retranslateUi(MainWindow) 41 | QtCore.QMetaObject.connectSlotsByName(MainWindow) 42 | 43 | def retranslateUi(self, MainWindow): 44 | _translate = QtCore.QCoreApplication.translate 45 | MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) 46 | self.pushButton.setText(_translate("MainWindow", "打开相机")) 47 | self.pushButton_2.setText(_translate("MainWindow", "执行检测")) 48 | self.label.setText(_translate("MainWindow", "TextLabel")) 49 | self.label_2.setText(_translate("MainWindow", "TextLabel")) 50 | 51 | if __name__ == "__main__": 52 | import sys 53 | app = QtWidgets.QApplication(sys.argv) 54 | MainWindow = QtWidgets.QMainWindow() 55 | ui = Ui_MainWindow() 56 | ui.setupUi(MainWindow) 57 | MainWindow.show() 58 | sys.exit(app.exec_()) 59 | --------------------------------------------------------------------------------