Hello,
I've developed a code in Qt IDE in windows and when I run it, it works well, however, when I passed to run the code in CentOS machine with CMAKE I got these error :
I've followed this documentation to set opencv and cmake in my machine, I've tested it, its works well too as you can see
This is the simple code that I'm trying to run in linux machine
#include <iostream> // for standard I/O
#include <opencv2/core/core.hpp> // Basic OpenCV structures (cv::Mat, Scalar)
#include <opencv2/imgproc/imgproc.hpp> // Gaussian Blur
#include <opencv2/highgui/highgui.hpp> // OpenCV window I/O
#include <thread>
#include <future>
using namespace std;
using namespace cv;
int loadVideo( VideoCapture cap1, int seek_step,int thrd){
int frameNum = 0;
Mat frame;
char c;
cap1.set(CV_CAP_PROP_POS_FRAMES, seek_step );
while (1){
cap1 >> frame;
if (frame.empty())
{
cout << " < < < Channel stream ended! > > > ";
break;
}
/* cv::putText(frame, "Frame "+to_string(frameNum+seek_step),
cvPoint(30,30), FONT_HERSHEY_COMPLEX_SMALL, 0.8, cvScalar(0,0,255), 1, CV_AA);
imshow(to_string(thrd), frame );
c = (char)cvWaitKey(22);
if (c == 27) break;*/
cout << frameNum << endl;
++frameNum;
}
return frameNum;
}
int main()
{
string sourceVideoPath;
sourceVideoPath = "/home/azdoud/fp.mp4";
//start a new VideoCapture object in each of your 4 threads
VideoCapture cap1(sourceVideoPath);
VideoCapture cap2(sourceVideoPath);
VideoCapture cap3(sourceVideoPath);
cout << "Stream frame numbre : " << cap1.get(CV_CAP_PROP_FRAME_COUNT)<<endl;
if (!cap1.isOpened())
{
cout << "Could not open reference " << sourceVideoPath << endl;
return -1;
}
auto future1 = std::async(loadVideo, cap1,0,1);
auto future2 = std::async(loadVideo, cap2,750,2);
auto future3 = std::async(loadVideo, cap3,1000,3);
cout << future1.get() << endl;
cout << future2.get() << endl;
cout << future3.get() << endl;
return 0;
}
thank you in advance .