opencv didn't output images correctly

此生再无相见时 提交于 2021-02-11 17:10:45

问题


I have debugging my code and here is what I found:

img = cv2.resize(img, (224, 224))

cv2.imshow("img",img)
cv2.waitKey(0)
cv2.destroyAllWindows()

img = (img / 127.5) - 1

cv2.imshow("img",(127.5*(img+1)).astype(int))
cv2.waitKey(0)
cv2.destroyAllWindows()

these operations don't output the same picture even tough they are same, does somebody konow why?


回答1:


Try checking the dtype each time you display:

print(img.dtype)


来源:https://stackoverflow.com/questions/63371878/opencv-didnt-output-images-correctly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!