6 Replies Latest reply on Apr 14, 2016 7:48 AM by BOBRAPHTONE

    openCV works in python but not in C++

    danaug

      I created my own eglibc and toolchain... I am able using python, to capture images, detect faces, etc... but everything is too slow...

       

      I decided to try to do the same using a real language like C++ with the eglibc toolchain that I compiled (7 hours compiling...  ).

       

      I tried this problem provided by intel IoT documents http://www.intel-software-academic-program.com/courses/diy/Intel_Academic_-_DIY_-_InternetOfThings/IntelAcademic_IoT_08_…:

       

      #include <cv.h>

      #include <highgui.h>

      using namespace cv;

       

       

      int main( int argc, char** argv )

      {

          char* imageName = argv[1];

          Mat image; image = imread( imageName, 1 );

          if( argc != 2 || !image.data )

          {

                printf( " No image data \n " ); return -1;

          }

          Mat gray_image;

          cvtColor( image, gray_image, CV_BGR2GRAY );

          imwrite("reslut.jpg", gray_image );

      return 0;

      }

       

           for some reason, after to transfer the code, the program tries to load GPU libraries and does not make any sense.. the error message is:

       

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

       

         I am compiling with: ${CXX} hello.cpp `pkg-config opencv --cflags --libs` -o hello


         Looks like the opencv we have in the recipes we have GPU support enabled somehow.. and it does not make any sense .. off course we do not have this on galileo.. I tried to download the opencv code and recompile everything with WITH_CUDA=OFF as recommended by this link http://docs.opencv.org/modules/gpu/doc/introduction.html but the compilation using intel compilers with this eglibc toolchain fails.. (I set my env variables calling source environment-setup-i586-poky-linux as expected as well)


         Considering the intel compiler were not able to build the latest opencv source code, I decided to changed the yocto opencv bb files and I manually included the DWITH_CUDA=OFF and guess what ? after hours compiling from scratch... same problem.

       

         How intel IoT get to rid of this libopencv_gpu.so.2.4: problem ? There is another question on this community complaining the same thing n and it was not answered properly. I am trying to provide more detail in order to see if someone can try to do the same thing and help me to find a solution..

       

      Thanks a million!