OpenCV 3.0.0-beta compiling support for Python3-linked libraries

Source: Internet
Author: User

The official compiled OpenCV only with the Python2 link library, Python3 's link library needs to be specially compiled by itself, the official compiled version: http://sourceforge.net/projects/opencvlibrary/files/ opencv-win/3.0.0-beta/

1. Unzip Opencv-3.0.0-beta.exe to d:/, install Cmake-2.8.12.2-win32-x86.exe, install Python3.4 (32-bit) and Python needs to be installed NumPy

2. CMake Settings:

1) cmake Select compiler for Visual Studio 10

2) Build type only need to hook the Build_opencv_python3

3) Generate OPENCV vs Project

3. Only need to compile the Bindings/opencv_python part, but the Chinese Win7 system will get the following error:

' GBK ' codec can't decode byte 0xff in position 0:illegal multibyte sequence1

Need to modify D:\opencv\sources\modules\python\src2\hdr_parser.py

1) Line 4th Add Codecs Library: Import OS, sys, RE, string, codecs

2) Line No. 737: F = Codecs.open (Hname, "R", "Utf-8")

4. Recompile the Bindings/opencv_python section with release mode to "<binaryoutput>\lib\release\cv2.pyd" and "<binaryoutput>\bin \release all DLL files under "Copy to C:\Python34\DLLs

5. Test the CV2 module:

Import= Cv2.imread ("D: \\acircles_pattern.png") Cv2.namedwindow (  "image") cv2.imshow ("image", IMG) Cv2.waitkey (0) cv2.destroyallwindows ()

Reference:

1] http://stlt1sean.blogspot.sg/2013/05/64python-cv2pyd.html

2] http://www.crifan.com/summary_python_unicodedecode_error_possible_reasons_and_solutions/

3] Http://www.360doc.com/content/14/0702/12/16740871_391447981.shtml

OpenCV 3.0.0-beta compiling support for Python3-linked libraries

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.