image
- Structured storage of the data
- Image Properties
- The number of channels
- Height and width
- Pixel data
- Bitmap depth
Code
OpenCv python API module loaded in the image
Support for common formats
Reads the video and image
Import CV2 AS CV Import numpy AS NP DEF video_demo (): # reading video Capture = cv.VideoCapture (0) the while (True): RET, Frame = capture.read () Frame = cv.flip (Frame,. 1) # If not this one, about reverses cv.imshow ( " Video " , Frame) c = cv.waitKey (50 ) IF c == 27 : BREAK DEF get_image_info (Image): Print (of the type (Image)) # imread read data type is numpy, ndarray Print (image.shape) Print (image.size) Print (image.dtype) pix_data = np.array (Image); # acquires pixel data Print (pix_data) the src = cv.imread (R & lt ' H: \ Coding \ opencvpicture \ coins.jpg ' ) cv.namedWindow ( " INPUT image " , cv.WINDOW_AUTOSIZE) cv.imshow ( " INPUT image " , the src) gray = cv.cvtColor (the src, cv.COLOR_BGR2GRAY) # obtain a gray image get_image_info (src) # call the function to get the channel data cv.imwrite (r "H: \ Coding \ python_opencv_tutorial_codes \ Practice \ result.png " , Gray) # stored in the image to a designated position # video_demo () cv.waitKey (0) cv.destroyAllWindows ()