In this lesson we show how to move a frame in OpenCV, how to convert a color image to grayscale, and then how to display multiple video windows. For your convenience, I include the code below that we develop in this video.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import cv2 print(cv2.__version__) cam=cv2.VideoCapture(1) while True: ignore, frame = cam.read() gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY) cv2.imshow('my WEBcam', frame) cv2.moveWindow('my WEBcam',0,0) cv2.imshow('my grayFrame', gray) cv2.moveWindow('my grayFrame',640,0) cv2.imshow('my WEBcam2', frame) cv2.moveWindow('my WEBcam2',640,480) cv2.imshow('my grayFrame2', gray) cv2.moveWindow('my grayFrame2',0,480) if cv2.waitKey(1) & 0xff ==ord('q'): break cam.release() |