OpenCV官网说明:(shape为图片(高度,宽度,通道数))
Image properties include number of rows, columns and channels, type of image data, number of pixels etc.
The shape of an image is accessed by img.shape. It returns a tuple of number of rows, columns, and channels (if image is color):
>>> print( img.shape )
(342, 548, 3)
If an image is grayscale, the tuple returned contains only the number of rows and columns, so it is a good method to check whether the loaded image is grayscale or color.
Total number of pixels is accessed by
img.size
:
>>> print( img.size )
562248
resize函数说明:(size为图片(宽度,高度))
dst = cv.resize(src, dsize[, dst[, fx[, fy[, interpolation]]]])
dsize output image size; if it equals zero, it is computed as: dsize = Size(round(fx*src.cols), round(fy*src.rows))