Ask Your Question

ampersd's profile - activity

2013-12-23 04:41:28 -0600 received badge  Scholar (source)
2013-12-23 04:41:17 -0600 commented answer Problem with IplImage pointer

Thanks! Now all are ok. I didn't think about cam frames before, but may be it's the reason.

2013-12-23 04:21:28 -0600 commented answer Problem with IplImage pointer

Thanks for your help. May be you are right about not bothering with C-Api. By the way, I try to run your example. Program execution's time is about 0.5 sec. (LED of camera turn on). How can I make infinite cycle? Next code throw exception: while(1) { cap.read(frame); //using "cap >> frame;" cause the same effect ... }

2013-12-23 03:55:08 -0600 received badge  Supporter (source)
2013-12-23 02:58:41 -0600 received badge  Editor (source)
2013-12-23 02:57:37 -0600 asked a question Problem with IplImage pointer

Hi everybody! I start learning OpenCV. Now using Windows 8.1 + VS2013 + opencv246. I have a problem with pointer "frame":

  CvCapture *capture = cvCreateCameraCapture(0);    
  if (capture == NULL)          
    return 0;
  IplImage *frame = NULL; 
  IplImage *sframe = NULL;

  CvSize size = cvSize(         
     cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH) / 2,  
  cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT) / 2       
  );

  frame = cvQueryFrame(capture); //after this line "frame" remains NULL!    
  sframe = cvCreateImage(size, frame->depth, frame->nChannels); //here we've got exception

Visual Studio throws exception:

Unhandled exception at 0x0029564C in opencv_threewindows.exe: 0xC0000005: 
Access violation reading address 0x00000008.

Why "frame" doesn't initialize? If we will delete these lines, and continue program execution:

cvNamedWindow("camera", CV_WINDOW_AUTOSIZE);
while (1)
    {
        frame = cvQueryFrame(capture);
                cvShowImage("camera", frame);
        }

All works fine... I can't understand why this occurs. Appreciate any help.