问题
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