然后我读了一些jpg文件,这样
image = imread('aa.jpg')
结果,我得到了一个从1到255的数据帧
我可以这样调整大小:
^{pr2}$但后来我用png做同样的思考,结果不理想。在
image = imread('aa2.png') # array with number within 0-1 range
resize(image, (256,256)) # returns 1 channel image
resize(image, (256,256, 3)) # returns 3 channel image
但是imshow(image)
默认情况下,
cv2.imread
读取3个通道的图像,而不是4个通道。传递参数cv.IMREAD_UNCHANGED
以读取PNG文件,然后尝试调整其大小,如下面的代码所示。在或者是你的代码有问题。在
这里有一个免费的图片可以试试:https://pixabay.com/vectors/copyright-free-creative-commons-98566/
可能您对libpng有问题,请检查以下答案:libpng warning: iCCP: known incorrect sRGB profile
检查一下这个简单的代码,它可以处理PNG图像。在
相关问题 更多 >
编程相关推荐