14 Replies Latest reply on May 19, 2016 9:12 AM by Yousef

    Error compiling opencv code on Edison

    0gravity

      Hello everyone, I am trying to compile one of the opencv examples (opencv_version.cpp). I have successfully installed opencv on my edison board with the arduino expansion card using this tutorial https://software.intel.com/en-us/articles/opencv-300-beta-ipp-tbb-enabled-on-yocto-with-intel-edison

       

      Does someone has any ideas to what the errors am getting might be related to. (I have posted the picture below)

       

      Thanks. Really appreciate any ideas.

       

       

       

        • 1. Re: Error compiling opencv code on Edison
          mhahn
          • I guess some dependencies are unresolved in your case (missing OpenCV dev packages)
          • if you can live with OpenCV 2.4 as well you might consider taking prebuilt packages e.g. from AlexT_Intel repo: Index of /edison/repo/core2-32
          • if you do have a Yocto build environment set up it might be easier (faster) to build there rather than on the target
          • 2. Re: Error compiling opencv code on Edison
            0gravity

            Hi mhahn thanks for your reply. Do you know or does anyone know any tutorial for a beginner describing how to install and run an opencv example using AlexT_Intel repo?

            • 3. Re: Error compiling opencv code on Edison
              0gravity

              I am using this command to compile now: g++ -o opencv_version opencv_version.cpp `pkg-config opencv --cflags --libs`

               

              but I get a different error now: Does anyone have seen this before?

               

               

              • 4. Re: Error compiling opencv code on Edison
                mhahn

                Looks like your OpenCV installation is faulty as libopencv_core.a has undefined references. How did you install opencv?

                Maybe try dynamically linking?

                Can you try linking the opencv libs directly rather than via pkg-config?

                I.E. something like -lopencv_core ...

                • 5. Re: Error compiling opencv code on Edison
                  0gravity

                  Thank you so much for your response,

                   

                  I have tried using this command:

                   

                  g++ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L/usr/local/lib -g -o binary openc

                  v_version.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopen

                  cv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_stitch

                  ing

                   

                  but I still get the same error as above. Do you know of any complete tutorial of how to get opencv installed and compiled successfully with a USB camera?

                   

                  I have looked at the AlexT_Intel repo but I don't know which opencv packet to install. I which there was a tutorial that describes step by step.

                  • 6. Re: Error compiling opencv code on Edison
                    mhahn

                     

                     

                    g++ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L/usr/local/lib -g -o binary openc

                    v_version.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopen

                    cv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_stitch

                    ing

                     

                    but I still get the same error as above. Do you know of any complete tutorial of how to get opencv installed and compiled successfully with a USB camera?

                     

                    ok, so it's definitely a bad installation - did you compile opencv for eglibc?

                     

                     

                    I have looked at the AlexT_Intel repo but I don't know which opencv packet to install. I which there was a tutorial that describes step by step.

                     

                    you would definitely need libopencv-core2.4 and libopencv-core-dev. On the others: just check which opencv domain the cv functions you use are in. Why not just install all of them?

                    • 7. Re: Error compiling opencv code on Edison
                      AlexT_Intel

                      I'd second that. It most definitely looks like you just haven't installed one of the dependency opencv packages, 0gravity . You need at least opencv-dev and opencv-staticdev packages + all the libopencv* packages your program actually uses.

                      • 8. Re: Error compiling opencv code on Edison
                        0gravity

                        Hey guys thanks a lot for the replies.

                         

                        So I did installed opencv-dev and opencv-staticdev and compiled this code:

                         

                        #include <iostream>

                        #include "opencv2/opencv.hpp"

                        using namespace std;

                        using namespace cv;

                         

                        int main() {

                          VideoCapture cap(0);

                          if(!cap.isOpened()) {

                          cout << "I'm blind..." << endl;

                          return -1;

                          }

                          cout << "I can see!" << endl;

                          return 0;

                        }

                         

                        using: g++ test.cpp `pkg-config opencv --cflags --libs` -o test

                         

                        And it works! So thanks a lot mhahn and AlexT_Intel

                         

                        So now I can capture video and stuff but I can't see anything because everything is on the Edison Do you guys know of any way that I can see the video?

                         

                        Thanks a lot for all the help.

                        • 9. Re: Error compiling opencv code on Edison
                          mhahn
                          • streaming video (DLNA ...)
                          • USB graphics card
                          • ...
                          • 10. Re: Error compiling opencv code on Edison
                            ManojVangala

                            Hi, i have followed this tutorial  OpenCV 3.0.0-beta ( IPP & TBB enabled ) on Yocto with Intel® Edison | Intel® Developer Zone and installed opencv on my edison board and now when i try to compile and run opencv programs using cmake iam getting various errors, i have re flashed the board several times since i didnt enable the v4l2, but the problem still persists. can you please give a brief explanation on how to compile and run opencv applications on my board? iam trying to capture video from a webcam and process i for obstacle detection. It would be very helpful if you guys can even point me to the right website where i can find more useful information about it.

                             

                            Thank you.

                            • 11. Re: Error compiling opencv code on Edison
                              0gravity

                              Hey ManojVangala I follow that tutorial too! and I had some problems. So I just follow that tutorial until he part it says to expand the root partition and then I just installed opencv by doing:

                               

                              opkg install opencv-dev

                              opgk install opencv-staticdev

                               

                              before doing the above commands you need to go to the AlexT_Intel repo and follow those instructions.

                               

                              after this you should be able to compile the sample code I posted above.

                              • 12. Re: Error compiling opencv code on Edison
                                jbuechel

                                Hey,

                                 

                                I'm pretty new to this community and started working with my edison a few weeks ago. I am currently trying to setup OpenCV on my edison and get the program Test.cpp running (FYI it contains the exact same code as yours). When I start the program in Putty I get nothing back. Not even an error. I think this is a good  sign, but should I be able to see the message  "I'm blind"? Or is it just because I am not executing my program from an IDE like e.g. Eclipse? My 3. question is what packages I should install to be able to use CannyEdge Detection and HoughCircles (HairCascade)?

                                 

                                Thank you

                                • 13. Re: Error compiling opencv code on Edison
                                  mhahn

                                  don'T know which "Test.cpp" you are talking - but way not adding debug output messages?

                                  It doesn't matter whether you run your program from Eclipse or from the terminal (PuTTy ...) at the end you are always executing a binary on your target

                                  #3: I guess you'll find the answer looking into OpenCV docs? Maybe check the required imports and check which package contains those

                                  • 14. Re: Error compiling opencv code on Edison
                                    Yousef

                                    Hi