opencv in the x86 architecture and the environment to build arm architecture

Install opencv, you can call in c or c ++ opencv in

      1, the installation from the library is the easiest way to directly run the following command:

             sudo apt-get install libopencv-dev python-opencv

             If an installation error, you can update at the source, or from a different source.

      2, to test whether the installation was successful:

            Run the command: pkg-config --cflags --libs opencv information appears below

            licaibiao@ubuntu:~/test/OpenCV$ pkg-config --cflags --libs opencv

            -I/usr/local/include/opencv -I/usr/local/include -L/usr/local/lib -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -                         lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core

      3, run a simple program test.cpp:

            #include <opencv/cv.h>

            #include <opencv/highgui.h>

            #include <iostream>

            using namespace std;

            using namespace cv;

 

            int main ()

            {

                char c;

                CvCapture * capture = cvCreateCameraCapture (0); // corresponding to the camera view is the date

                if (!capture)

                {

                    printf("Fail\n");

                }

                IplImage* src;

                for (;;)

               {

                   src = cvQueryFrame(capture);

                   cvShowImage("Input", src);

                   c = waitKey(10);

                   if (c == 27) break;

               }

              return 0;

            }

      4. Compile method:

        a, compiled by cmake

              First, add a CMakeLists.txt file, as follows:

                      project(test)

                      find_package(OpenCV REQUIRED)

                      add_executable(test test)

                      target_link_libraries(test ${OpenCV_LIBS})

              Then cmake,

              After the re-make,

              Generate an executable file test.

              ./test。

        b, g ++ compiler through

              Execute the command: g ++ test.cpp -o test `pkg-config --cflags --libs opencv`

                   Note: There are two `pkg-config --cflags --libs opencv` dot above, is the symbol of the left side of the keyboard 1.

              Generate an executable file test.

              ./test。

      5, there is a problem:

        If ./test appears: error while loading shared libraries: libopencv_highgui.so.3.2: can not open shared object file: No such file or directory error, that is the path to the dynamic link library did not add good, can add the following way:

        1, opened with vim /etc/ld.so.conf, pay attention to use sudo to get permission to open, or can not be modified, such as: sudo vim /etc/ld.so.conf, add a line at the end of the file in / usr / local / lib

        2, run:

            sudo ldconfig

        3, modify bash.bashrc file:

            sudo came /etc/bash.bashrc

        4, the end of the file is added:

            PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

            export PKG_CONFIG_PATH

        5, the last execution:

            source /etc/bash.bashrc

Install opencv, you can call directly in python opencv

     It is confirmed python environment 3.5.

     Then install the command: sudo pip3 install opencv-python

     Error / var / cache / apt / archives / related, installed by the following command:

          sudo dpkg -i --force-overwrite /var/cache/apt/archives/python-problem-report_2.0.1-0ubuntu9_all.deb

          sudo apt-get -f install

     View opencv Version:

          pkg-config --modversion opencv

 

 

**************************************************************************************************************************

**************************************************************************************************************************

**************************************************************************************************************************

 

 

These are set up in the x86 architecture environment.

Here is the arm architecture environment to build.

In the arm architecture opencv environment to build, you can call directly in python opencv API

Ubuntu on the arm architecture compiled opencv library, then the library will be compiled package upload to arm architecture. (Follow-up put compiled library links)

First execute:
tar zxcf python3_cv2.tar.gz
mv python3_cv2 / python3.5 / Site-Packages Standard Package / cv2.cpython-35m-aarch64-linux-gnu.so /usr/local/lib/python3.5/dist-packages/
RM python3_cv2 / python3.5 / -r
mv python3_cv2 / * / usr / local / lib /

Verification of use in python opencv feasibility

Run error, in execution:
sudo install python3 APT-numpy

Published 26 original articles · won praise 34 · views 90000 +

Guess you like

Origin blog.csdn.net/qq_36662437/article/details/97627520