1 2 Previous Next 27 Replies Latest reply on Sep 26, 2015 10:12 AM by AlexT_Intel

    Opencv on Edison

    broody

      Hi,

       

      I followed the instructions from edison-bsp_ug_331188-001%20.pdf and generated a custom image with only opencv added.

       

      When I try to run my opencv program I get the following errors:

      "error while loading shared libraries: libopencv_imgproc.so.2.4: cannot open shared object file: No such file or directory"

       

      I can upload the libraries manually one by one until it stops complaining but why doesn't my generated image already contain these libraries?

       

      Thanks.

        • 1. Re: Opencv on Edison
          intel_dan

          I had the same problem. I fixed it by adding

           

          IMAGE_INSTALL += "opencv libopencv"    (incorrect, see Edit below)

           

          instead of just

           

          IMAGE_INSTALL += "opencv"

           

          I am away from my build machine right now, when I get a chance, I will check and see if I changed any other settings,etc.

           

           

          EDIT:

           

          I checked my config out and here is what I added to include opencv/libs in my yocto image

           

          IMAGE_INSTALL += "opencv opencv-dev opencv-apps"

          PACKAGECONFIG_pn-opencv="eigen jpeg libav png tiff v4l"

          2 of 2 people found this helpful
          • 2. Re: Opencv on Edison
            broody

            Awesome! Thanks for the fast reply. I will test this out at home tonight.

            • 3. Re: Opencv on Edison
              broody

              Hi Dan, it worked and now I can run my program. But my program is not finding a video capture device. When I plug in the webcam I can see the device with lsusb but there is no /dev/video*. Do I need additional drivers for usb webcam?

               

              Thanks

               

               

              BTW, here's my simple c++ program I use to test

               

              #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;

              }

              • 4. Re: Opencv on Edison
                broody

                Nevermind, just got it to work

                 

                Followed the instructions from this post: https://communities.intel.com/message/247757#247757

                • 5. Re: Opencv on Edison
                  AlexT_Intel

                  For anyone interested, I've just added latest stable OpenCV 2.4.9 into the package repo, so you can install it without building your own image.

                  1 of 1 people found this helpful
                  • 6. Re: Opencv on Edison
                    rhinosticks2015

                    Hi, just received my edison a few days ago. Right now I have installed the opencv package. Where does opkg install the opencv package and how do I link the opencv library? In my linux desktop and raspberry pi, I usually add `pkg-config --cflags --libs opencv`. For a sample program I type, g++ test.cpp -o test `pkg-config --cflags --libs opencv`.


                    Cheers

                    Paul

                    • 7. Re: Opencv on Edison
                      AlexT_Intel

                      Hi rhinosticks2015

                       

                      You can do the same on Edison, just install the pkgconfig package first with "opkg install pkgconfig".

                      • 8. Re: Opencv on Edison
                        rhinosticks2015

                        Thanks.


                        I had to install apps and dev as well (ECE597 Opencv on the BeagleBoard - eLinux.org). I recall the linux and odroid, I compiled and installed. Raspberry PI, I used the package maanger.


                         

                        • 9. Re: Opencv on Edison
                          rhinosticks2015

                          I do have one error when I compiled my code.

                          My make file:

                           

                          all: main.cpp

                            g++ -ggdb -pthread main.cpp `pkg-config --cflags opencv` -o test`pkg-config --libs opencv`

                          clean:

                            $(RM) test

                           

                          I include the following headers in the code:

                           

                          #include "opencv2/core/core.hpp"

                          #include "opencv2/video/background_segm.hpp"

                          #include "opencv2/imgproc/imgproc_c.h"

                          #include "opencv2/imgproc/imgproc.hpp"

                          #include "opencv2/highgui/highgui.hpp"

                          #include "opencv2/legacy/legacy.hpp"

                          #include "opencv2/video/tracking.hpp"

                          #include "opencv2/photo/photo.hpp"

                           

                          This works fine on my other platforms.

                          • 10. Re: Opencv on Edison
                            AlexT_Intel

                            Not sure what exactly do you mean, but if you're referring to the fact that you had to install opencv-dev package, then yes, that's necessary, I thought you knew that already and your only problem was that pkg-config command didn't work.

                             

                            -dev packages contain necessary headers, so if you want to compile something against some library, then you need a corresponding -dev package. That's the same on pretty much any commonly used Linux distro out there.

                            • 11. Re: Opencv on Edison
                              Shaffiq

                              Hi broody

                               

                              I still new with Intel Edison ...May I know how you connect the camera to your Intel Edison? and what type of camera you used?

                               

                              If I'm using windows how the step to put the install openCV to Intel Edison...(Sorry Still Newbie)

                               

                              Hopefully you can help me...thanks..

                              • 12. Re: Opencv on Edison
                                AlexT_Intel
                                1. Update your board with the latest OS image from the Downloads section of this community
                                2. Configure it to connect to my package repo using these instructions: Edison Package Repo Configuration Instructions
                                3. Install uvcvideo kernel module by running "opkg install kernel-module-uvcvideo" on the board (to be able to do that you need to log in there using SSH client - see Quick Start Guide for setting up PuTTY for that)
                                4. Get a webcam, which is supported by the uvcvideo module (one of these: Linux UVC driver & tools)
                                5. Connect it to Edison using the big USB type A port closer to the power connector, ensure that the mechanical switch near it is flipped towards the port. This is for the Arduino expansion board. For mini-breakout board you'll need a microUSB-full size USB adapter and you don't need to flip a switch, otherwise the process is the same.
                                6. After connecting the webcam, run "modprobe uvcvideo" via SSH on the board (uvcvideo and several videobuf* modules should appear in the "lsmod" command output) - and you should be good to go!
                                • 13. Re: Opencv on Edison
                                  Gagav

                                  Hi everybody, thanks for a useful thread here.

                                   

                                  I'm trying to make an OpenCV application that works on Edison now.

                                   

                                  I've gone through getting opencv package on my Edison, but am having a trouble setting up the cross compile environment.

                                  I'm using Eclipse on Windows 7 and can switch to Ubunto 14 if needed. I don't know how to use opencv library to make an application that works on Edison.

                                   

                                  Do I need to build OpenCV library for Linux 32bit or something?

                                  Please tell me how you guys setup your environment to build OpenCV applications for Edison.

                                   

                                  Thanks !

                                  • 14. Re: Opencv on Edison
                                    AlexT_Intel

                                    I haven't used Eclipse specifically for this, just the command line, so I'll describe that piece. Eclipse one may be covered if you look at the IoT DevKit instructions, check them out: https://software.intel.com/en-us/iot

                                     

                                    So you can

                                    1. Compile directly on Edison. Just install opencv-dev package using my repo and "opkg install opencv-dev" and you should be able to run something like "g++ opencv_ex1.cpp 'pkg-config opencv --cflags  --libs' -o opencv_ex1" to compile it. Just search for "opencv" using the Community search, there are quite a few threads with example commands;
                                    2. Compile on your host system (Windows or Linux), using command line and cross-compilation toolchain. Pretty much the same as the above, but you run it on your host instead. Download the toolchain from here: Edison - Software Downloads (links with "SDK" in them, pick the one corresponding to your OS).
                                    3. Use IoT DevKit. I haven't used this one yet, so read the docs on that site I referred to above or let's see if someone else has something to say about this one.
                                    1 2 Previous Next