enter code here
1 | initial version |
enter code here
2 | No.2 Revision |
I am getting Fatal error in this code. I want to display the frames parallely. Need help.
using namespace cv; using namespace std;
int main(int argc, char *argv) { int no_of_frames = 0,i,j; int fps = 0; int mid_frame = 0; CvCapture capture = cvCaptureFromFile("/home/nagaraj/ImageVideo/tunnel.avi"); CvCapture* captureNew = cvCaptureFromFile("/home/nagaraj/ImageVideo/tunnel.avi"); if (capture == NULL) { printf("Error: Can't open video.\n"); return -1; } if (captureNew == NULL) { printf("Error: Can't open video.\n"); return -1; } fps = (int)cvGetCaptureProperty(capture,CV_CAP_PROP_FPS); no_of_frames = (int)cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_COUNT); mid_frame = no_of_frames/2; omp_set_num_threads(2);
enter code here
{
{
//cvSetCaptureProperty(capture,CV_CAP_PROP_POS_FRAMES,0);
IplImage* img = cvQueryFrame(capture);
cvNamedWindow("Window1",CV_WINDOW_AUTOSIZE);
cvShowImage("Window1",img);
cvWaitKey(10000);
cvReleaseImage(&img);
cvDestroyWindow("Window1");
cvReleaseCapture(&capture);
}
{
cvSetCaptureProperty(captureNew,CV_CAP_PROP_POS_FRAMES,(double)mid_frame-1);
IplImage* img = cvQueryFrame(captureNew);
cvNamedWindow("Window2",CV_WINDOW_AUTOSIZE);
cvShowImage("Window2",img);
cvWaitKey(10000);
cvReleaseImage(&img);
cvDestroyWindow("Window2");
cvReleaseCapture(&captureNew);
}
} }
3 | OpenCV OpenMP query |
I am getting Fatal error in this code. I want to display the frames parallely. Need help.help.I am newbee to OpenCV and OpenMP. Ur suggestions will be helpful for me. please :)
#include <cv.h>
#include <cvaux.h>
#include <iostream>
#include <cxcore.h>
#include <highgui.h>
#include <omp.h>
using namespace cv;
using namespace
{
cvSetCaptureProperty(captureNew,CV_CAP_PROP_POS_FRAMES,(double)mid_frame-1);
IplImage* img = cvQueryFrame(captureNew);
cvNamedWindow("Window2",CV_WINDOW_AUTOSIZE);
cvShowImage("Window2",img);
cvWaitKey(10000);
cvReleaseImage(&img);
cvDestroyWindow("Window2");
cvReleaseCapture(&captureNew);
}
} }