-
Notifications
You must be signed in to change notification settings - Fork 2
/
buildcv2.txt
37 lines (28 loc) · 1 KB
/
buildcv2.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Steps to build OpenCV2 on AppleSilicon
brew install wget
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.5.0.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.5.0.zip
unzip opencv.zip
unzip opencv_contrib.zip
cd opencv-4.5.0
mkdir build && cd build
cmake \
-DCMAKE_SYSTEM_PROCESSOR=arm64 \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DWITH_OPENJPEG=OFF \
-DWITH_IPP=OFF \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=<...>/opencv_contrib-4.5.0/modules \
-D PYTHON3_EXECUTABLE=<PATH_TO_YOUR_PYTHON_EXECUTABLE> \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D BUILD_EXAMPLES=ON ..
make
sudo make install
mdfind cv2.cpython & you get a few paths (select first (1))
cd <your python folder>/site-packages
ln -s /usr/local/lib/python3.10/site-packages/cv2/python-3.10/cv2.cpython-310-darwin.so cv2.so