Python configuration and the use of OPENCV

Source: Internet
Author: User
This time to bring you the Python configuration and OpenCV use of the detailed, Python configuration and OpenCV use of the attention of what, the following is the actual case, together to see.

After downloading opencv2.4.9 (python2.7 match)

(1) running OpenCV 2.4.9.exe;

(2) Configure Python: Will \opencv\build\python\2.7\x64 this directory: Cv2.pyd

Copy to: Python27\lib\site-packages\ directory;

(3) Test: Input import Cv2, such as error, indicating not installed successfully

1, OpenCV version must match with Python version, otherwise Python is unable to call Cv2 this module.

error message: Importerror DLL load failed:%1 is not a valid WIN32 application

The reason for this error is because the Python bit does not match the OPENCV, such as your python2.7 is 32 bits, and OPENCV is 64 bits.

2, the solution: is if your Python is 64 bits of the \opencv\build\python\2.7\x64 under the Cv2.pyd copy python27\lib\site-packages\, otherwise will \ Opencv\build\python\2.7\x86 Copy the past.

If your Python joins the environment variable, enter the Python carriage return directly in the console to see how many bits of your python are:

3, some problems of opencv3

Opencv3 use and Opencv2 there are some differences, take Cv2.cv.CV_HAAR_SCALE_IMAGE, OPENCV3 will error, hint CV2 no CV this attribute, replace Opencv2 is good.

Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!

Recommended reading:

Python bulk reading of pictures and database implementation

How the object life cycle is used in Python replication

Related Article

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.