Commit c7cf80fd authored by Stefano Fabri's avatar Stefano Fabri

Enable pixelformat check

parent a419ecfd
...@@ -183,7 +183,7 @@ bool CvCaptureCAM_PvAPI::open( int index ) ...@@ -183,7 +183,7 @@ bool CvCaptureCAM_PvAPI::open( int index )
PvAttrUint32Get(Camera.Handle, "TotalBytesPerFrame", &frameSize); PvAttrUint32Get(Camera.Handle, "TotalBytesPerFrame", &frameSize);
PvAttrUint32Get(Camera.Handle, "Width", &frameWidth); PvAttrUint32Get(Camera.Handle, "Width", &frameWidth);
PvAttrUint32Get(Camera.Handle, "Height", &frameHeight); PvAttrUint32Get(Camera.Handle, "Height", &frameHeight);
//PvAttrEnumGet(Camera.Handle, "pixelFormat", pixelFormat,256,NULL); PvAttrEnumGet(Camera.Handle, "PixelFormat", pixelFormat,256,NULL);
maxSize = 8228; maxSize = 8228;
PvAttrUint32Get(Camera.Handle,"PacketSize",&maxSize); PvAttrUint32Get(Camera.Handle,"PacketSize",&maxSize);
if (PvCaptureAdjustPacketSize(Camera.Handle,maxSize)!=ePvErrSuccess) if (PvCaptureAdjustPacketSize(Camera.Handle,maxSize)!=ePvErrSuccess)
...@@ -191,16 +191,16 @@ bool CvCaptureCAM_PvAPI::open( int index ) ...@@ -191,16 +191,16 @@ bool CvCaptureCAM_PvAPI::open( int index )
//printf ("Pixel Format %s %d %d\n ", pixelFormat,frameWidth,frameHeight); //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;
frame = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_8U, 3); frame = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_8U, 3);
frame->widthStep = (int)frameWidth*3; frame->widthStep = (int)frameWidth*3;
Camera.Frame.ImageBufferSize = frameSize; Camera.Frame.ImageBufferSize = frameSize;
Camera.Frame.ImageBuffer = grayframe->imageData; Camera.Frame.ImageBuffer = grayframe->imageData;
} }
else if (strncmp(pixelFormat, "Mono16",NULL)==0) { else if (strncmp(pixelFormat, "Mono16",NULL)==0) {
grayframe = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_16U, 1); grayframe = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_16U, 1);
grayframe->widthStep = (int)frameWidth; grayframe->widthStep = (int)frameWidth;
frame = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_16U, 3); frame = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_16U, 3);
frame->widthStep = (int)frameWidth*3; frame->widthStep = (int)frameWidth*3;
Camera.Frame.ImageBufferSize = frameSize; Camera.Frame.ImageBufferSize = frameSize;
Camera.Frame.ImageBuffer = grayframe->imageData; Camera.Frame.ImageBuffer = grayframe->imageData;
......
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