Python3-opencv versus opencv-python

I was wondering what is the difference between the two ways of using opencv from python given that opencv-python is now officially part of the opencv project

  1. apt installing python3-opencv
  2. Pip installing opencv-python

Thanks

some “maintainer”, not affiliated with OpenCV, maintains that package, i.e. takes care that OpenCV is built in some way and then packaged appropriately for that operating system. these maintainers may not pay very close attention to when new releases of OpenCV happen. that is why it is a lot more likely to be stale. by how much, depends on the maintainer.

that’s the difference. opencv-python, on PyPI, is built using infrastructure controlled by the OpenCV team, as soon as they release a new version of the library itself.

Thanks. In that case, for using python with opencv, is installing opencv-python through pip the only requirement (given they are statically linked with OpenCV in the wheel).

Unless I am missing something, the Opencv python documentation only mentions about python3-opencv and not about installing opencv-python using pip. So was wondering what the right approach is.

disregard that entire article. that article is stale.

It is quite easy. But there is a problem with this. Apt repositories may not contain the latest version of OpenCV always. For example, at the time of writing this tutorial, apt repository contains 2.4.8 while latest OpenCV version is 3.x

it doesn’t even say when it was written. probably over 5 years ago. “articles” in the OpenCV docs are usually written once by someone who is not a core developer, then forgotten about.

Thanks for the responses !

So, is the OS installed OpenCV just a certain version of OpenCV’s CPP core, which the python opencv python package is linking to at runtime, or does the python opencv package bring in all of OpenCV self-contained such that it does not ever link to the OS installed OpenCV?

no, that is not the case.

yes, that is the case.

1 Like