Setting up OpenCV 3.0.0 + JetBrains CLion on Debian-based Linux Distros

Setting up OpenCV 3.0.0 + JetBrains CLion on Debian-based Linux Distros

Setting up OpenCV 3.0.0 + JetBrains CLion on Debian-based Linux Distros

Please watch in 720p Update & upgrade packages: sudo apt-get update -y && sudo apt-get dist-upgrade -y Install dependencies: sudo apt-get install python-dev python3-dev libgphoto2-dev python3-numpy python-numpy libv4l-dev libv4l2rds0 libgtk-3-dev libgstreamer-plugins-base1.0-dev libgst-dev cmake-qt-gui build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev libgstreamer-vaapi1.0-dev libavformat-dev libavformat-ffmpeg-dev -y Download OpenCV: https://github.com/Itseez/opencv/archive/3.0.0.tar.gz Download OpenCV extra modules: https://github.com/Itseez/opencv_contrib/archive/3.0.0.tar.gz Download CLion: https://www.jetbrains.com/clion/download/ Launch cmake-gui: cmake-gui You might need to disable GST if you encounter gst.h not found errors while compiling. To disable GST, uncheck WITH_GSTREAMER in cmake-gui. Compile & install: make -j4 # 4 is the number of my CPU cores sudo make install CMakeLists.txt additions: find_package(OpenCV REQUIRED) include_directories(${OpenCV_INCLUDE_DIRS}) target_link_libraries(binary_name ${OpenCV_LIBS}) # replace binary_name C++ sample codes can be found under opencv-3.0.0/samples/cpp. This video was recorded using Kazam & edited using LWKS.
КОММЕНТАРИИ:
Рейтинг 9.3 из 10 на основе 889 оценок и 889 отзывов.
Kvintus
Kvintus
Great job man, Thank you :)
Muhannad Ajjan
Muhannad Ajjan
Thank you for your feedback :) I'm glad you found it helpful.
karsh tharyani
karsh tharyani
When I run the application in CLION the window opens and then suddenly disappears after a fraction of seconds!!
karsh tharyani
karsh tharyani
Yes, I am. Here is the code if you wish to see: #include\u003copencv2/opencv.hpp\u003e #include\u003ciostream\u003e using namespace std; using namespace cv; int main() { VideoCapture cap(0); Mat frame; for(;;) { cap\u003e\u003eframe; if(frame.empty()) return 0; imshow("demo\
Muhannad Ajjan
Muhannad Ajjan
Are you sure you're waiting for a keypress inside an infinite loop?
霉小脑
霉小脑
谢谢&thx!
Joel
Joel
Hi there, I've tried following your instructions. Everything seems to work until I run the make command where I get the following error: [ 31%] Built target opencv_test_xfeatures2d_pch_dephelp make[1]: *** No rule to make target 'modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/all', needed by 'modules/stitching/CMakeFiles/opencv_stitching.dir/all'. Stop. make[1]: *** Waiting for unfinished jobs.... [ 31%] Built target opencv_perf_xfeatures2d_pch_dephelp [ 31%] Built target opencv_stitching_pch_dephelp Makefile:149: recipe for target 'all' failed make: *** [all] Error 2 Any help would be greatly appreciated
Joel
Joel
Hi Muhannad, thanks for getting back to me. Currently running Ubuntu 16.04. I downloaded OpenCV as per your instructional video :)
Muhannad Ajjan
Muhannad Ajjan
Hi Joel. What version of OpenCV are you trying to install? Also, what distro are you using? These instructions were made for OpenCV 3.0.0 and Ubuntu 14.04.
Yossi Neiman
Yossi Neiman
tnx.
Essraa Ahmedmagdy
Essraa Ahmedmagdy
Whenever I try to install the dependencies I get this : Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'libpng12-dev' instead of 'libpng-dev' Note, selecting 'libtiff5-dev' instead of 'libtiff-dev' Package libgstreamer-vaapi1.0-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Unable to locate package libavformat-ffmpeg-dev E: Package 'libgstreamer-vaapi1.0-dev' has no installation candidate Could you help please ?
Essraa Ahmedmagdy
Essraa Ahmedmagdy
Thanks very much , it works .
Muhannad Ajjan
Muhannad Ajjan
The problem was that one of the required files (the Intel® Integrated Performance Primitives library) wasn't downloaded properly. Run this in a terminal then try again: wget --continue "https://raw.githubusercontent.com/opencv/opencv_3rdparty/ippicv/master_20141027/ippicv/ippicv_linux_20141027.tgz" --output-document="/home/essraa/Programs/opencv-3.0.0/3rdparty/ippicv/downloads/linux-8b449a536a2157bcad08a2b9f266828b/ippicv_linux_20141027.tgz"; md5sum -c - \u003c\u003c\u003c "8b449a536a2157bcad08a2b9f266828b /home/essraa/Programs/opencv-3.0.0/3rdparty/ippicv/downloads/linux-8b449a536a2157bcad08a2b9f266828b/ippicv_linux_20141027.tgz" This downloads the broken file then makes sure it downloaded properly by verifying its checksum. If you get an error message like this "md5sum: WARNING: 1 computed checksum did NOT match" remove the file "ippicv_linux_20141027.tgz" and download it again. Don't worry about asking too much I'm happy to help :)
Essraa Ahmedmagdy
Essraa Ahmedmagdy
In the step of using cmake , I get this error after configuration "Error in configuration , project may be invalid" and the lower box shows this warning " CMake Warning at 3rdparty/ippicv/downloader.cmake:54 (message): ICV: Local copy of ICV package has invalid MD5 hash: d22bc6c8e0ea1cb24f21f28b86d2fab2 (expected: 8b449a536a2157bcad08a2b9f266828b) Call Stack (most recent call first): 3rdparty/ippicv/downloader.cmake:108 (_icv_downloader) cmake/OpenCVFindIPP.cmake:235 (include) cmake/OpenCVFindLibsPerf.cmake:12 (include) CMakeLists.txt:526 (include) ICV: Downloading ippicv_linux_20141027.tgz... CMake Error at 3rdparty/ippicv/downloader.cmake:71 (file): file DOWNLOAD HASH mismatch for file: [/home/essraa/Programs/opencv-3.0.0/3rdparty/ippicv/downloads/linux-8b449a536a2157bcad08a2b9f266828b/ippicv_linux_20141027.tgz] expected hash: [8b449a536a2157bcad08a2b9f266828b] actual hash: [c5a97a21a828ab63e400f5c5a4abd8a0] status: [18;"Transferred a partial file"] Call Stack (most recent call first): 3rdparty/ippicv/downloader.cmake:108 (_icv_downloader) cmake/OpenCVFindIPP.cmake:235 (include) cmake/OpenCVFindLibsPerf.cmake:12 (include) CMakeLists.txt:526 (include) CMake Error at 3rdparty/ippicv/downloader.cmake:75 (message): ICV: Failed to download ICV package: ippicv_linux_20141027.tgz. Status=18;"Transferred a partial file" Call Stack (most recent call first): 3rdparty/ippicv/downloader.cmake:108 (_icv_downloader) cmake/OpenCVFindIPP.cmake:235 (include) cmake/OpenCVFindLibsPerf.cmake:12 (include) CMakeLists.txt:526 (include) Configuring incomplete, errors occurred! See also "/home/essraa/Programs/opencv-3.0.0/build/CMakeFiles/CMakeOutput.log". See also "/home/essraa/Programs/opencv-3.0.0/build/CMakeFiles/CMakeError.log". Sorry for asking alot ..
Essraa Ahmedmagdy
Essraa Ahmedmagdy
Ok , Thank you very much (Y)
Muhannad Ajjan
Muhannad Ajjan
These packages have alternatives on some systems. If everything is working fine, you're good to go.
Yaoming Jiang
Yaoming Jiang
I followed your procedure and everything seemed to work until I got stuck with the configuration of the cmake file for the clion project. My platform is windows which may be a problem but clion is asking for a Findopencv.cmake file after i enter find_package(OPENCV REQUIRED). Any help is greatly appreciated.
Muhannad Ajjan
Muhannad Ajjan
I would love to help you but I'm not a Windows person. Development on Linux based operating systems is easier and much more straightforward. I will be making videos on this very topic soon so you might want to hit that subscribe button ;)
ille P.
ille P.
this video describes perfectly how to install the extra modules for opencv https://github.com/itseez/opencv_contrib good job =)
Muhannad Ajjan
Muhannad Ajjan
thank you for your feedback!
Shubham Biswas
Shubham Biswas
i need this track, awesome music :P
Muhannad Ajjan
Muhannad Ajjan
Fun fact: I added this track later when the original track was muted for copyright violation. :) You can download this track [Eine Kleine Nachtmusik by Mozart] directly from YouTube using this link: https://www.youtube.com/audiolibrary_download?vid=5f37e1a59d003588
Allak Khalid Aymane
Allak Khalid Aymane
thank you :)
p0w3rFloW
p0w3rFloW
Hi, thanks for your video! :) I think I did everything the same way you showed but I'm encountering linker error (undefined reference to '...' for all the OpenCV functions). Auto complete is working fine and I can compile it via g++ on terminal.. Do you have any idea why its not working?
Muhannad Ajjan
Muhannad Ajjan
+p0w3rFloW Also, please make sure you add all the required commands in CMakeLists.txt "find_package\
Muhannad Ajjan
Muhannad Ajjan
+p0w3rFloW Hi, thanks for your feedback. What version of Ubuntu are you using?
serdar kökçü
serdar kökçü
thank you!
Muhannad Ajjan
Muhannad Ajjan
+serdar kökçü thank you for your feedback!
Simon Beaulieu
Simon Beaulieu
You really saved my butt here ! It worked the first time ! Thank you very, very much.
Muhannad Ajjan
Muhannad Ajjan
+Simon Beaulieu glad to know i'm a butt saver. thank you for your feedback :)
Imad Hamoumi
Imad Hamoumi
thank you!