Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
opencv_contribのビルド anaconda導入済みであること
#move to paticular folder...
#Tesseractに必要なライブラリの導入
brew install leptonica --all-languages
#opencv contrib tesseractの階層は同じとする
git clone https://github.com/opencv/opencv
git clone git@github.com:opencv/opencv_contrib.git
git clone git@github.com:tesseract-ocr/tesseract.git
#tesseractのビルド・インストール
cd tesseract
mkdir build
cd build
cmake ..
make -j4
make install
#pythonラッパーインストール
pip install pytesseract
#元のディレクトリに戻る
cd ../../
#opencv + contribのビルド・インストール
cd opencv
mkdir build
cd build
#cmake
cmake -D BUILD_TIFF=ON \
-D BUILD_opencv_java=OFF \
-D WITH_CUDA=OFF \
-D ENABLE_AVX=ON \
-D WITH_OPENGL=ON \
-D WITH_OPENCL=ON \
-D WITH_IPP=ON \
-D WITH_TBB=ON \
-D WITH_EIGEN=ON \
-D WITH_V4L=ON \
-D WITH_VTK=OFF \
-D CXXFLAGS=-std=c++14 \
-D CMAKE_CXX_FLAGS=-std=c++14 \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D CMAKE_BUILD_TYPE=RELEASE \
-D BUILD_opencv_python2=OFF \
-D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") \
-D PYTHON3_EXECUTABLE=$(which python3) \
-D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON3_LIBRARY=$(python -c "import site; print(site.getsitepackages()[0])") \
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D ENABLE_PRECOMPILED_HEADERS=OFF \
-D Tesseract_INCLUDE_DIR=../../tesseract/include \
-D Tesseract_LIBRARY=../../tesseract/lib ..
make -j4
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment