Код: Выделить всё
import cv2
img =cv2.imread('OIP.jpg')
cv2.imshow("oip" , img)
cv2.waitkey(0)
cv2.imwrite('OIP.png', img)
cv2.destroyAllWindows()
Код: Выделить всё
runfile('C:/Users/user/reading and writing an image.py', wdir='C:/Users/user')
Traceback (most recent call last):
File "C:\Users\user\reading and writing an image.py", line 13, in
cv2.imshow("oip" , img)
error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:376: error: (-215:Assertion failed)
size.width>0 && size.height>0 in function 'cv::imshow'
Подробнее здесь: https://stackoverflow.com/questions/626 ... size-heigh