diff --git a/modules/videoio/include/opencv2/videoio.hpp b/modules/videoio/include/opencv2/videoio.hpp index d1dbd327f1..cc639d60a6 100644 --- a/modules/videoio/include/opencv2/videoio.hpp +++ b/modules/videoio/include/opencv2/videoio.hpp @@ -171,6 +171,8 @@ enum VideoCaptureProperties { CAP_PROP_SAR_DEN =41, //!< Sample aspect ratio: num/den (den) CAP_PROP_BACKEND =42, //!< Current backend (enum VideoCaptureAPIs). Read-only property CAP_PROP_CHANNEL =43, //!< Video input or Channel Number (only for those cameras that support) + CAP_PROP_AUTO_WB =44, //!< enable/ disable auto white-balance + CAP_PROP_WB_TEMPERATURE=45, //!< white-balance color temperature #ifndef CV_DOXYGEN CV__CAP_PROP_LATEST #endif diff --git a/modules/videoio/src/cap_v4l.cpp b/modules/videoio/src/cap_v4l.cpp index cc4294c3b0..4a628f961c 100644 --- a/modules/videoio/src/cap_v4l.cpp +++ b/modules/videoio/src/cap_v4l.cpp @@ -1513,6 +1513,10 @@ static inline cv::String capPropertyName(int prop) return "sar_num"; case cv::CAP_PROP_SAR_DEN: return "sar_den"; + case CAP_PROP_AUTO_WB: + return "auto wb"; + case CAP_PROP_WB_TEMPERATURE: + return "wb temperature"; default: return "unknown"; } @@ -1593,6 +1597,10 @@ static inline int capPropertyToV4L2(int prop) return V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT; case cv::CAP_PROP_SAR_DEN: return V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH; + case CAP_PROP_AUTO_WB: + return V4L2_CID_AUTO_WHITE_BALANCE; + case CAP_PROP_WB_TEMPERATURE: + return V4L2_CID_WHITE_BALANCE_TEMPERATURE; default: break; } @@ -1631,10 +1639,18 @@ bool CvCaptureCAM_V4L::controlInfo(int property_id, __u32 &_v4l2id, cv::Range &r _v4l2id = __u32(v4l2id); range = cv::Range(queryctrl.minimum, queryctrl.maximum); if (normalizePropRange) { - if (property_id == cv::CAP_PROP_AUTOFOCUS) - range = Range(0, 1); - else if (property_id == cv::CAP_PROP_AUTO_EXPOSURE) + switch(property_id) + { + case CAP_PROP_WB_TEMPERATURE: + case CAP_PROP_AUTO_WB: + case CAP_PROP_AUTOFOCUS: + range = Range(0, 1); // do not convert + break; + case CAP_PROP_AUTO_EXPOSURE: range = Range(0, 4); + default: + break; + } } return true; }