-215:Assertion failed

Hi. I’m a begginer in opencv. Today, I wrote a Python program for ROI, but i have error , cv2.error: OpenCV(4.5.1) /tmp/pip-wheel-qd18ncao/opencv-python/opencv/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘imshow’"
I using raspbian on raspberry pi 4B, and nano. Thanks for any help.
import cv2
import numpy
image = cv2.imread("/home/pi/Desktop/pobrane.jpeg")
ROI = image [100:250, 400:69] #wybieranie pikseli do pokazania
cv2.imshow(“roi”, ROI)

the assertion doesn’t end at (-215:Assertion failed), it goes on to give you some hint about what’s going on:

size.width>0 && size.height>0 in function ‘imshow’

run your code in a debugger and look at the contents of your variables, or simply print them.

1 Like

Very thanks for reply. I changed values in ROI, and that help.