User Tools

Site Tools


installing_opencv4_on_ubuntu_18

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
installing_opencv4_on_ubuntu_18 [2021/07/02 23:02] dongbinkiminstalling_opencv4_on_ubuntu_18 [2021/07/02 23:17] (current) dongbinkim
Line 1: Line 1:
 <fs x-large>**Installing OpenCV4 on Ubuntu 18 and adding it to ROS**</fs>\\ <fs x-large>**Installing OpenCV4 on Ubuntu 18 and adding it to ROS**</fs>\\
 \\ \\
-**Author:** Leonardo Georgescu, Dongbin Kim (Edit 2021-07-02) \\+**Author:** Leonardo Georgescu, Dongbin Kim \\
 **Email:** georgl3@unlv.nevada.edu\\ **Email:** georgl3@unlv.nevada.edu\\
-**Date:** Last Edited 01-29-2020\\+**Date:** Last Edited 07-02-2021 by Dongbin Kim\\
 **Keywords:** Dynamixel, Gantry, Ubuntu 18, OpenCV, ROS **Keywords:** Dynamixel, Gantry, Ubuntu 18, OpenCV, ROS
 \\ \\
Line 18: Line 18:
   dasl@dasl-XPS-8900:~$ sudo apt-get autoremove   dasl@dasl-XPS-8900:~$ sudo apt-get autoremove
      
-3. Delete all the existing libraries:+3. Delete all the existing OpenCV libraries:
   dasl@dasl-XPS-8900:~$ sudo find /usr/local/ -name "*opencv*" -exec rm {} \;   dasl@dasl-XPS-8900:~$ sudo find /usr/local/ -name "*opencv*" -exec rm {} \;
  
-4. Update packages on Ubuntu:+4. Update and upgrade packages on Ubuntu:
   dasl@dasl-XPS-8900:~$ sudo apt-get update    dasl@dasl-XPS-8900:~$ sudo apt-get update 
-   +  dasl@dasl-XPS-8900:~$ sudo apt-get upgrade 
-5. Install build-essential packages:+     
 +5. Install build-essential and cmake packages:
   dasl@dasl-XPS-8900:~$ sudo apt-get install build-essential cmake   dasl@dasl-XPS-8900:~$ sudo apt-get install build-essential cmake
    
Line 43: Line 44:
   dasl@dasl-XPS-8900:~$ sudo apt-get install libgtk2.0-dev   dasl@dasl-XPS-8900:~$ sudo apt-get install libgtk2.0-dev
      
-11. Install OpenGL:+11. Install OpenGL libraries:
   dasl@dasl-XPS-8900:~$ sudo apt-get install mesa-utils libgl1-mesa-dri libgtkgl2.0-dev libgtkglext1-dev   dasl@dasl-XPS-8900:~$ sudo apt-get install mesa-utils libgl1-mesa-dri libgtkgl2.0-dev libgtkglext1-dev
      
-12. Install OpenCV: +12. Install libraries to optimize OpenCV: 
   dasl@dasl-XPS-8900:~$ sudo apt-get install libatlas-base-dev gfortran libeigen3-dev   dasl@dasl-XPS-8900:~$ sudo apt-get install libatlas-base-dev gfortran libeigen3-dev
      
Line 52: Line 53:
   dasl@dasl-XPS-8900:~$ sudo apt-get install python2.7-dev python3-dev python-numpy python3-numpy   dasl@dasl-XPS-8900:~$ sudo apt-get install python2.7-dev python3-dev python-numpy python3-numpy
      
-14. Create OpenCV directory:+14. Create OpenCV directory then move on:
   dasl@dasl-XPS-8900:~$ mkdir opencv   dasl@dasl-XPS-8900:~$ mkdir opencv
   dasl@dasl-XPS-8900:~$ cd opencv   dasl@dasl-XPS-8900:~$ cd opencv
Line 74: Line 75:
   dasl@dasl-XPS-8900:~/opencv/opencv-4.2.0/build$    dasl@dasl-XPS-8900:~/opencv/opencv-4.2.0/build$ 
      
-19. Produce pkg-config files in your build file. Could not upload the code here because daslhub would not accept it. To find the code go to the original page which is linked at the top and copy accordingly. If you can't find it, please email me.  +19. Utilize 'cmake' to configure OpenCV complie settings  
-  dasl@dasl-XPS-8900:~/opencv/opencv-4.2.0/build$ cmake -D CMAKE_BUILD_TYPE=RELEASE.................... +  dasl@dasl-XPS-8900:~/opencv/opencv-4.2.0/build$  
-  +  cmake -D CMAKE_BUILD_TYPE=RELEASE 
 +  -D CMAKE_INSTALL_PREFIX=/usr/local \ 
 +  -D WITH_TBB=OFF \ 
 +  -D WITH_IPP=OFF \ 
 +  -D WITH_1394=OFF \ 
 +  -D BUILD_WITH_DEBUG_INFO=OFF \ 
 +  -D BUILD_DOCS=OFF \ 
 +  -D INSTALL_C_EXAMPLES=ON \ 
 +  -D INSTALL_PYTHON_EXAMPLES=ON \ 
 +  -D BUILD_EXAMPLES=OFF \ 
 +  -D BUILD_TESTS=OFF \ 
 +  -D BUILD_PERF_TESTS=OFF \ 
 +  -D WITH_QT=OFF \ 
 +  -D WITH_GTK=ON \ 
 +  -D WITH_OPENGL=ON \ 
 +  -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.2.0/modules \ 
 +  -D WITH_V4L=ON 
 +  -D WITH_FFMPEG=ON \ 
 +  -D WITH_XINE=ON \ 
 +  -D BUILD_NEW_PYTHON_SUPPORT=ON \ 
 +  -D OPENCV_GENERATE_PKGCONFIG=ON ..
 + 
 +if you see the message like below, you successfully finished configuration 
 +  - Configuring done 
 +  - Generating done 
 +  - Build files have been written to: /home/webnautes/opencv/opencv-4.2.0/build 
 + 
 +You may have hard time doing the job here, if you are in trouble, please let us know, or look at the link the top of the tutorialEverything is explained in Korean, but you will understand if you run "Translate this page" in Google Chrome 
 20. Installation should be successful. Then, check how many cores you have available on the computer:  20. Installation should be successful. Then, check how many cores you have available on the computer: 
   dasl@dasl-XPS-8900:~$ lscpu   dasl@dasl-XPS-8900:~$ lscpu
installing_opencv4_on_ubuntu_18.1625292177.txt.gz · Last modified: 2021/07/02 23:02 by dongbinkim