Page 2 of 2 FirstFirst 1 2
Results 16 to 17 of 17

Thread: C++ Console App without MFC

  1. #16
    Join Date
    Apr 2012
    Posts
    1

    Re: C++ Console App without MFC

    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();

  2. #17
    Join Date
    Jan 2003
    Location
    Bremen, Germany
    Posts
    4,285

    Re: C++ Console App without MFC

    Hello,

    I do not know, why OpenCV handles the images flipped. Therefore, you may flip them using a suitable OpenCV flip function.

    cvConvertImage( const CvArr* src, CvArr* dst, int flags=0 );

    cvConvertImage( img,img,CV_CVTIMG_FLIP)
    Best regards
    Stefan
    IC Imaging Control Support

Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. Using IC-3.0 librairie with MFC as static Lib
    By vdaanen in forum IC Imaging Control C++ Class Library
    Replies: 6
    Last Post: July 26, 2007, 18:01:09
  2. video surveillance app
    By taegucit in forum MontiVision Development Kit
    Replies: 2
    Last Post: April 23, 2006, 20:07:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •