Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to solve compilre error in CentOS machine ?

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 :

image description

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

image description

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 .

How to solve compilre error in CentOS machine ?

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 :

image description

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

image description

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 .

How to solve compilre compiler error in CentOS machine ?

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 :

image description

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

image description

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 .

click to hide/show revision 4
None

updated 2018-06-08 08:54:29 -0600

berak gravatar image

How to solve CMAKE compiler error in CentOS machine ?

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 :

image description

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

image description

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 .

How to solve CMAKE compiler error in CentOS machine ?

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 :

[azdoud@video-processor CentOSsimple]$ make Scanning dependencies of target main [100%] Building CXX object CMakeFiles/main.dir/main.cpp.o In file included from /usr/include/c++/4.8.2/thread:35:0, from /opt/working/CentOSsimple/main.cpp:5:

  /usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
   #error This file requires compiler and library support for the \
    ^
  /opt/working/CentOSsimple/main.cpp: In function ‘void loadVideo1(cv::VideoCapture, int, int)’:
  /opt/working/CentOSsimple/main.cpp:24:65: error: ‘to_string’ was not declared in this scope
           cv::putText(frame, "Frame "+to_string(frameNum+seek_step),
                                                                   ^
  /opt/working/CentOSsimple/main.cpp: In function ‘int main()’:
  /opt/working/CentOSsimple/main.cpp:92:10: error: ‘future1’ does not name a type
       auto future1 = std::async(loadVideo, cap1,0,1);
            ^
  /opt/working/CentOSsimple/main.cpp:93:10: error: ‘future2’ does not name a type
       auto future2 = std::async(loadVideo, cap2,750,2);
            ^
  /opt/working/CentOSsimple/main.cpp:94:10: error: ‘future3’ does not name a type
       auto future3 = std::async(loadVideo, cap3,1000,3);
            ^
  /opt/working/CentOSsimple/main.cpp:96:13: error: ‘future1’ was not declared in this scope
       cout << future1.get() << endl;
               ^
  /opt/working/CentOSsimple/main.cpp:97:13: error: ‘future2’ was not declared in this scope
       cout << future2.get() << endl;
               ^
  /opt/working/CentOSsimple/main.cpp:98:13: error: ‘future3’ was not declared in this scope
       cout << future3.get() << endl;
               ^
  make[2]: *** [CMakeFiles/main.dir/main.cpp.o] Error 1
  make[1]: *** [CMakeFiles/main.dir/all] Error 2
  make: *** [all] Error 2

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

    [azdoud@video-processor CentOSsimple]$ make
    Scanning dependencies of target main
    [100%] Building CXX object CMakeFiles/main.dir/main.cpp.o
    Linking CXX executable main
    [100%] Built target main
    [azdoud@video-processor CentOSsimple]$ ll
    total 60
    -rw-rw-r--. 1 azdoud azdoud 13171 Jun  8 11:40 CMakeCache.txt
    drwxrwxr-x. 5 azdoud azdoud  4096 Jun  8 11:41 CMakeFiles
    -rw-rw-r--. 1 azdoud azdoud  1585 Jun  8 11:40 cmake_install.cmake
    -rw-rw-r--. 1 azdoud azdoud   166 Jun  8 11:39 CMakeLists.txt
    -rwxrwxr-x. 1 azdoud azdoud 18912 Jun  8 11:41 main
    -rw-rw-r--. 1 azdoud azdoud   435 Jun  8 11:02 main.cpp
    -rw-rw-r--. 1 azdoud azdoud  4646 Jun  8 11:40 Makefile
    [azdoud@video-processor CentOSsimple]$ ./main
    Width : 37
    Height: 69

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 .