Hi forum,
I am having a problem trying to show multiple videos using openmp. Below is the code
#include
#include
#include "opencv2/imgproc/imgproc.hpp"
#include "omp.h"
#include
using namespace cv;
using namespace std;
string Camera[2] = { "camA.avi", "camB.avi" };
int main(int argc, const char * argv[])
{
omp_set_num_threads(2);
Mat frame;
#pragma omp parallel private (frame)
{
VideoCapture capture;
int Thread = omp_get_thread_num();
capture.open(Camera[Thread]);
while (1){
capture.read(frame);
namedWindow(Camera[Thread], CV_WINDOW_NORMAL);
imshow(Camera[Thread], frame);
waitKey(1);
}
}
}
I just wanna be able to display both videos at the same time. Hope I can get some help. Thanks
EDIT: So I added in a few lines of code which has no relation to the parallel threads and I got it running...
Now im even more confused.
#include
#include
#include "opencv2/imgproc/imgproc.hpp"
#include "omp.h"
#include
using namespace cv;
using namespace std;
string Camera[2] = { "filmrole3.avi", "filmrole4.avi" };
int main(int argc, const char * argv[])
{
omp_set_num_threads(2);
FileStorage fs("Cam3_Homography.yml", FileStorage::READ);
vector Homography_Matrix(2);
fs["Cam3_Homography"] >> Homography_Matrix[0];
fs.release();
#pragma omp parallel
{
VideoCapture capture;
Mat frame;
int Thread = omp_get_thread_num();
capture.open(Camera[Thread]);
while (1){
capture.read(frame);
namedWindow(Camera[Thread], CV_WINDOW_NORMAL);
imshow(Camera[Thread], frame);
waitKey(1);
}
}
}
↧