OpenCV learning notes () -- OpenCV Computer Version with Python reading abstract, pythonopencv

Source: Internet
Author: User

OpenCV learning notes () -- OpenCV Computer Version with Python reading abstract, pythonopencv

Now, python is quite popular. Every time the ml module of OpenCV comes, I am calling myself, so I simply want to use python for processing machine learning algorithms later on OpenCV. So I quickly picked up the book and read it.

Applicable to OpenCV and python .... Because I am familiar with these two things, I only care about a few questions before reading them. I did not take a closer look at the specific application instances.

1. How to install opencv in python

2. Can the Mat data structure of OpenCV be easily converted to the array structure of numpy?

3. Is the GUI module of OpenCV easy to use in python?

4. Are there any other sparks that I cannot think ....

The book mentioned in the windows system, python-32bit performance is better than 64 bit, it is recommended to install 32-bit python

The first problem is very simple in windows. After OpenCV is installed, find the file <build_folder> \ lib \ Release \ cv2.pyd (from a Visual Studio build) and copy it to C: \ Python2.7 \ Lib \ site-packages. That's easy. After all, the scripting language is heartless. There are many python examples under \ sources \ samples. If you try a few times, you will know whether the installation is complete. Import cv2 to the cv2 module.

There is no need to worry about the second problem, because python does not need to declare the type of the variable. After an experiment, we found that the data type of the matrix is array, which is stable and can be used directly.

The third problem is also extremely simple. The image display read/write module, camera module, and mouse and keyboard response module can all be used, which is similar to the c ++ version.

I read the fourth question in a simple and crude way, but I didn't find any highlights. I just mentioned a pygame in the book that can be used for hgui, which supports painting and editing texts, however, it seems that it is not helpful to CV, so I did not study it.

I want to add a few questions I encountered during my study:

The Rect Data Structure in opencv does not have a corresponding type in python, so pay attention to calling it. For example, the rectangle function inputs the coordinates of the two points of the rectangle, not the Rect.

In addition, many Macros in opencv need to be prefixed with cv2.cv in python to take effect.





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.