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.

Raed
  • 173
  • 1
  • 1
  • 7

3 Answers3

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.

Zanna
  • 69,223
  • 56
  • 216
  • 327
A.B.
  • 89,123
  • 21
  • 245
  • 323
  • Thanks, apparently I installed 2.4.8 with this [script] (https://gist.github.com/smithjessk/bde98ec9297b38bad40c) But I get this `dpkg-query: package 'opencv-2.4.8' is not installed` – Raed Aug 04 '15 at 12:59
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)

Zanna
  • 69,223
  • 56
  • 216
  • 327
andrgolubev
  • 131
  • 4
  • 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. – andrgolubev Jul 01 '16 at 19:35
  • could you write example, please, I have three versions and I need to know their paths.@andrgolubev – REDHWAN May 29 '20 at 10:44
  • @REDHWAN in theory, you might use "whereis" bash command to figure out the path to binary - https://linux.die.net/man/1/whereis – andrgolubev Jun 08 '20 at 09: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

Zanna
  • 69,223
  • 56
  • 216
  • 327
Deep
  • 21
  • 2