Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ueyeclass.cpp
1 // Piranha.cpp: implementation of the CuEye class.
2 //
3 //////////////////////////////////////////////////////////////////////
4 //#include "stdafx.h"
5 
6 #include "ueyeclass.hh"
7 
8 //////////////////////////////////////////////////////////////////////
9 // Construction/Destruction
10 //////////////////////////////////////////////////////////////////////
11 
13 {
14  m_hu = 0;
15 
16 }
17 
18 
20 {
21 }
22 
23 
24 int CuEye::InitCamera (int nId)
25 {
26  int nRet = IS_CANT_OPEN_DEVICE;
27  HIDS hu = (HIDS) nId;
28 
29  if((m_hu == 0))
30  {
31  nRet = is_InitCamera (&hu,0);
32 
33  if (nRet == IS_SUCCESS)
34  {
35  m_hu = hu;
36  // Disable Autoexit
37  is_EnableAutoExit( m_hu, IS_DISABLE_AUTO_EXIT );
38  }
39 
40 
41  }
42 
43 
44  return nRet;
45 }
46 
47 
49 {
50  int nRet = IS_CANT_CLOSE_DEVICE;
51 
52  if(m_hu != 0)
53  {
54  nRet = is_ExitCamera (m_hu);
55  m_hu = 0;
56  }
57 
58  return nRet;
59 }
60 
61 
62 int CuEye::SetErrorReport (int lMode)
63 {
64  return is_SetErrorReport (m_hu, lMode);
65 }
66 
67 
68 int CuEye::GetErrorText (int lErr, char* pcErrText)
69 {
70  return is_GetError(m_hu,&lErr,&pcErrText);
71 }
72 int CuEye::GetNumberOfCameras (int* plNumCameras)
73 {
74  return is_GetNumberOfCameras (plNumCameras);
75 }
76 
77 
78 int CuEye::GetDllVersion (int* plDllVers)
79 {
80  *plDllVers = is_GetDLLVersion();
81  return IS_SUCCESS;
82 }
83 
84 
85 int CuEye::GetPciSlot (int* plSlot)
86 {
87  if(plSlot != 0)
88  *plSlot = 0;
89 
90  return IS_FUNCTION_NOT_SUPPORTED_YET;
91 }
92 
93 
94 int CuEye::GetIRQ (int* plIRQ)
95 {
96  if(plIRQ != 0)
97  *plIRQ = 0;
98 
99  return IS_FUNCTION_NOT_SUPPORTED_YET;
100 }
101 
102 
103 int CuEye::GetColorDepth (int* plBpp, int* plColFormat)
104 {
105  return is_GetColorDepth (m_hu, plBpp, plColFormat);
106 }
107 
108 
109 int CuEye::CameraStatus (int lInfo, long lValue)
110 {
111  return is_CameraStatus (m_hu, lInfo, (ULONG)lValue);
112 }
113 
114 
116 {
117  return is_GetCameraType (m_hu);
118 }
119 
120 
122 {
123  BIASERR("Not longer defined in SDK.");
124  //return is_GetOsVersion ();
125  return -1;
126 }
127 
128 
129 int CuEye::SetBrightness (int lBright)
130 {
131  BIASERR("Not longer defined in SDK.");
132  //return is_SetBrightness (m_hu, lBright);
133  return -1;
134 }
135 
136 
137 int CuEye::SetContrast (int lCont)
138 {
139  BIASERR("Not longer supported in current SDK.");
140  //return is_SetContrast (m_hu, lCont);
141  return -1;
142 }
143 
144 
145 int CuEye::SetGamma (int lGamma)
146 {
147  return is_Gamma(m_hu, IS_GAMMA_CMD_SET, (void *) &lGamma, sizeof(int));
148  //return is_SetGamma (m_hu, lGamma);
149 }
150 
151 
152 int CuEye::SetWhiteBalance( INT nMode )
153 {
154  return is_SetWhiteBalance(m_hu, nMode);
155 }
156 
157 
158 int CuEye::SetWhiteBalanceMultipliers(double dblRed, double dblGreen, double dblBlue )
159 {
160  return is_SetWhiteBalanceMultipliers(m_hu, dblRed, dblGreen, dblBlue);
161 }
162 
163 
164 int CuEye::SetColorMode (int lMode)
165 {
166  return is_SetColorMode (m_hu, lMode);
167 }
168 
169 
170 int CuEye::InitEvent (HANDLE hEv, int nWhich)
171 {
172  return is_InitEvent (m_hu, hEv, nWhich);
173 }
174 
175 
176 int CuEye::EnableEvent (int nWhich)
177 {
178  return is_EnableEvent (m_hu, nWhich);
179 }
180 
181 
182 int CuEye::DisableEvent (int nWhich)
183 {
184  return is_DisableEvent (m_hu, nWhich);
185 }
186 
187 
188 int CuEye::ExitEvent (int nWhich)
189 {
190  return is_ExitEvent (m_hu, nWhich);
191 }
192 
193 
194 int CuEye::EnableMessage (int nWhich, HWND hwnd)
195 {
196  return is_EnableMessage(m_hu, nWhich, hwnd);
197 }
198 
199 
200 int CuEye::EnableAutoExit (int nMode)
201 {
202  return is_EnableAutoExit(m_hu, nMode);
203 }
204 
205 
206 int CuEye::SetImageSize (int lWidth, int lHeight)
207 {
208 
209  IS_RECT rectAOI;
210 
211  rectAOI.s32X = 0;
212  rectAOI.s32Y = 0;
213  rectAOI.s32Width = lWidth;
214  rectAOI.s32Height = lHeight;
215 
216  int nRet = is_AOI(m_hu, IS_AOI_IMAGE_SET_AOI, (void*)&rectAOI, sizeof(rectAOI));
217 
218  return nRet;
219 }
220 
221 
222 int CuEye::SetImagePos (int lPosX, int lPosY)
223 {
224  //BIASERR("Not longer supported in current SDK.");
225  //return is_SetImagePos (m_hu, lPosX, lPosY);
226 
227  IS_POINT_2D p;
228  p.s32X = lPosX;
229  p.s32Y = lPosY;
230 
231  return is_AOI(m_hu, IS_AOI_IMAGE_SET_POS, (void *)&p, sizeof(p));
232  //return -1;
233 }
234 
235 
236 int CuEye::SetDisplayMode (int Mode)
237 {
238  return is_SetDisplayMode (m_hu, Mode);
239 }
240 
241 
242 int CuEye::SetDisplayWindow (HWND hWnd)
243 {
244  return is_SetHwnd (m_hu, hWnd);
245 }
246 
247 
248 int CuEye::SetDisplayKeyColor (int lKeyCol)
249 {
250  BIASERR("Not longer supported in current SDK.");
251  //return is_SetKeyColor (m_hu, (lKeyCol & 0x00FF0000) >> 16, (lKeyCol & 0x0000FF00) >> 8, lKeyCol & 0x000000FF);
252  return -1;
253 }
254 
255 
257 {
258  BIASERR("Not longer defined in SDK.");
259  //return is_SetParentHwnd (m_hu, hWnd);
260  return -1;
261 }
262 
263 
265 {
266  BIASERR("Not longer supported in current SDK.");
267  //return is_UpdateDisplay (m_hu);
268  return -1;
269 }
270 
271 
272 int CuEye::CaptureVideo (int lWait)
273 {
274  return is_CaptureVideo (m_hu, lWait);
275 }
276 
277 
278 int CuEye::StopLiveVideo (int lWait)
279 {
280  return is_StopLiveVideo (m_hu, lWait);
281 }
282 
283 
284 int CuEye::FreezeVideo (int lWait)
285 {
286  return is_FreezeVideo (m_hu, lWait);
287 
288 }
289 
290 int CuEye::SetCaptureMode (int lMode)
291 {
292  BIASERR("Not longer defined in SDK.");
293  // return is_SetCaptureMode (m_hu, lMode);
294  return -1;
295 }
296 
297 
298 int CuEye::GetAllPixelClocks(unsigned int* nPixelClockList)
299 {
300  return is_PixelClock(m_hu, IS_PIXELCLOCK_CMD_GET_LIST, nPixelClockList, 150*sizeof(UINT));
301 }
302 
303 
305 {
306  BIASERR("Not longer supported in current SDK.");
307  //return is_SetEdgeEnhancement(m_hu, lMode);
308  return -1;
309 }
310 
311 int CuEye::AllocImageMem (int lWidth, int lHeight, int lBpp, char** ppcImgMem, int* plID)
312 {
313  return is_AllocImageMem (m_hu, lWidth, lHeight, lBpp, ppcImgMem, plID);
314 }
315 
316 
317 int CuEye::FreeImageMem (char* pcMem, int lID)
318 {
319  return is_FreeImageMem (m_hu, pcMem, lID);
320 }
321 
322 
323 int CuEye::SetImageMem (char* pcMem, int lID)
324 {
325  return is_SetImageMem (m_hu, pcMem, lID);
326 }
327 
328 
329 int CuEye::GetActiveImageMem (char** ppcImgMem, int* plID)
330 {
331  return is_GetActiveImageMem (m_hu, ppcImgMem, plID);
332 }
333 
334 int CuEye::GetActSeqBuffer(char** ppcImgMem, int* plID){
335  INT dummy;
336  return is_GetActSeqBuf(m_hu, &dummy, ppcImgMem,ppcImgMem);
337 }
338 
339 int CuEye::InquireImageMem (char* pcMem, int lID, int* plX, int* plY, int* plBpp, int* plPitch)
340 {
341  return is_InquireImageMem (m_hu, pcMem, lID, plX, plY, plBpp, plPitch);
342 }
343 
344 
345 int CuEye::ReadTriggerPort (int* plIn)
346 {
347  int nRet = IS_SUCCESS;
348 
349  if(plIn != 0)
350  *plIn = is_SetExternalTrigger (m_hu, IS_GET_TRIGGER_INPUTS);
351  else
352  nRet = IS_NULL_POINTER;
353 
354  return nRet;
355 }
356 
357 
358 
359 int CuEye::ReadDigitalPort (int* plIn)
360 {
361  BIASERR("Not longer supported in current SDK.");
362 // int nRet = IS_SUCCESS;
363 
364 // if(plIn != 0)
365 // *plIn = is_SetIO (m_hu, IS_GET_IO);
366 // else
367 // nRet = IS_NULL_POINTER;
368 
369 // return nRet;
370  return -1;
371 }
372 
373 
375 {
376  BIASERR("Not longer supported in current SDK.");
377 //return is_SetIO (m_hu, lOut);
378  return -1;
379 }
380 
381 
383 {
384  return is_SetExternalTrigger (m_hu, lMode);
385 }
386 
387 
388 int CuEye::GetCameraInfo (CAMINFO* pInfo)
389 {
390  int nRet = IS_SUCCESS;
391 
392  if(pInfo != 0)
393  nRet = is_GetCameraInfo (m_hu, pInfo);
394  else
395  nRet = IS_NULL_POINTER;
396 
397  return nRet;
398 }
399 
400 
401 int CuEye::ReadEEPROM (int lAdr, char* pcBuf, int lCount)
402 {
403  int nRet = IS_SUCCESS;
404 
405  if(pcBuf != 0)
406  nRet = is_ReadEEPROM (m_hu, lAdr, pcBuf, lCount);
407  else
408  nRet = IS_INVALID_PARAMETER;
409 
410  return nRet;
411 }
412 
413 
414 int CuEye::WriteEEPROM (int lAdr, char* pcBuf, int lCount)
415 {
416  int nRet = IS_SUCCESS;
417 
418  if(pcBuf != 0)
419  nRet = is_WriteEEPROM (m_hu, lAdr, pcBuf, lCount);
420  else
421  nRet = IS_INVALID_PARAMETER;
422 
423  return nRet;
424 }
425 
426 
427 int CuEye::SaveImage (char* pcFile)
428 {
429  BIASERR("Not longer supported in current SDK.");
430 // return is_SaveImage (m_hu, pcFile);
431  return -1;
432 }
433 
434 
435 int CuEye::LoadImage (char* pcFile)
436 {
437  BIASERR("Not longer supported in current SDK.");
438 //return is_LoadImage (m_hu, pcFile);
439  return -1;
440 }
441 
442 
443 int CuEye::SaveImageMem (char* pcFile, char* pcMem, int lID)
444 {
445  BIASERR("Not longer supported in current SDK.");
446 // return is_SaveImageMem (m_hu, pcFile, pcMem, lID);
447  return -1;
448 }
449 
450 
451 int CuEye::RenderBitmap (int nMemID, HWND hwnd, int nMode)
452 {
453  return is_RenderBitmap(m_hu, nMemID, hwnd, nMode);
454 }
455 
456 
457 int CuEye::SetScaler (int nMode)
458 {
459  BIASERR("Not longer defined in SDK.");
460  //if(nMode)
461  // return is_SetScaler(m_hu, IS_SET_SCALER_ON, IS_SET_SCALER_ON);
462  //else
463  // return is_SetScaler(m_hu, IS_SET_SCALER_OFF, IS_SET_SCALER_OFF);
464  return -1;
465 }
466 
467 
468 int CuEye::SetPixelClock(unsigned int nClock)
469 {
470  return is_PixelClock(m_hu, IS_PIXELCLOCK_CMD_SET, (void*)&nClock, sizeof(nClock));
471 }
472 
473 
474 int CuEye::SetFrameRate(double dFr, double* pdFrNew)
475 {
476  return is_SetFrameRate(m_hu, dFr, pdFrNew);
477 }
478 
479 
480 int CuEye::SetExposureTime(double EXP, double* newEXP)
481 {
482  return is_Exposure (m_hu, IS_EXPOSURE_CMD_SET_EXPOSURE, (void*)&EXP, sizeof(EXP));
483 }
484 
486 {
487  double newexp =0.0;
488 
489  is_Exposure(m_hu, IS_EXPOSURE_CMD_GET_EXPOSURE, (void*)&newexp, sizeof(newexp));
490 
491  return newexp;
492 }
493 
494 int CuEye::SetGain(int gainMaster)
495 {
496  int ret =0;
497  ret = is_SetHardwareGain(m_hu, gainMaster, IS_IGNORE_PARAMETER, IS_IGNORE_PARAMETER, IS_IGNORE_PARAMETER);
498  return ret;
499 }
500 
501 int CuEye::SetGain(int gainMaster, int gainRed, int gainGreen, int gainBlue)
502 {
503  int ret =0;
504  ret = is_SetHardwareGain(m_hu, gainMaster, gainRed, gainGreen, gainBlue);
505  return ret;
506 }
507 
508 int CuEye::SetGain(double gain)
509 {
510  int ret =0;
511 
512  BIASERR("Do not use this method, use SetGain(int) instead!");
513  ret = is_SetHardwareGain(m_hu,(int) gain,IS_IGNORE_PARAMETER,IS_IGNORE_PARAMETER,IS_IGNORE_PARAMETER);
514  return ret;
515 }
516 
518 {
519  return is_SetHardwareGain(m_hu,IS_GET_MASTER_GAIN,IS_IGNORE_PARAMETER,IS_IGNORE_PARAMETER,IS_IGNORE_PARAMETER);
520 }
521 
522 
523 int CuEye::Renumerate( int reserved )
524 {
525  // return is_Renumerate( m_hu, reserved );
526  return -1;
527 }
528 
529 
530 int CuEye::GetSensorInfo( PSENSORINFO pInfo )
531 {
532  return is_GetSensorInfo( m_hu, pInfo );
533 }
int StopLiveVideo(int lWait)
Definition: ueyeclass.cpp:278
double GetGain()
Definition: ueyeclass.cpp:517
int SetExposureTime(double EXP, double *newEXP)
Definition: ueyeclass.cpp:480
int GetActiveImageMem(char **ppcImgMem, int *plID)
Definition: ueyeclass.cpp:329
int SetMainDisplayWindow(HWND hWnd)
Definition: ueyeclass.cpp:256
int ReadDigitalPort(int *plIn)
Definition: ueyeclass.cpp:359
int UpdateDisplay()
Definition: ueyeclass.cpp:264
int CaptureVideo(int lWait)
Definition: ueyeclass.cpp:272
int SetBrightness(int lBright)
Definition: ueyeclass.cpp:129
int SetGain(int gainMaster)
Definition: ueyeclass.cpp:494
int GetCameraInfo(CAMINFO *pInfo)
Definition: ueyeclass.cpp:388
int FreeImageMem(char *pcMem, int lID)
Definition: ueyeclass.cpp:317
int SetPixelClock(unsigned int nClock)
Definition: ueyeclass.cpp:468
int SetCaptureMode(int lMode)
Definition: ueyeclass.cpp:290
int SetColorMode(int lMode)
Definition: ueyeclass.cpp:164
virtual ~CuEye()
Definition: ueyeclass.cpp:19
int EnableAutoExit(int nMode)
Definition: ueyeclass.cpp:200
int ReadTriggerPort(int *plIn)
Definition: ueyeclass.cpp:345
int SetWhiteBalanceMultipliers(double dblRed, double dblGreen, double dblBlue)
Definition: ueyeclass.cpp:158
int WriteEEPROM(int lAdr, char *pcBuf, int lCount)
Definition: ueyeclass.cpp:414
int GetDllVersion(int *plDllVers)
Definition: ueyeclass.cpp:78
int DisableEvent(int nWhich)
Definition: ueyeclass.cpp:182
int ExitCamera()
Definition: ueyeclass.cpp:48
int SetImageMem(char *pcMem, int lID)
Definition: ueyeclass.cpp:323
int SaveImage(char *pcFile)
Definition: ueyeclass.cpp:427
int InquireImageMem(char *pcMem, int lID, int *plX, int *plY, int *plBpp, int *plPitch)
Definition: ueyeclass.cpp:339
int CameraStatus(int lInfo, long lValue)
Definition: ueyeclass.cpp:109
int SetWhiteBalance(int nMode)
Definition: ueyeclass.cpp:152
int SetImageSize(int lWidth, int lHeight)
Definition: ueyeclass.cpp:206
int InitCamera(int nId=0)
Definition: ueyeclass.cpp:24
int SetFrameRate(double dFr, double *pdFrNew)
Definition: ueyeclass.cpp:474
int EnableEvent(int nWhich)
Definition: ueyeclass.cpp:176
int SaveImageMem(char *pcFile, char *pcMem, int lID)
Definition: ueyeclass.cpp:443
int RenderBitmap(int nMemID, HWND hwnd, int nMode)
Definition: ueyeclass.cpp:451
int FreezeVideo(int lWait)
Definition: ueyeclass.cpp:284
int Renumerate(int reserved)
Definition: ueyeclass.cpp:523
int SetEdgeEnhancement(int lMode)
Definition: ueyeclass.cpp:304
int SetExternalTrigger(int lMode)
Definition: ueyeclass.cpp:382
int SetDisplayMode(int Mode)
Definition: ueyeclass.cpp:236
int SetContrast(int lCont)
Definition: ueyeclass.cpp:137
int LoadImage(char *pcFile)
Definition: ueyeclass.cpp:435
int SetDisplayKeyColor(int lKeyCol)
Definition: ueyeclass.cpp:248
int GetAllPixelClocks(unsigned int *nPixelClockList)
Definition: ueyeclass.cpp:298
int SetDisplayWindow(HWND hWnd)
Definition: ueyeclass.cpp:242
int GetPciSlot(int *plSlot)
Definition: ueyeclass.cpp:85
int SetScaler(int nMode)
Definition: ueyeclass.cpp:457
int GetColorDepth(int *plBpp, int *plColFormat)
Definition: ueyeclass.cpp:103
int SetImagePos(int lPosX, int lPosY)
Definition: ueyeclass.cpp:222
int ReadEEPROM(int lAdr, char *pcBuf, int lCount)
Definition: ueyeclass.cpp:401
int GetErrorText(int lErr, char *pcErrText)
Definition: ueyeclass.cpp:68
int GetSensorInfo(PSENSORINFO pInfo)
Definition: ueyeclass.cpp:530
CuEye()
Definition: ueyeclass.cpp:12
int InitEvent(HANDLE hEv, int nWhich)
Definition: ueyeclass.cpp:170
int EnableMessage(int nWhich, HWND hwnd)
Definition: ueyeclass.cpp:194
int GetActSeqBuffer(char **ppcImgMem, int *plID)
Definition: ueyeclass.cpp:334
HIDS m_hu
Definition: ueyeclass.hh:134
int ExitEvent(int nWhich)
Definition: ueyeclass.cpp:188
int GetOsVersion(void)
Definition: ueyeclass.cpp:121
double GetExposureTime()
Definition: ueyeclass.cpp:485
int SetErrorReport(int lMode)
Definition: ueyeclass.cpp:62
int WriteDigitalPort(int lOut)
Definition: ueyeclass.cpp:374
int GetIRQ(int *plIRQ)
Definition: ueyeclass.cpp:94
int GetNumberOfCameras(int *plNumCameras)
Definition: ueyeclass.cpp:72
int GetCameraType()
Definition: ueyeclass.cpp:115
int AllocImageMem(int lWidth, int lHeight, int lBpp, char **ppcImgMem, int *plID)
Definition: ueyeclass.cpp:311
int SetGamma(int lGamma)
Definition: ueyeclass.cpp:145