Skip to content
This repository was archived by the owner on Jun 9, 2021. It is now read-only.

can someone help with installing cv2. #79

Open
vivek-ram opened this issue Dec 19, 2020 · 14 comments
Open

can someone help with installing cv2. #79

vivek-ram opened this issue Dec 19, 2020 · 14 comments

Comments

@vivek-ram
Copy link

hi i am using conda environment i need to installcv2 is there any why i can install cv2 ??

@beraekoklu
Copy link

Duplicate of #67

@bjajoh
Copy link

bjajoh commented Dec 23, 2020

got opencv and conda working correctly. I documented my procedure here and will add more in the future.
https://github.com/bjajoh/cv2-tf-scipy-for-arm-mac/blob/main/README.md

This is what I came up with:

cmake -DCMAKE_BUILD_TYPE=Release \
-DBUILD_opencv_python2=OFF \
-DBUILD_opencv_python3=ON \
-DPYTHON3_EXECUTABLE=`which python3` \
-DPYTHON3_INCLUDE_DIR=~/miniforge3/envs/python38/include/python3.8 \
-DPYTHON3_PACKAGES_PATH=~/miniforge3/envs/python38/lib/python3.8 \
-DPYTHON3_NUMPY_INCLUDE_DIR=~/miniforge3/envs/python38/lib/python3.8/site-packages/numpy/core \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DOPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-DOPENCV_ENABLE_NONFREE=ON \
../opencv

@vivek-ram
Copy link
Author

@bjajoh 'cmake -DCMAKE_BUILD_TYPE=Release ' where implement this ?? i mean how to do this. should we create a cmakelist.txt file in build_opencv directory ? or what

@bjajoh
Copy link

bjajoh commented Dec 23, 2020

@vivek-ram The last line shows the location. When following my guide, there should be a source folder with OpenCV in your home directory. Furthermore, make sure to install CMake. I installed it from source.
After preparing everything it should build the source files from "~/opencv" in the "build_opencv" folder and install everything afterwards correctly. But remember to adjust the Paths. User --> "Your Name"

git clone https://github.com/Kitware/CMake.git
./bootstrap && make && sudo make install

Here is the full guide: https://github.com/bjajoh/cv2-tf-scipy-for-arm-mac/blob/main/README.md

@vivek-ram
Copy link
Author

@bjajoh i copied and pasted the cmake thing but i an error.
Screenshot 2020-12-23 at 9 27 54 pm

@bjajoh
Copy link

bjajoh commented Dec 23, 2020

Interesting, I documented everything after I finally managed to get everything working, so there is the risk that I missed a small detail. Is there a more detailed error message? Did you clone both repositories correctly in your home folder? So "opencv_contrib" and "opencv"?

@vivek-ram
Copy link
Author

@bjajoh yeah i did.

@bjajoh
Copy link

bjajoh commented Dec 23, 2020

It is hard to say what is wrong without any specific error. Maybe check the output of that cmake command and try to see if anything there seems wrong.

@vivek-ram
Copy link
Author

@bjajoh nothing seems wrong bro.

cmake -DCMAKE_BUILD_TYPE=Release
-DBUILD_opencv_python2=OFF
-DBUILD_opencv_python3=ON
-DPYTHON3_EXECUTABLE=which python3
-DPYTHON3_INCLUDE_DIR=/Users/vivekd/miniforge3/envs/python38/include/python3.8
-DPYTHON_INCLUDE=/Users/vivekd/miniforge3/envs/python38/include/python3.8
-DPYTHON3_PACKAGES_PATH=$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDEST'))")
-DPYTHON3_NUMPY_INCLUDE_DIR=/Users/vivekd/miniforge3/envs/python38/lib/python3.8/site-packages/numpy/core
-DCMAKE_INSTALL_PREFIX=/usr/local
-DOPENCV_EXTRA_MODULES_PATH=/Users/vivekd/opencv_contrib/modules
-DOPENCV_ENABLE_NONFREE=ON
../opencv

this is what i used. i followed your steps and i copied this in terminal it was good. next when i run make j7 getting that error 2

@sanmeow
Copy link

sanmeow commented Jan 2, 2021

@bjajoh nothing seems wrong bro.

cmake -DCMAKE_BUILD_TYPE=Release
-DBUILD_opencv_python2=OFF
-DBUILD_opencv_python3=ON
-DPYTHON3_EXECUTABLE=which python3
-DPYTHON3_INCLUDE_DIR=/Users/vivekd/miniforge3/envs/python38/include/python3.8
-DPYTHON_INCLUDE=/Users/vivekd/miniforge3/envs/python38/include/python3.8
-DPYTHON3_PACKAGES_PATH=$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDEST'))")
-DPYTHON3_NUMPY_INCLUDE_DIR=/Users/vivekd/miniforge3/envs/python38/lib/python3.8/site-packages/numpy/core
-DCMAKE_INSTALL_PREFIX=/usr/local
-DOPENCV_EXTRA_MODULES_PATH=/Users/vivekd/opencv_contrib/modules
-DOPENCV_ENABLE_NONFREE=ON
../opencv

this is what i used. i followed your steps and i copied this in terminal it was good. next when i run make j7 getting that error 2

I faced the same problem. Solved by using this article's way.
https://sayak.dev/install-opencv-m1
I still faced the same error 2.
Some other parts trying, don't know which one made the compile finish.
1.Don't build inside using virtual environment.
2. Update Eigen to 3.3.9
Really happy it got solved.

@isuruf
Copy link

isuruf commented Jan 3, 2021

You can now install using conda conda install opencv

@vivek-ram
Copy link
Author

@isuruf wow thanks bro finally solved.

@bjajoh
Copy link

bjajoh commented Jan 4, 2021

Yeah, that's awesome! But it could still be an issue if you want to compile the dnn stuff of opencv 4 together with the accelerated Tensorflow. Conda only works out if you're not using the DNN Features of opencv.

@isuruf
Copy link

isuruf commented Jan 4, 2021

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants