This project demonstrates basic camera operation using the OpenCV library in Python. The program captures a stream from the camera, converts the image to grayscale, and displays it in a separate window.
How the code works
-
The camera is connected at index 1 (can be changed to 0 if the main camera).
-
Frames are captured in an infinite loop.
-
Each frame is converted to grayscale using cv2.cvtColor.
-
The result is displayed in the window The picture.
-
To exit the program, press the p key.