Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 19,666 Bytes
13170f7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | import ctypes
from . import eve_sdk_structs as structs
EveProcessingCallbackFn = ctypes.CFUNCTYPE(None, ctypes.POINTER(structs.EveProcessingCallbackReturnData))
class EveSDK:
def __init__(self, dll_path: str):
self.cdll = ctypes.CDLL(dll_path)
# EveCamera.h
self.cdll.EveGetFormats.restype = structs.EveCameraFormats
self.cdll.EveGetFormats.argtypes = [ctypes.c_uint, structs.CCameraFormat]
self.cdll.EveGetCamera.restype = structs.EveCamera
self.cdll.EveGetCamera.argtypes = [ctypes.c_uint]
self.cdll.EveSetCamera.restype = structs.EveError
self.cdll.EveSetCamera.argtypes = [ctypes.c_uint, structs.CCameraFormat]
self.cdll.EveGetNumberOfCameras.restype = structs.EveNumberOfCameras
self.cdll.EveGetNumberOfCameras.argtypes = []
self.cdll.EveGetMonitors.restype = structs.EveMonitors
self.cdll.EveGetMonitors.argtypes = []
self.cdll.EveChangeCameraLocation.restype = structs.EveCameraLocation
self.cdll.EveChangeCameraLocation.argtypes = [structs.EveCameraLocation]
self.cdll.EveGetLiveCameraParameters.restype = structs.EveCameraParameters
self.cdll.EveGetLiveCameraParameters.argtypes = []
# EveControlInterface.h
self.cdll.CreateEve.restype = structs.EveError
self.cdll.CreateEve.argtypes = [structs.EveStartupParameters]
self.cdll.EveRegisterDataCallback.restype = structs.EveError
self.cdll.EveRegisterDataCallback.argtypes = [EveProcessingCallbackFn]
self.cdll.StartEve.restype = structs.EveError
self.cdll.StartEve.argtypes = []
self.cdll.StartEveWithParameters.restype = structs.EveError
self.cdll.StartEveWithParameters.argtypes = [structs.EveProcessingParameters]
self.cdll.EveSendImageForProcessing.restype = structs.EveError
self.cdll.EveSendImageForProcessing.argtypes = [structs.EveInputImage]
self.cdll.EveSendImageForProcessingWithParams.restype = structs.EveError
self.cdll.EveSendImageForProcessingWithParams.argtypes = [structs.EveInputImage, structs.CCameraParameters]
self.cdll.ShutdownEve.restype = structs.EveError
self.cdll.ShutdownEve.argtypes = []
self.cdll.EveCheckForLicense.restype = structs.EveLicenseResult
self.cdll.EveCheckForLicense.argtypes = []
self.cdll.EveResetPipeline.restype = structs.EveError
self.cdll.EveResetPipeline.argtypes = []
# EveKarolinska.h
self.cdll.EveConfigureKarolinska.restype = structs.EveKarolinskaOptions
self.cdll.EveConfigureKarolinska.argtypes = [structs.EveKarolinskaOptions]
self.cdll.EveGetKarolinskaData.restype = structs.EveKarolinskaData
self.cdll.EveGetKarolinskaData.argtypes = []
# EveFaceId.h
self.cdll.EveConfigureFaceId.restype = structs.EveFaceIdOptions
self.cdll.EveConfigureFaceId.argtypes = [structs.EveFaceIdOptions]
self.cdll.EveFaceIdCalibrateCurrent.restype = structs.EveError
self.cdll.EveFaceIdCalibrateCurrent.argtypes = []
self.cdll.EveFaceIdCalibrateNew.restype = structs.EveError
self.cdll.EveFaceIdCalibrateNew.argtypes = []
self.cdll.EveFaceIdForceIdentify.restype = structs.EveError
self.cdll.EveFaceIdForceIdentify.argtypes = []
self.cdll.EveFaceIdRemoveCurrent.restype = structs.EveError
self.cdll.EveFaceIdRemoveCurrent.argtypes = []
self.cdll.EveFaceIdRemoveAll.restype = structs.EveError
self.cdll.EveFaceIdRemoveAll.argtypes = []
self.cdll.EveFaceIdReloadGallery.restype = structs.EveError
self.cdll.EveFaceIdReloadGallery.argtypes = []
self.cdll.EveFaceIdCommandWaiting.restype = ctypes.c_uint
self.cdll.EveFaceIdCommandWaiting.argtypes = []
self.cdll.EveGetFaceIdData.restype = structs.EveFaceIdData
self.cdll.EveGetFaceIdData.argtypes = []
self.cdll.EveSendFaceIdCommand.restype = structs.EveFaceIdCommandStruct
self.cdll.EveSendFaceIdCommand.argtypes = [structs.EveFaceIdCommandStruct]
# EveFaceTracker.h
self.cdll.EveConfigureFaceTracker.restype = structs.EveFaceTrackerOptions
self.cdll.EveConfigureFaceTracker.argtypes = [structs.EveFaceTrackerOptions]
self.cdll.EveGetEyesData.restype = structs.EveEyes
self.cdll.EveGetEyesData.argtypes = []
self.cdll.EveGetPupilsData.restype = structs.EvePupils
self.cdll.EveGetPupilsData.argtypes = []
self.cdll.EveGetAllFaceData.restype = structs.EveAllFacesData
self.cdll.EveGetAllFaceData.argtypes = []
# EveFpga.h
self.cdll.EveConfigureFpga.restype = structs.EveFpgaOptions
self.cdll.EveConfigureFpga.argtypes = [structs.EveFpgaOptions]
self.cdll.EveConfigureFpgaDebug.restype = structs.EveFpgaDebugOptions
self.cdll.EveConfigureFpgaDebug.argtypes = [structs.EveFpgaDebugOptions]
self.cdll.QueryFpgaSetting.restype = structs.EveError
self.cdll.QueryFpgaSetting.argtypes = [structs.pipeline_config_t, ctypes.c_bool]
self.cdll.QueryFpgaSettings.restype = structs.EveError
self.cdll.QueryFpgaSettings.argtypes = [ctypes.c_uint16, ctypes.c_uint32, ctypes.c_bool]
self.cdll.SendSetSetting.restype = structs.EveError
self.cdll.SendSetSetting.argtypes = [structs.pipeline_config_t]
self.cdll.PopQueuedSetting.restype = structs.CFpgaGetSetting
self.cdll.PopQueuedSetting.argtypes = []
self.cdll.EveGetFpgaData.restype = structs.EveFpgaData
self.cdll.EveGetFpgaData.argtypes = []
self.cdll.FpgaReadJson.restype = structs.EveFpgaJsonMetadata
self.cdll.FpgaReadJson.argtypes = []
self.cdll.FpgaReadData.restype = structs.EveFpgaData
self.cdll.FpgaReadData.argtypes = []
self.cdll.EveSendImageForProcessingWithFpgaData.restype = structs.EveError
self.cdll.EveSendImageForProcessingWithFpgaData.argtypes = [structs.EveInputImage, structs.EveFpgaManualData]
# EveImageManipulation.h
self.cdll.EveConfigureImageManipulation.restype = structs.EveImageManipulationOptions
self.cdll.EveConfigureImageManipulation.argtypes = [structs.EveImageManipulationOptions]
# EveImage.h
self.cdll.EveGetProcessedImage.restype = structs.EveProcessedImage
self.cdll.EveGetProcessedImage.argtypes = []
self.cdll.EveGetProcessedFrameTime.restype = structs.EveProcessedFrameTime
self.cdll.EveGetProcessedFrameTime.argtypes = []
self.cdll.EveConfigureProcessedImage.restype = structs.EveImageFormatRequest
self.cdll.EveConfigureProcessedImage.argtypes = [structs.EveImageFormatRequest]
self.cdll.EveConfigureRawImage.restype = structs.EveRawImageRequest
self.cdll.EveConfigureRawImage.argtypes = [structs.EveRawImageRequest]
self.cdll.EveGetRawImage.restype = structs.EveProcessedImage
self.cdll.EveGetRawImage.argtypes = []
self.cdll.EveGetJsonData.restype = structs.EveJsonData
self.cdll.EveGetJsonData.argtypes = []
# EveObjectDetection.h
self.cdll.EveConfigureObjectDetection.restype = structs.EveObjectDetectionOptions
self.cdll.EveConfigureObjectDetection.argtypes = [structs.EveObjectDetectionOptions]
self.cdll.EveGetDefaultObjectDetectionOptions.restype = structs.EveObjectDetectionOptions
self.cdll.EveGetDefaultObjectDetectionOptions.argtypes = []
self.cdll.EveConfigurePersonDetection.restype = structs.EvePersonDetectionOptions
self.cdll.EveConfigurePersonDetection.argtypes = [structs.EvePersonDetectionOptions]
self.cdll.EveGetObjectDetectionData.restype = structs.EveDetectionData
self.cdll.EveGetObjectDetectionData.argtypes = []
self.cdll.EveCopyObjectDetectionData.restype = structs.EveDetectionData
self.cdll.EveCopyObjectDetectionData.argtypes = []
self.cdll.EveGetPersonDetectionData.restype = structs.EveDetectionData
self.cdll.EveGetPersonDetectionData.argtypes = []
self.cdll.EveCopyPersonDetectionData.restype = structs.EveDetectionData
self.cdll.EveCopyPersonDetectionData.argtypes = []
self.cdll.DeleteDetectionData.restype = structs.EveError
self.cdll.DeleteDetectionData.argtypes = [structs.EveDetectionData]
# EveROI.h
self.cdll.EveConfigureROIs.restype = structs.EveROIOptions
self.cdll.EveConfigureROIs.argtypes = [structs.EveROIOptions]
self.cdll.EveGetROIScoreData.restype = structs.EveROIScoreData
self.cdll.EveGetROIScoreData.argtypes = []
# EveHandGesture.h
self.cdll.EveConfigureHandGesture.restype = structs.EveHandGestureOptions
self.cdll.EveConfigureHandGesture.argtypes = [structs.EveHandGestureOptions]
self.cdll.EveGetHandGestureData.restype = structs.EveHandGestureData
self.cdll.EveGetHandGestureData.argtypes = []
self.cdll.EveCopyHandGestureData.restype = structs.EveHandGestureData
self.cdll.EveCopyHandGestureData.argtypes = []
self.cdll.EveDeleteHandGestureData.restype = structs.EveError
self.cdll.EveDeleteHandGestureData.argtypes = [structs.EveHandGestureData]
self.cdll.EveGetStaticGestureDetections.restype = structs.EveStaticGestureData
self.cdll.EveGetStaticGestureDetections.argtypes = []
self.cdll.EveGetStaticGestureDefinitions.restype = structs.EveStaticGestureDefinitions
self.cdll.EveGetStaticGestureDefinitions.argtypes = []
self.cdll.EveAddStaticGesture.restype = structs.EveError
self.cdll.EveAddStaticGesture.argtypes = [structs.EveStaticGestureDefinition]
self.cdll.EveDeleteStaticGesture.restype = structs.EveError
self.cdll.EveDeleteStaticGesture.argtypes = [structs.EveStaticGestureDefinition]
# EveAlgorithm.h
self.cdll.EveGetAlgorithms.restype = structs.EveSupportedAlgorithms
self.cdll.EveGetAlgorithms.argtypes = []
# EveTiming.h
self.cdll.EveGetTimingInformation.restype = structs.EveTiming
self.cdll.EveGetTimingInformation.argtypes = []
# EveCamera.h
def EveGetFormats(self, cameraId: ctypes.c_uint, filter: structs.CCameraFormat) -> structs.EveCameraFormats:
return self.cdll.EveGetFormats(cameraId, filter)
def EveGetCamera(self, cameraId: ctypes.c_uint) -> structs.EveCamera:
return self.cdll.EveGetCamera(cameraId)
def EveSetCamera(self, cameraId: ctypes.c_uint, filter: structs.CCameraFormat) -> structs.EveError:
return self.cdll.EveSetCamera(cameraId, filter)
def EveGetNumberOfCameras(self) -> structs.EveNumberOfCameras:
return self.cdll.EveGetNumberOfCameras()
def EveGetMonitors(self) -> structs.EveMonitors:
return self.cdll.EveGetMonitors()
def EveChangeCameraLocation(self, location: structs.EveCameraLocation) -> structs.EveCameraLocation:
return self.cdll.EveChangeCameraLocation(location)
def EveGetLiveCameraParameters(self) -> structs.EveCameraParameters:
return self.cdll.EveGetLiveCameraParameters()
# EveControlInterface.h
def CreateEve(self, options: structs.EveStartupParameters) -> structs.EveError:
return self.cdll.CreateEve(options)
def EveRegisterDataCallback(self, callback) -> structs.EveError:
return self.cdll.EveRegisterDataCallback(callback)
def StartEve(self) -> structs.EveError:
return self.cdll.StartEve()
def StartEveWithParameters(self, parameters: structs.EveProcessingParameters) -> structs.EveError:
return self.cdll.StartEveWithParameters(parameters)
def EveSendImageForProcessing(self, image: structs.EveInputImage) -> structs.EveError:
return self.cdll.EveSendImageForProcessing(image)
def EveSendImageForProcessingWithParams(self, image: structs.EveInputImage, params: structs.CCameraParameters) -> structs.EveError:
return self.cdll.EveSendImageForProcessingWithParams(image, params)
def EveSendImageForProcessingWithFpgaData(self, image: structs.EveInputImage, data: structs.EveFpgaManualData) -> structs.EveError:
return self.cdll.EveSendImageForProcessingWithFpgaData(image, data)
def ShutdownEve(self) -> structs.EveError:
return self.cdll.ShutdownEve()
def EveCheckForLicense(self) -> structs.EveLicenseResult:
return self.cdll.EveCheckForLicense()
def EveResetPipeline(self) -> structs.EveError:
return self.cdll.EveResetPipeline()
# EveFaceId.h
def EveConfigureFaceId(self, options: structs.EveFaceIdOptions) -> structs.EveFaceIdOptions:
return self.cdll.EveConfigureFaceId(options)
def EveFaceIdCalibrateCurrent(self) -> structs.EveError:
return self.cdll.EveFaceIdCalibrateCurrent()
def EveFaceIdCalibrateNew(self) -> structs.EveError:
return self.cdll.EveFaceIdCalibrateNew()
def EveFaceIdForceIdentify(self) -> structs.EveError:
return self.cdll.EveFaceIdForceIdentify()
def EveFaceIdRemoveCurrent(self) -> structs.EveError:
return self.cdll.EveFaceIdRemoveCurrent()
def EveFaceIdRemoveAll(self) -> structs.EveError:
return self.cdll.EveFaceIdRemoveAll()
def EveFaceIdReloadGallery(self) -> structs.EveError:
return self.cdll.EveFaceIdReloadGallery()
def EveFaceIdCommandWaiting(self) -> ctypes.c_uint:
return self.cdll.EveFaceIdCommandWaiting()
def EveGetFaceIdData(self) -> structs.EveFaceIdData:
return self.cdll.EveGetFaceIdData()
def EveSendFaceIdCommand(self, command: structs.EveFaceIdCommandStruct) -> structs.EveFaceIdCommandStruct:
return self.cdll.EveSendFaceIdCommand(command)
# EveFaceTracker.h
def EveConfigureFaceTracker(self, options: structs.EveFaceTrackerOptions) -> structs.EveFaceTrackerOptions:
return self.cdll.EveConfigureFaceTracker(options)
def EveGetEyesData(self) -> structs.EveEyes:
return self.cdll.EveGetEyesData()
def EveGetPupilsData(self) -> structs.EvePupils:
return self.cdll.EveGetPupilsData()
def EveGetAllFaceData(self) -> structs.EveAllFacesData:
return self.cdll.EveGetAllFaceData()
# EveFpga.h
def EveGetFpgaData(self) -> structs.EveFpgaData:
return self.cdll.EveGetFpgaData()
def EveConfigureFpga(self, options: structs.EveFpgaOptions) -> structs.EveFpgaOptions:
return self.cdll.EveConfigureFpga(options)
def EveConfigureFpgaDebug(self, options: structs.EveFpgaDebugOptions) -> structs.EveFpgaDebugOptions:
return self.cdll.EveConfigureFpgaDebug(options)
def QueryFpgaSetting(self, command: structs.pipeline_config_t, notify: ctypes.c_bool) -> structs.EveError:
return self.cdll.QueryFpgaSetting(command, notify)
def QueryFpgaSettings(self, typeMask: ctypes.c_uint16, settingsMask: ctypes.c_uint32, notify: ctypes.c_bool) -> structs.EveError:
return self.cdll.QueryFpgaSettings(typeMask, settingsMask, notify)
def SendSetSetting(self, command: structs.pipeline_config_t) -> structs.EveError:
return self.cdll.SendSetSetting(command)
def PopQueuedSetting(self) -> structs.CFpgaGetSetting:
return self.cdll.PopQueuedSetting()
def FpgaReadJson(self) -> structs.EveFpgaJsonMetadata:
return self.cdll.FpgaReadJson()
def FpgaReadData(self) -> structs.EveFpgaData:
return self.cdll.FpgaReadData()
# EveKarolinska.h
def EveConfigureKarolinska(self, parameters: structs.EveKarolinskaOptions) -> structs.EveKarolinskaOptions:
return self.cdll.EveConfigureKarolinska(parameters)
def EveGetKarolinskaData(self) -> structs.EveKarolinskaData:
return self.cdll.EveGetKarolinskaData()
# EveImageManipulation.h
def EveConfigureImageManipulation(self, options: structs.EveImageManipulationOptions) -> structs.EveImageManipulationOptions:
return self.cdll.EveConfigureImageManipulation(options)
# EveImage.h
def EveGetProcessedImage(self) -> structs.EveProcessedImage:
return self.cdll.EveGetProcessedImage()
def EveGetProcessedFrameTime(self) -> structs.EveProcessedFrameTime:
return self.cdll.EveGetProcessedFrameTime()
def EveConfigureProcessedImage(self, fmt: structs.EveImageFormatRequest) -> structs.EveImageFormatRequest:
return self.cdll.EveConfigureProcessedImage(fmt)
def EveConfigureRawImage(self, fmt: structs.EveRawImageRequest) -> structs.EveRawImageRequest:
return self.cdll.EveConfigureRawImage(fmt)
def EveGetRawImage(self) -> structs.EveProcessedImage:
return self.cdll.EveGetRawImage()
def EveGetJsonData(self) -> structs.EveJsonData:
return self.cdll.EveGetJsonData()
# EveObjectDetection.h
def EveConfigureObjectDetection(self, options: structs.EveObjectDetectionOptions) -> structs.EveObjectDetectionOptions:
return self.cdll.EveConfigureObjectDetection(options)
def EveGetDefaultObjectDetectionOptions(self) -> structs.EveObjectDetectionOptions:
return self.cdll.EveGetDefaultObjectDetectionOptions()
def EveConfigurePersonDetection(self, options: structs.EvePersonDetectionOptions) -> structs.EvePersonDetectionOptions:
return self.cdll.EveConfigurePersonDetection(options)
def EveGetObjectDetectionData(self) -> structs.EveDetectionData:
return self.cdll.EveGetObjectDetectionData()
def EveCopyObjectDetectionData(self) -> structs.EveDetectionData:
return self.cdll.EveCopyObjectDetectionData()
def EveGetPersonDetectionData(self) -> structs.EveDetectionData:
return self.cdll.EveGetPersonDetectionData()
def EveCopyPersonDetectionData(self) -> structs.EveDetectionData:
return self.cdll.EveCopyPersonDetectionData()
def DeleteDetectionData(self, data: structs.EveDetectionData) -> structs.EveError:
return self.cdll.DeleteDetectionData(data)
# EveROI.h
def EveConfigureROIs(self, options: structs.EveROIOptions) -> structs.EveROIOptions:
return self.cdll.EveConfigureROIs(options)
def EveGetROIScoreData(self) -> structs.EveROIScoreData:
return self.cdll.EveGetROIScoreData()
# EveHandGesture.h
def EveConfigureHandGesture(self, options: structs.EveHandGestureOptions) -> structs.EveHandGestureOptions:
return self.cdll.EveConfigureHandGesture(options)
def EveGetHandGestureData(self) -> structs.EveHandGestureData:
return self.cdll.EveGetHandGestureData()
def EveCopyHandGestureData(self) -> structs.EveHandGestureData:
return self.cdll.EveCopyHandGestureData()
def EveDeleteHandGestureData(self, data: structs.EveHandGestureData) -> structs.EveError:
return self.cdll.EveDeleteHandGestureData(data)
def EveGetStaticGestureDetections(self) -> structs.EveStaticGestureData:
return self.cdll.EveGetStaticGestureDetections()
def EveGetStaticGestureDefinitions(self) -> structs.EveStaticGestureDefinitions:
return self.cdll.EveGetStaticGestureDefinitions()
def EveAddStaticGesture(self, definition: structs.EveStaticGestureDefinition) -> structs.EveError:
return self.cdll.EveAddStaticGesture(definition)
def EveDeleteStaticGesture(self, definition: structs.EveStaticGestureDefinition) -> structs.EveError:
return self.cdll.EveDeleteStaticGesture(definition)
# EveAlgorithm.h
def EveGetAlgorithms(self) -> structs.EveSupportedAlgorithms:
return self.cdll.EveGetAlgorithms()
# EveTiming.h
def EveGetTimingInformation(self) -> structs.EveTiming:
return self.cdll.EveGetTimingInformation()
|