relatively new Ubuntu user here (but very familiar with OpenCV use on Windows). Having read this post:

What is the Linux equivalent to Windows' Program Files?

It's clear that there is not a direct Ubuntu/Linux equivalent of "Program Files" or "Program Files (x86)" in Windows.

For OpenCV installation, I followed this page:


which essentially involves going to here:


and running 3 scripts:




This works like a champ with Ubuntu 16.04, however I'm not clear on which directory to perform these steps from and therefore have the install located in.

If I open up a terminal by default it goes to the home directory for the current user, in my case for example that would be "/home/cdahms"

This seems like a very bad place to locate an OpenCV download/build/install (still not sure which to call it, again, relatively new to Linux) for at least the following reasons:

-The home directory is often used for other stuff and locating OpenCV here may result in inadvertent modification at a later time
-If a computer ever has multiple users it does not seem to make sense to place OpenCV in a certain user's home directory
-A home directory does not seem like a proper directory for a software install generally speaking

Based on this:


line 41:

set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory")

I'm under the impression that I should cd to "/usr/local", then run the above OpenCV install script. Is this correct? Where are most Ubuntu/OpenCV users installing to?

Note: I should mention that I'm NOT using the apt-get package "libopencv-dev" since that is on OpenCV version 2.4.9 currently, which is about 3.5 years old now. Does anybody have any ideas as to why this package is not updated more often?

  • 1
    I suspect it unpacks the source code to /home/cdahm, but actually installs the software to /usr/local - did you look there (/usr/local/include and /usr/local/lib) Sep 6, 2017 at 13:00
  • Good call. Following the above process (running the install-opencv.sh script) from the home directory resulted in installing OpenCV content to "/usr/local/bin", "/usr/local/include", "/usr/local/lib", and "/usr/local/share/" . So, I did "sudo mv /home/cdahms/OpenCV-3.2.0 /usr/local/src" and now everything is out of the home directory and into "/usr/local". For anybody else reading this for future reference, it would be best to run the "install-opencv.sh" script from "/usr/local/src", then it would not even be necessary to move anything.
    – cdahms
    Sep 6, 2017 at 13:42

1 Answer 1


for what it is worth, when I used Linux Mint 18.3
~ $ sudo apt-get install libopencv-dev python-opencv
I found python-opencv directory in /usr/share/doc/ directory and it also created /usr/share/OpenCV

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.