Example Analysis of OpenCV Image processing in python
This article mainly introduces the example analysis of OpenCV image processing in python, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
OpenCV is commonly used in dealing with pictures. In this article, let's take a look at its specific use.
1. The data reads the image.
# read color picture data img = cv2.imread (r "C:\ Users\ admin\ Desktop\ ztz.jpg") print (img)
2, the display of pictures, you can also create multiple windows.
Img = cv2.imread (r "C:\ Users\ admin\ Desktop\ ztz.jpg") # Image display, you can also create multiple windows # Parameter 1: picture name Custom Parameter 2: picture object cv2.imshow ('img', img) # waiting time for image display, millisecond: 0 indicates that any key terminates cv2.waitKey (0) cv2.destroyAllWindows ()
3, the attribute of the picture, the number of rows corresponds to the y on the axis, that is, it represents the height of the image. The number of columns corresponds to the y on the axis, that is, the height of the image.
Img = cv2.imread (r "C:\ Users\ admin\ Desktop\ ztz.jpg") print (img.shape) # number of rows, columns, color channels print (img.size) # Pixels of the picture Thank you for reading this article carefully. I hope the article "sample Analysis of OpenCV Image processing in python" shared by the editor will be helpful to you. At the same time, I hope you will support it and pay attention to the industry information channel. More related knowledge is waiting for you to learn!