Tag Archives: Multi version

[solution] install opencv3 with opencv4

Step 1: Download opencv download, the source code compilation package of opencv3. Step 2: when cmake, enter: cmake - D cmake_ INSTALL_ PREFIX=/home/username/opencv3 -D CMAKE_ BUILD_ TYPE="Rlease" -D OPENCV_ GENERATE_ Pkgconfig = on.. Step 3: compile and install

    make
    make install

Step 4: configure the environment

    sudo vi  /etc/ld.so.conf.d/opencv.conf
    input: /home/username/opencv3/lib

Step 5: configure bashrc
VI ~ /. Bashrc , and add:

    #opencv-3.4.12
    export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/home/username/opencv3/lib/pkgconfig
    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./home/username/opencv3/lib

After saving, enter source ~ /. Bashrc
at this time, PKG config — modversion opencv will display 3.4.12, and opencv4 will display 4.2.0

Step 6: use opencv3
to edit CMakeLists.txt Before find (openCV required) , enter: set (cmake)_ PREFIX_ PATH "/home/username/opencv3")