6

I have followed this guide to install OpenCV 2.4.8

OpenCV documentation says that I should find OpencV usr/local/include/opencv/ yet I find nothing.

Can someone tell me where to find the installed OpenCV files?


EDIT I'm not sure why the script installed OpenCV 2.4.8 instead of 2.4.9.

But I just found the files here here /usr/include/opencv and /usr/include/opencv2 I am not sure how that works but it does.

1
  • 1
    On Ubuntu 20.04, the OpenCV4 is located under /usr/include/opencv4 Mar 1, 2022 at 17:26

3 Answers 3

3

OpenCV is installed via checkinstall, have a look at the installer script.

Therefore you can check the installed files via

dpkg -L opencv-<version>

Eg:

dpkg -L opencv-2.4.8

If you have installed OpenCV via another script as you commented, open the script, find the line

make install

and replace with

sudo checkinstall

After that install checkinstall via

sudo apt-get install checkinstall

Now start the installer script again and check the installed files with

dpkg -L opencv

The installer script does exactly the same as before, but now it creates and installs a deb package.

1
3

Currently OpenCV 2.4 is provided via

sudo apt-get install libopencv

(if packages were not resolved try: libopencv* or opencv*)

Using package distribution from the Ubuntu repository may require you to update your indexes and packages (to be able to find actual OpenCV version available):

sudo apt-get update
sudo apt-get upgrade

After apt-get installing OpenCV, the latest available version (2.4.x) will be installed into your default system path:

/usr/local/lib - shared libraries (e.g. /usr/local/lib/libopencv-core2.4.x)
/usr/local/include - header files (e.g. /usr/local/include/opencv2)

See this guide (this is not my guide, so I am not aware if it is good or bad)

3
  • To add to this, $PATH environment variable should have /usr/local directory. Thus, whenever you compile your app this variable provides the default research directories for the compiler to search throught in order to find necessary dependencies. Jul 1, 2016 at 19:35
  • could you write example, please, I have three versions and I need to know their paths.@andrgolubev
    – REDHWAN
    May 29, 2020 at 10:44
  • @REDHWAN in theory, you might use "whereis" bash command to figure out the path to binary - linux.die.net/man/1/whereis Jun 8, 2020 at 9:34
2

Generally I follow this pattern:

cmake ..
make
sudo make install

Add /usr/local/lib to /etc/ld.so.conf.d/opencv.conf

sudo ldconfig

Then you can use

pkg-config --libs --cflags opencv 

to get all include and libs on Ubuntu

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .