
다음과 같이 Ubuntu에 contrib 모듈과 함께 OpenCV3.2.0을 설치한 후: http://www.samontab.com/web/2017/06/installing-opencv-3-2-0-with-contrib-modules-in-ubuntu-16-04-lts/
Python 샘플 코드를 실행합니다.
cd <opencv3.2.0_dir>/samples/python/
python asift.py
다음과 같은 오류가 발생합니다.
Traceback (most recent call last):
File "asift.py", line 26, in <module>
import cv2
ImportError: /usr/local/lib/libopencv_freetype.so.3.2: undefined symbol: hb_shape
다른 Python 샘플을 실행하면 동일한 오류가 발생합니다.
Google에서 답을 찾지 못했습니다. 어떻게 해결하나요?
답변1
그건contrib 모듈의 알려진 버그, 특히 UTF-8 문자열을 그릴 수 있는 freetype 모듈에 있습니다.
OpenCV 3.2를 컴파일하기 전에 다음 명령을 실행하십시오.
sed -i 's/${freetype2_LIBRARIES} ${harfbuzz_LIBRARIES}/${FREETYPE_LIBRARIES} ${HARFBUZZ_LIBRARIES}/g' ../opencv_contrib-3.2.0/modules/freetype/CMakeLists.txt
그런 다음 Python 샘플을 실행할 수 있습니다.
그런데 이 수정 사항을 포함하도록 귀하가 링크한 튜토리얼도 업데이트했습니다.