Opencv video frame not showing Sobel output

Posted by user1016950 on Stack Overflow See other posts from Stack Overflow or by user1016950
Published on 2011-11-24T11:42:19Z Indexed on 2011/11/24 17:50 UTC
Read the original article Hit count: 192

Filed under:
|
|

This is a continuation question from Opencv video frame giving me an error I think I closed it off, Im new to Stackoverflow.

I have code below that Im trying to see its Sobel edge image. However the program runs but the output is just a grey screen where if I mouseover the cursor disappears. Does anyone see the error? or is it a misunderstanding about the data structures Im using

IplImage *frame, *frame_copy = 0;

// capture frames from video
CvCapture *capture = cvCaptureFromFile( "lightinbox1.avi");
//Allows Access to video propertys
cvQueryFrame(capture);

//Get the number of frames
int nframe=(int) cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_COUNT);

//Name window
cvNamedWindow( "video:", 1 );

//start loop
for(int i=0;i<nframe;i++){
//prepare capture frame extraction
cvGrabFrame(capture);
cout<<"We are on frame "<<i<<"\n";
//Get this frame
frame = cvRetrieveFrame( capture );
con2txt(frame);
frame_copy = cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_8U,frame->nChannels );
//show and destroy frame
cvCvtColor( frame,frame,CV_RGB2GRAY);

 //Create Sobel output
 frame_copy1 = cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_16S,1 );
cvSobel(frame_copy,frame_copy1,2,2,3);

cvShowImage("video:",frame_copy1);
cvWaitKey(33);}
cvReleaseCapture(&capture);

© Stack Overflow or respective owner

Related posts about c++

Related posts about image-processing