38 #if defined(__i386) || defined(__i386__) || defined(_M_IX86) 39 #define EXPECTED_VERSION_MAJOR 4 40 #define EXPECTED_VERSION_MINOR 60 41 #define EXPECTED_VERSION_BUILD 5 42 #if UEYE_VERSION_CODE != UEYE_VERSION(EXPECTED_VERSION_MAJOR, EXPECTED_VERSION_MINOR, 0) 43 #warning Expected ueye driver version 4.60.x. Different version found in ueye.h. 45 #elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) 46 #define EXPECTED_VERSION_MAJOR 4 47 #define EXPECTED_VERSION_MINOR 60 48 #define EXPECTED_VERSION_BUILD 5 49 #if UEYE_VERSION_CODE != UEYE_VERSION(EXPECTED_VERSION_MAJOR, EXPECTED_VERSION_MINOR, 0) 50 #warning Expected ueye driver version 4.60.x. Different version found in ueye.h. 52 #elif defined(__arm__) || defined(__TARGET_ARCH_ARM) 53 #define EXPECTED_VERSION_MAJOR 4 54 #define EXPECTED_VERSION_MINOR 60 55 #define EXPECTED_VERSION_BUILD 0 56 #if UEYE_VERSION_CODE != UEYE_VERSION(EXPECTED_VERSION_MAJOR, EXPECTED_VERSION_MINOR, 0) 57 #warning Expected ueye driver version 4.60.x. Different version found in ueye.h. 59 #elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) 60 #define EXPECTED_VERSION_MAJOR 0 61 #define EXPECTED_VERSION_MINOR 0 62 #define EXPECTED_VERSION_BUILD 0 63 #warning Architecture ia64 not explicitly supported. 64 #elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) || defined(_M_MPPC) || defined(_M_PPC) 65 #define EXPECTED_VERSION_MAJOR 0 66 #define EXPECTED_VERSION_MINOR 0 67 #define EXPECTED_VERSION_BUILD 0 68 #warning Architecture ppc not explicitly supported. 70 #define EXPECTED_VERSION_MAJOR 0 71 #define EXPECTED_VERSION_MINOR 0 72 #define EXPECTED_VERSION_BUILD 0 73 #warning Architecture not explicitly supported. Supported: amd64, i386, arm. 106 #define STR_HELPER(x) #x 107 #define STR(x) STR_HELPER(x) 111 build = is_GetDLLVersion();
112 major = (build >> 24) & 0x000000FF;
113 minor = (build >> 16) & 0x000000FF;
134 UEYE_CAMERA_LIST *list = (UEYE_CAMERA_LIST *)malloc(
sizeof(DWORD) + num *
sizeof(UEYE_CAMERA_INFO));
136 if (is_GetCameraList(list) == IS_SUCCESS) {
140 for (
int i = 0; i < num; i++) {
141 serial[i] = atoll(list->uci[i].SerNo);
142 dev_id[i] = list->uci[i].dwDeviceID;
189 std::vector<unsigned int> serial;
190 std::vector<unsigned int> dev_id;
192 for (
unsigned int i = 0; i < num; i++) {
193 if (serial[i] == serial_number) {
232 checkError(is_Exposure(
cam_, IS_EXPOSURE_CMD_GET_EXPOSURE, &time_ms,
sizeof(
double)));
242 return (
TriggerMode)is_SetExternalTrigger(
cam_, IS_GET_EXTERNALTRIGGER);
246 return (
TriggerMode)is_SetExternalTrigger(
cam_, IS_GET_SUPPORTED_TRIGGER_MODE);
253 if (is_SetColorMode(
cam_, mode) != IS_SUCCESS) {
255 is_SetColorMode(
cam_, mode);
264 double param1 = *enable ? 1.0 : 0.0;
266 if (IS_SUCCESS != is_SetAutoParameter(
cam_, IS_SET_ENABLE_AUTO_SHUTTER, ¶m1, ¶m2)) {
268 is_SetAutoParameter(
cam_, IS_SET_ENABLE_AUTO_SHUTTER, ¶m1, ¶m2);
277 checkError(is_Exposure(
cam_, IS_EXPOSURE_CMD_SET_EXPOSURE, time_ms,
sizeof(
double)));
284 if (IS_SUCCESS != is_SetHardwareGamma(
cam_, IS_SET_HW_GAMMA_ON)) {
285 is_SetHardwareGamma(
cam_, IS_SET_HW_GAMMA_OFF);
289 is_SetHardwareGamma(
cam_, IS_SET_HW_GAMMA_OFF);
295 if (
zoom_ != *zoom) {
297 is_SetSubSampling(
cam_, 0);
298 is_SetBinning(
cam_, 0);
302 is_SetSubSampling(
cam_, 0);
304 is_SetBinning(
cam_, 0);
310 is_HotPixel(
cam_, IS_HOTPIXEL_ENABLE_CAMERA_CORRECTION, NULL, 0);
318 int pixelClockList[150];
319 int numberOfSupportedPixelClocks = 0;
320 checkError(is_PixelClock(
cam_, IS_PIXELCLOCK_CMD_GET_NUMBER, &numberOfSupportedPixelClocks,
sizeof(numberOfSupportedPixelClocks)));
321 if(numberOfSupportedPixelClocks > 0) {
322 memset(pixelClockList, 0x00,
sizeof(pixelClockList));
323 checkError(is_PixelClock(
cam_, IS_PIXELCLOCK_CMD_GET_LIST, pixelClockList, numberOfSupportedPixelClocks *
sizeof(
int)));
325 int minPixelClock = pixelClockList[0];
326 int maxPixelClock = pixelClockList[numberOfSupportedPixelClocks-1];
329 for(
int i = 0; i < numberOfSupportedPixelClocks; i++) {
330 if(*MHz <= pixelClockList[i]) {
331 *MHz = pixelClockList[i];
336 if (*MHz < minPixelClock) {
337 *MHz = minPixelClock;
339 if (*MHz > maxPixelClock) {
340 *MHz = maxPixelClock;
343 checkError(is_PixelClock(
cam_, IS_PIXELCLOCK_CMD_SET, MHz,
sizeof(
int)));
356 if (is_SetGainBoost(
cam_, IS_GET_SUPPORTED_GAINBOOST) == IS_SET_GAINBOOST_ON) {
358 is_SetGainBoost(
cam_, IS_SET_GAINBOOST_ON);
360 is_SetGainBoost(
cam_, IS_SET_GAINBOOST_OFF);
361 gain_boost_ = is_SetGainBoost(
cam_, IS_GET_GAINBOOST) == IS_SET_GAINBOOST_ON;
369 double param1 = *enable ? 1.0 : 0.0;
371 if (IS_SUCCESS != is_SetAutoParameter(
cam_, IS_SET_ENABLE_AUTO_GAIN, ¶m1, ¶m2)) {
373 is_SetAutoParameter(
cam_, IS_SET_ENABLE_AUTO_GAIN, ¶m1, ¶m2);
392 if (is_SetExternalTrigger(
cam_, mode) == IS_SUCCESS) {
420 checkError(is_IO(
cam_, IS_IO_CMD_FLASH_SET_MODE, (
void*)&m,
sizeof(m)));
425 int num_mode = int(mode);
427 checkError(is_IO(
cam_, IS_IO_CMD_FLASH_SET_MODE, (
void*)&num_mode,
sizeof(num_mode)));
430 IO_FLASH_PARAMS params;
431 memset(¶ms, 0,
sizeof(params));
433 params.s32Delay = delay_usec;
434 params.u32Duration = duration_usec;
436 checkError(is_IO(
cam_, IS_IO_CMD_FLASH_SET_PARAMS, ¶ms,
sizeof(params)));
450 IO_FLASH_PARAMS params;
451 checkError(is_IO(
cam_, IS_IO_CMD_FLASH_GET_GLOBAL_PARAMS, (
void*)¶ms,
sizeof(params)));
452 checkError(is_IO(
cam_, IS_IO_CMD_FLASH_APPLY_GLOBAL_PARAMS, NULL, 0));
463 return is_ForceTrigger(
cam_) == IS_SUCCESS;
472 param = IS_SUBSAMPLING_2X_VERTICAL | IS_SUBSAMPLING_2X_HORIZONTAL;
475 param = IS_SUBSAMPLING_3X_VERTICAL | IS_SUBSAMPLING_3X_HORIZONTAL;
478 param = IS_SUBSAMPLING_4X_VERTICAL | IS_SUBSAMPLING_4X_HORIZONTAL;
481 param = IS_SUBSAMPLING_5X_VERTICAL | IS_SUBSAMPLING_5X_HORIZONTAL;
484 param = IS_SUBSAMPLING_6X_VERTICAL | IS_SUBSAMPLING_6X_HORIZONTAL;
489 param = IS_SUBSAMPLING_8X_VERTICAL | IS_SUBSAMPLING_8X_HORIZONTAL;
500 param = IS_SUBSAMPLING_16X_VERTICAL | IS_SUBSAMPLING_16X_HORIZONTAL;
504 param = IS_SUBSAMPLING_DISABLE;
514 param = IS_BINNING_2X_VERTICAL | IS_BINNING_2X_HORIZONTAL;
517 param = IS_BINNING_3X_VERTICAL | IS_BINNING_3X_HORIZONTAL;
520 param = IS_BINNING_4X_VERTICAL | IS_BINNING_4X_HORIZONTAL;
523 param = IS_BINNING_5X_VERTICAL | IS_BINNING_5X_HORIZONTAL;
526 param = IS_BINNING_6X_VERTICAL | IS_BINNING_6X_HORIZONTAL;
531 param = IS_BINNING_8X_VERTICAL | IS_BINNING_8X_HORIZONTAL;
542 param = IS_BINNING_16X_VERTICAL | IS_BINNING_16X_HORIZONTAL;
546 param = IS_BINNING_DISABLE;
599 for (
int i = 0; i < size; i++) {
611 for (
int i = 0; i <
img_mem_.size(); i++) {
631 bool capture =
false;
632 for (
int i = 0; i < 20; ++i) {
633 if (is_CaptureVideo(
cam_, IS_DONT_WAIT) == IS_SUCCESS) {
668 throw uEyeException(-1,
"Unsupported color mode when initializing image header.");
676 if (is_WaitEvent(
cam_, IS_SET_EVENT_FRAME, (
int)(2000 /
frame_rate_)) == IS_SUCCESS) {
677 if (is_GetImageMem(
cam_, (
void**)&img_mem) == IS_SUCCESS) {
678 callback(img_mem, size);
unsigned int getHardwareGain()
void flashUpdateGlobalParams()
boost::function< void(const char *, size_t)> CamCaptureCB
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val)
void setFlash(FlashMode mode, int delay_usec, unsigned int duration_usec)
void setHardwareGain(int *gain)
TriggerMode getTriggerMode()
std::vector< char * > img_mem_
#define EXPECTED_VERSION_BUILD
void captureThread(CamCaptureCB callback)
static const char * colorModeToString(uEyeColor mode)
volatile bool stop_capture_
int getBinningParam(int *scale)
bool flash_global_params_
void setAutoGain(bool *enable)
bool setTriggerMode(TriggerMode mode)
unsigned int getSerialNumberList(std::vector< unsigned int > &serial, std::vector< unsigned int > &dev_id)
void setTriggerDelay(int delay_usec)
void setHardwareGamma(bool *enable)
#define EXPECTED_VERSION_MAJOR
void setAutoExposure(bool *enable)
void initMemoryPool(int size)
void initPrivateVariables()
bool openCameraDevId(unsigned int id)
std::vector< int > img_mem_id_
void setGainBoost(bool *enable)
int getNumberOfCameras() const
void startVideoCapture(CamCaptureCB)
void setPixelClock(int *MHz)
#define EXPECTED_VERSION_MINOR
void setFlashWithGlobalParams(FlashMode mode)
void setColorMode(uEyeColor mode)
TriggerMode getSupportedTriggers()
void setFrameRate(double *rate)
int getSubsampleParam(int *scale)
bool openCameraSerNo(unsigned int serial_number)
void setExposure(double *time_ms)
static bool checkVersion(int &major, int &minor, int &build, const char *&expected)
void checkError(INT err) const
void restartVideoCapture()
bool openCameraCamId(unsigned int id)
unsigned int serial_number_
CamCaptureCB stream_callback_