Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found the solution. Those who are interested the code is given below:</p> <pre class="lang-c prettyprint-override"><code>#include &lt;cv.h&gt; #include &lt;highgui.h&gt; #include &lt;stdio.h&gt; int main( int argc, char** argv ) { IplImage *frame; CvCapture *capture = NULL; if(( argc &lt; 2 ) || !(capture = cvCreateFileCapture( argv[1] ))) { printf("Failed to open %s\n", argv[1] ); return -1; } double f = cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_COUNT ); double fps = cvGetCaptureProperty(capture, CV_CAP_PROP_FPS); CvSize size = cvSize(cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH), cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT)); IplImage *img = NULL; double index = 0; IplImage *gray = cvCreateImage(size,IPL_DEPTH_8U,1); IplImage *canny = cvCreateImage(size,IPL_DEPTH_8U,1); IplImage *long_img = cvCreateImage(cvSize(size.width*3, size.height),IPL_DEPTH_8U, 3); IplImage *color_sub, *gray_sub, *canny_sub; cvNamedWindow("ALLONE", 1); int key = 0; while( index++ &lt; f) { cvGrabFrame(capture); img = cvRetrieveFrame(capture); color_sub = cvCreateImageHeader(size, long_img-&gt;depth, long_img-&gt;nChannels); color_sub-&gt;origin = long_img-&gt;origin; color_sub-&gt;widthStep = long_img-&gt;widthStep; color_sub-&gt;imageData = long_img-&gt;imageData; cvCopy(img, color_sub); cvCvtColor(img, gray, CV_BGR2GRAY); gray_sub = cvCreateImageHeader(size, long_img-&gt;depth,long_img-&gt;nChannels); gray_sub-&gt;origin = long_img-&gt;origin; gray_sub-&gt;widthStep = long_img-&gt;widthStep; gray_sub-&gt;imageData = long_img-&gt;imageData + (size.width * long_img-&gt;nChannels); cvMerge(gray , gray, gray, NULL, gray_sub); cvCanny(gray, canny, 100, 200); canny_sub = cvCreateImageHeader(size, long_img-&gt;depth, long_img-&gt;nChannels); canny_sub-&gt;origin = long_img-&gt;origin; canny_sub-&gt;widthStep = long_img-&gt;widthStep; canny_sub-&gt;imageData = long_img-&gt;imageData + ((size.width * 2) * long_img-&gt;nChannels); cvMerge(canny , canny, canny, NULL, canny_sub); cvShowImage("ALLONE", long_img); key = (char) cvWaitKey(1000/fps); if(key == 27) break; printf("%d\n", key); } cvReleaseCapture( &amp;capture ); return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload