vislearn/ngransac

How to make it work with opencv installed using pip?

Closed this issue · 7 comments

Using the path of the environment similar to the conda env path doesn't seem to work.. (trying it with opencv installed system-wide/manual compile seems to works fine)

ngransac.cpp:2:30: fatal error: opencv2/opencv.hpp: No such file or directory

Hi,

I would try the following:
pip show opencv

This should give you the folder of the pip opencv package. Within that folder, locate the folders
containing the opencv lib files and the opencv include directory (probably 'lib' and 'include' similar to conda?). Set the corresponding paths in the setup.py.

There is probably a way to automate this, too, similar to the conda approach in setup.py, but I'm not using pip, myself.

Yeah that's what I did. But i don't see any header file of opencv in 'include' like I find it while installing system-wide/manual compile (/usr/local/include/opencv2/opencv.hpp). I'll check the difference with the conda env and let you know.

(probably 'lib' and 'include' similar to conda?).

This is basically at the root of any environment, you have both 'lib' and 'include'

drwxrwxr-x bin
drwxrwxr-x etc
drwxrwxr-x include
drwxrwxr-x lib
drwxrwxr-x share

Looks like installing opencv using conda basically installs opencv, libopencv and the python binding.

libopencv 3.4.2 hb342d67_1
opencv 3.4.2 py27h6fd60c2_1
py-opencv 3.4.2 py27hb342d67_1

But the pip package is just the pre-compiled opencv with python binding which doesn't include headers [1]. [1] needs to be solved first to make it work with the opencv-python package.

[1] - opencv/opencv-python#22

You can check "/envs/ngransac/Library/include" and "/envs/ngransac/Library/lib".
I also need to rename some headers to remove the version part.
And then the setup.py will work well.

Thanks for sharing!

You can check "/envs/ngransac/Library/include" and "/envs/ngransac/Library/lib".

This is available in a conda environment not pip, in case I'm not wrong.

You can check "/envs/ngransac/Library/include" and "/envs/ngransac/Library/lib".

This is available in a conda environment not pip, in case I'm not wrong.

You are right. One has to download opencv compiled package from https://github.com/opencv/opencv/releases/tag/3.4.2
Then change setup.py file to point to include and lib folders inside opencv