Home>

Image processing is performed in real time using a camera.
However, if there are no more components in the camera when detecting a straight line

for i in range (len (lines)):
TypeError: object of type'NoneType'has no len ()

I get an error like this and exit.

I want the program to be displayed when it finds a straight line without stopping, but I would appreciate any advice.

for i in range (len (lines)):
    for x1, y1, x2, y2 in lines [i]:
       cv2.line (src, (x1, y1), (x2, y2), (0,0,255), 2)