Relative Content

Tag Archive for pythonopencvmachine-learningyolov5cudnn

NameError: name ‘img’ is not defined

cap = cv2.VideoCapture(‘video.mp4’) def realTime(): while True: success, img = cap.read() img =cv2.resize(img,(0,0),None,0.5,0.5) ih, iw, channels = img.shape # Draw the crossing lines cv2.line(img, (0, middle_line_position), (iw, middle_line_position), (255, 0, 255), 1) cv2.line(img, (0, up_line_position), (iw, up_line_position), (0, 0, 255), 1) cv2.line(img, (0, down_line_position), (iw, down_line_position), (0, 0, 255), 1) # Show the frames cv2.imshow(‘Output’, […]