1. Basic operation
Capture == capture.read () cv2.imwrite ("photo.jpg", image) Capture.release ()
2, Camera properties set (read, write)
Set
Cv2. VideoCapture. Set (propid, value) →retval
or cv.Setcaptureproperty(capture, property_id, value) → retval
Get
propid–
- cv_cap_prop_pos_msec Current position of the video file in milliseconds.
- cv_cap_prop_pos_frames 0-based Index of the frame to be decoded/captured next.
- Cv_cap_prop_pos_avi_ratio Relative position of the video file:0-start of the film, 1-end of the film.
- Cv_cap_prop_frame_width Width of the frames in the video stream.
- Cv_cap_prop_frame_height Height of the frames in the video stream.
- Cv_cap_prop_fps Frame rate.
- CV_CAP_PROP_FOURCC 4-character Code of codec.
- Cv_cap_prop_frame_count Number of frames in the video file.
- Cv_cap_prop_format Format of the Mat objects returned by retrieve () .
- Cv_cap_prop_mode Backend-specific value indicating the current capture mode.
- cv_cap_prop_brightness Brightness of the image (only for cameras).
- Cv_cap_prop_contrast Contrast of the image (only for cameras).
- cv_cap_prop_saturation Saturation of the image (only for cameras).
- Cv_cap_prop_hue Hue of the image (only for cameras).
- Cv_cap_prop_gain Gain of the image (only for cameras).
- cv_cap_prop_exposure Exposure (only for cameras).
- Cv_cap_prop_convert_rgb The Boolean flags indicating whether images should is converted to RGB.
- Cv_cap_prop_white_balance_u The U value of the whitebalance setting (Note:only supported by DC1394 v 2.x backend currently)
- Cv_cap_prop_white_balance_v The V value of the whitebalance setting (Note:only supported by DC1394 V 2.x backend currently)
- cv_cap_prop_rectification Rectification Flag for stereo cameras (Note:only supported by DC1394 v 2.x backend currently)
- Cv_cap_prop_iso_speed The ISO speed of the camera (Note:only supported by DC1394 v 2.x backend currently)
- cv_cap_prop_buffersize Amount of frames stored in internal buffer memory (Note:only supported by DC1394 v 2.x backend currently)
OpenCV manipulating camera-related functions