Hello,
I am trying to capture frames form the camera and use these frames in opencv. But the frames come flipped. Do you have any suggestion to capture them non-flipped?
Here is my code:
bool result;
result = DShowLib::InitLibrary();
if (result == false)
{
printf("FAILED\n");
cin.get();
}
DShowLib::Grabber grabber;
if( !setupDeviceFromFile( grabber ) )
{
return -1;
}
//grabber.setOverlayBitmapPathPosition( ePP_NONE );
tFrameHandlerSinkPtr pSink = FrameHandlerSink::create( eRGB24, 2 );
pSink->setSnapMode(true);
grabber.setSinkType( pSink );
result = grabber.prepareLive( false ); // this allows getting info
if (result == false)
{
printf("FAILED\n");
cin.get();
}
FrameTypeInfo info;
pSink->getOutputFrameType( info );
grabber.startLive();
IplImage* img=cvCreateImage( cvSize(info.dim.cx,info.dim.cy), IPL_DEPTH_8U , 3 );
for(;;)
{
pSink->snapImages(1);
img->imageData = (char*)pSink->getLastAcqMemBuffer()->getPtr();
// Process Image
cvShowImage( "Image", img);
cvWaitKey(1);
}
grabber.stopLive();


Reply With Quote
Bookmarks