![]() Then we are using the indices 0, 1 and 2 in the shape function to get the height, width and number of channels in the image. Then we are using the shape() function to get the dimensions of the image. Then we are reading the image whose dimensions are to be detected using the imread() function. In the above program, the required module cv2 is imported. Print('The Number of Channels in the input image are : ', channels) Print('The width of the input image is : ', width) Print('The height of the input image is : ', height) Print('The dimension of the input image is : ', dimensions) #displaying the dimensions of the image as the output on the screen #using the indices 0, 1 and 2 in shape function to get the height, width and number of channels in the image #using shape() function to get the dimensions of the image Imageread = cv2.imread('C:/Users/admin/Desktop/Images/educba.jpg', cv2.IMREAD_UNCHANGED) #reading the image whose dimensions are to be found using imread() function OpenCV program in python determines the dimension of a given image and displays the height, width, and number of channels in the given image as the output on the screen. Given below are the examples of OpenCV Get Image Size: Example #1
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |