Ask Your Question

Shanal's profile - activity

2014-05-19 05:42:27 -0600 asked a question Image not capture;only showes blank screen

Heading

I want to run this easy code to capture image. but it gives only blank screen as output.

#include <opencv2/objdetect/objdetect.hpp>

include <opencv2 highgui="" highgui.hpp="">

include <opencv2 imgproc="" imgproc.hpp="">

include <iostream>

include <stdio.h>

using namespace std; using namespace cv;

int main( int argc, const char* argv ) { CvCapture capture = 0; Mat frame; Mat frameCopy; Mat image;

capture = cvCaptureFromCAM( 0 ); //0=default, -1=any camera, 1..99=your camera
if(!capture) cout << "No camera detected" << endl;

cvNamedWindow( "result",0 );

if( capture )
{
    cout << "In capture ..." << endl;

IplImage* iplImg = cvQueryFrame( capture ); frame = iplImg; for(;;)

  {
       IplImage* iplImg = cvQueryFrame( capture );
        frame = iplImg;
  if( frame.empty())

 if( iplImg->origin == IPL_ORIGIN_TL )
            frame.copyTo( frameCopy );
        else
            flip( frame, frameCopy, 0 );

       if( waitKey( 10 ) >= 0 )

cvReleaseCapture( &capture ); }

   waitKey(0);

cvDestroyWindow("result");

return 0;
}

} the ou#include <opencv2 objdetect="" objdetect.hpp="">

include <opencv2 highgui="" highgui.hpp="">

include <opencv2 imgproc="" imgproc.hpp="">

include <iostream>

include <stdio.h>

using namespace std; using namespace cv;

int main( int argc, const char* argv ) { CvCapture capture = 0; Mat frame; Mat frameCopy; Mat image;

capture = cvCaptureFromCAM( 0 ); //0=default, -1=any camera, 1..99=your camera
if(!capture) cout << "No camera detected" << endl;

cvNamedWindow( "result",0 );

if( capture )
{
    cout << "In capture ..." << endl;

IplImage* iplImg = cvQueryFrame( capture ); frame = iplImg; for(;;)

  {
       IplImage* iplImg = cvQueryFrame( capture );
        frame = iplImg;
  if( frame.empty())

 if( iplImg->origin == IPL_ORIGIN_TL )
            frame.copyTo( frameCopy );
        else
            flip( frame, frameCopy, 0 );

       if( waitKey( 10 ) >= 0 )

cvReleaseCapture( &capture ); }

   waitKey(0);

cvDestroyWindow("result");

return 0;
}

} and output is: Screenshot from 2014-05-19 16:04:08.png