How to Install OpenCV in Ubuntu for C / C++ (Ubuntu 18.04, Ubuntu 20.04 )

preview_player
Показать описание
In this post we will see How to Install OpenCV in Ubuntu for C/C++.
OpenCV is an image processing library created by Intel and later supported by Willow Garage and now maintained by Itseez. OpenCV means Intel® Open Source Computer Vision Library. It is a collection of C functions and a few C++ classes that implement some popular Image Processing and Computer Vision algorithms. OpenCV is Available on Mac, Windows, Linux (Terminal environment).

★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!
Рекомендации по теме
Комментарии
Автор

For all of you wondering how to fix the *Package opencv was not found...* Problem.
Use these commands instead:


pkg-config --modversion opencv4

g++ main.cpp -o output `pkg-config --cflags --libs opencv4`


Worked for me, hope I can save some time for someone, took me several hours to figure out what was wrong

davidgogelein
Автор

hey y'all if you were in 2020, there are two important comments in this whole chat. The fist made by @Jeff D'Stéfano Z. Cooper. And the second made by @Nhat Le Quoc Nhat. They really help! thanks!

dimasveliz
Автор

Thanks ! It works perfectly for me (Linux Mint 19.1 and Qt 5.12).
I had to change "python3.5-dev" to "python3.7-dev", and to remove "libjasper-dev" because apparently it doesn't exist anymore.

nero
Автор

It worked perfect, but I made a little change. Just as the user "nero" said: "I had to change 'python3.5-dev' to 'python3.7-dev', and removed 'libjasper-dev' because apparently it doesn't exist anymore." That was really usefull.

JeffryCooper
Автор

You are amazing. I was trying to build opencv from source to use the modules for this udacity course. I did it on a VM on vmware but now that I upgraded to windows pro 11 I decided to start using hyperV so I had to remake a new VM since converting the vmware to hyperV was causing issues. I remembered I did a tutorial and was looking for it for hours and now I finally found it. It was your tutorial! :)

alejandrosanchez
Автор

on command make -j4 i got error :



[84%]Built target opencv_bioinspired
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2


//Please Help

bhavukgarg
Автор

after you clone the opencv repo, you can choose which version you want to install using the 'git checkout' command. I ran 'git checkout 3.4' to install opencv 3.4. I also removed '-D from my cmake command, to avoid conflicts from changing my opencv version

nicolasperez
Автор

after I followed all the instructions and when run this command
$ pkg-config --modversion opencv
this what i get
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found

any one help me please?

mohammedhakeem
Автор

For everyone who had a problem after entering:
pkg-config --modversion opencv

Which showed:
"Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found"

Fix:
pkg-config --modversion opencv4

the package folder changed to opencv4 instead of opencv alone.

denver_dalman
Автор

@10:38 I get:

"Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found"

I went through the exact same steps several times and it still gives me this message. Any thoughts or solution?

samueldesantis
Автор

I'm on ubuntu 18.04
It worked for me...

Thanks !!

bldabirum
Автор

Íf u get "Package opencv was not found in the pkg-config" just run "sudo apt-get install libopencv-dev", works on ubuntu 18.04

chrizu
Автор

I followed the steps but instead of version 3.2.x , version 2.4.9.1 got installed....

Can you please tell me how to get 3.2.x version?

How this 2.4.9.1 version got installed?

parasgupta
Автор

hello! I followed all the procedures and everything went fine except for this error "No package 'tesseract' found" and the --modversion output for opencv is "2.4.9.1" can someone help me with this please

lamebene
Автор

Great video! This worked for me while the tutorial on opencv itself failed.

DominoDayLive
Автор

Please could you explain (or give a link) what happens in this part the command for compiling and linking the main.cpp : `pkg-config --cflags --libs opencv` ?

gullumpanie
Автор

if you got error: No pakage opencv found
try this one:
pkg-config --modversion opencv4

grapesalt
Автор

I followed all the instructions and it works! Thxs

guardiansortico
Автор

Just a quick note that when running "pkg-config --modversion opencv" it gave me an error saying
"
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
"


Instead run "pkg-config --modversion opencv4". It gives me the output for opencv4. If someone runs into issues maybe try other version like 2 or 3?

julianrendon
Автор

Thank you so much for this tutorial. Keep up the good work.

danpop