# 2018-06-03 #
1. python Download: https://www.python.org/downloads/
Select the appropriate version of Python for the corresponding platform to install.
2. python version OpenCV installation:
If the Python environment is already configured globally on your computer, you can install it directly with the PIP Package Management tool and open cmd Direct input:
PIP3 Install Opencv-python
If the Python environment is not configured or Python is isolated, you can downgrade the PIP tool to the appropriate folder, such as:
3. A simple example, through Python's 3rd party package NumPy to build a diagram and display:
The code is:
#-*-coding:utf-8-*-ImportCv2ImportNumPy as NPPrint(Cv2.__version__)#Build a pictureimg = Np.zeros ([3], dtype=np.uint8)#iterate through each pixel and assign a value. forIinchRange (512): forJinchRange (512): Img[i, J,:]= [i%, j%, (i + j)% 256]#Show PicturesCv2.namedwindow ('Custom Image', Cv2. Window_normal) Cv2.imshow ('Custom Image', IMG) cv2.waitkey (0) cv2.destroyallwindows ()
Results
4. Summary
Using Python to write OPENCV-related image processing algorithms is more convenient, eliminating the tedious configuration of the C + + process, the code is clearer, can be faster to achieve their own ideas. You can first use Python to realize their own ideas, see if it is feasible, and then use C + + for field product development!
Python version OpenCV installation configuration and simple example