Commit 22d22fd9 authored by Stefano Fabri's avatar Stefano Fabri

Some little fix in pvapi backend

parent 4a734f77
...@@ -136,8 +136,9 @@ bool CvCaptureCAM_PvAPI::open( int index ) ...@@ -136,8 +136,9 @@ bool CvCaptureCAM_PvAPI::open( int index )
tPvIpSettings ipSettings; tPvIpSettings ipSettings;
if (PvInitialize()) if (PvInitialize()) {
return false; }
//return false;
Sleep(1000); Sleep(1000);
...@@ -178,7 +179,8 @@ bool CvCaptureCAM_PvAPI::open( int index ) ...@@ -178,7 +179,8 @@ bool CvCaptureCAM_PvAPI::open( int index )
return NULL; return NULL;
} }
*/ */
tPvUint32 frameWidth, frameHeight, frameSize, maxSize; tPvUint32 frameWidth, frameHeight, frameSize;
unsigned long maxSize;
char pixelFormat[256]; char pixelFormat[256];
PvAttrUint32Get(Camera.Handle, "TotalBytesPerFrame", &frameSize); PvAttrUint32Get(Camera.Handle, "TotalBytesPerFrame", &frameSize);
PvAttrUint32Get(Camera.Handle, "Width", &frameWidth); PvAttrUint32Get(Camera.Handle, "Width", &frameWidth);
...@@ -188,7 +190,6 @@ bool CvCaptureCAM_PvAPI::open( int index ) ...@@ -188,7 +190,6 @@ bool CvCaptureCAM_PvAPI::open( int index )
//PvAttrUint32Get(Camera.Handle,"PacketSize",&maxSize); //PvAttrUint32Get(Camera.Handle,"PacketSize",&maxSize);
if (PvCaptureAdjustPacketSize(Camera.Handle,maxSize)!=ePvErrSuccess) if (PvCaptureAdjustPacketSize(Camera.Handle,maxSize)!=ePvErrSuccess)
return false; return false;
//printf ("Pixel Format %s %d %d\n ", pixelFormat,frameWidth,frameHeight);
if (strncmp(pixelFormat, "Mono8",NULL)==0) { if (strncmp(pixelFormat, "Mono8",NULL)==0) {
grayframe = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_8U, 1); grayframe = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_8U, 1);
grayframe->widthStep = (int)frameWidth; grayframe->widthStep = (int)frameWidth;
...@@ -255,7 +256,7 @@ IplImage* CvCaptureCAM_PvAPI::retrieveFrame(int) ...@@ -255,7 +256,7 @@ IplImage* CvCaptureCAM_PvAPI::retrieveFrame(int)
if (PvCaptureWaitForFrameDone(Camera.Handle, &(Camera.Frame), 1000) == ePvErrSuccess) { if (PvCaptureWaitForFrameDone(Camera.Handle, &(Camera.Frame), 1000) == ePvErrSuccess) {
if (!monocrome) if (!monocrome)
cvMerge(grayframe,grayframe,grayframe,NULL,frame); cvMerge(grayframe,grayframe,grayframe,NULL,frame);
return frame; return grayframe;
} }
else return NULL; else return NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment