mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge branch 4.x
This commit is contained in:
@@ -228,7 +228,7 @@ bool VideoCapture::open(const String& filename, int apiPreference, const std::ve
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_LOG_DEBUG(NULL, "VIDEOIO: choosen backend does not work or wrong. "
|
||||
CV_LOG_DEBUG(NULL, "VIDEOIO: chosen backend does not work or wrong. "
|
||||
"Please make sure that your computer support chosen backend and OpenCV built "
|
||||
"with right flags.");
|
||||
}
|
||||
@@ -353,7 +353,7 @@ bool VideoCapture::open(const Ptr<IStreamReader>& stream, int apiPreference, con
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_LOG_DEBUG(NULL, "VIDEOIO: choosen backend does not work or wrong. "
|
||||
CV_LOG_DEBUG(NULL, "VIDEOIO: chosen backend does not work or wrong. "
|
||||
"Please make sure that your computer support chosen backend and OpenCV built "
|
||||
"with right flags.");
|
||||
}
|
||||
@@ -491,7 +491,7 @@ bool VideoCapture::open(int cameraNum, int apiPreference, const std::vector<int>
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_LOG_DEBUG(NULL, "VIDEOIO: choosen backend does not work or wrong."
|
||||
CV_LOG_DEBUG(NULL, "VIDEOIO: chosen backend does not work or wrong."
|
||||
"Please make sure that your computer support chosen backend and OpenCV built "
|
||||
"with right flags.");
|
||||
}
|
||||
@@ -808,7 +808,7 @@ bool VideoWriter::open(const String& filename, int apiPreference, int fourcc, do
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_LOG_DEBUG(NULL, "VIDEOIO: choosen backend does not work or wrong."
|
||||
CV_LOG_DEBUG(NULL, "VIDEOIO: chosen backend does not work or wrong."
|
||||
"Please make sure that your computer support chosen backend and OpenCV built "
|
||||
"with right flags.");
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ void CvCaptureCAM_Aravis::autoExposureControl(const Mat & image)
|
||||
midGrey = brightness;
|
||||
|
||||
double maxe = 1e6 / fps;
|
||||
double ne = CLIP( ( exposure * d ) / ( dmid * pow(sqrt(2), -2 * exposureCompensation) ), exposureMin, maxe);
|
||||
double ne = CLIP( ( exposure * d ) / ( dmid * std::pow(sqrt(2), -2 * exposureCompensation) ), exposureMin, maxe);
|
||||
|
||||
// if change of value requires intervention
|
||||
if(std::fabs(d-dmid) > 5) {
|
||||
|
||||
@@ -488,9 +488,9 @@ bool GStreamerCapture::configureStreamsProperty(const cv::VideoCaptureParameters
|
||||
{
|
||||
if (params.has(CAP_PROP_VIDEO_STREAM))
|
||||
{
|
||||
double value = params.get<double>(CAP_PROP_VIDEO_STREAM);
|
||||
gint value = params.get<gint>(CAP_PROP_VIDEO_STREAM);
|
||||
if (value == -1 || value == 0)
|
||||
videoStream = static_cast<gint>(value);
|
||||
videoStream = value;
|
||||
else
|
||||
{
|
||||
CV_LOG_ERROR(NULL, "VIDEOIO/Gstreamer: CAP_PROP_VIDEO_STREAM parameter value is invalid/unsupported: " << value);
|
||||
@@ -499,9 +499,9 @@ bool GStreamerCapture::configureStreamsProperty(const cv::VideoCaptureParameters
|
||||
}
|
||||
if (params.has(CAP_PROP_AUDIO_STREAM))
|
||||
{
|
||||
double value = params.get<double>(CAP_PROP_AUDIO_STREAM);
|
||||
if (value == -1 || value > -1)
|
||||
audioStream = static_cast<gint>(value);
|
||||
gint value = params.get<gint>(CAP_PROP_AUDIO_STREAM);
|
||||
if (value == -1 || value >= 0)
|
||||
audioStream = value;
|
||||
else
|
||||
{
|
||||
CV_LOG_ERROR(NULL, "VIDEOIO/Gstreamer: CAP_PROP_AUDIO_STREAM parameter value is invalid/unsupported: " << value);
|
||||
@@ -515,7 +515,7 @@ bool GStreamerCapture::setAudioProperties(const cv::VideoCaptureParameters& para
|
||||
{
|
||||
if (params.has(CAP_PROP_AUDIO_DATA_DEPTH))
|
||||
{
|
||||
gint value = static_cast<gint>(params.get<double>(CAP_PROP_AUDIO_DATA_DEPTH));
|
||||
gint value = params.get<gint>(CAP_PROP_AUDIO_DATA_DEPTH);
|
||||
if (value != CV_8S && value != CV_16S && value != CV_32S && value != CV_32F)
|
||||
{
|
||||
CV_LOG_ERROR(NULL, "VIDEOIO/Gstreamer: CAP_PROP_AUDIO_DATA_DEPTH parameter value is invalid/unsupported: " << value);
|
||||
@@ -528,7 +528,7 @@ bool GStreamerCapture::setAudioProperties(const cv::VideoCaptureParameters& para
|
||||
}
|
||||
if (params.has(CAP_PROP_AUDIO_SAMPLES_PER_SECOND))
|
||||
{
|
||||
int value = static_cast<int>(params.get<double>(CAP_PROP_AUDIO_SAMPLES_PER_SECOND));
|
||||
int value = params.get<int>(CAP_PROP_AUDIO_SAMPLES_PER_SECOND);
|
||||
if (value < 0)
|
||||
{
|
||||
CV_LOG_ERROR(NULL, "VIDEOIO/Gstreamer: CAP_PROP_AUDIO_SAMPLES_PER_SECOND parameter can't be negative: " << value);
|
||||
@@ -541,8 +541,7 @@ bool GStreamerCapture::setAudioProperties(const cv::VideoCaptureParameters& para
|
||||
}
|
||||
if (params.has(CAP_PROP_AUDIO_SYNCHRONIZE))
|
||||
{
|
||||
int value = static_cast<uint32_t>(params.get<double>(CAP_PROP_AUDIO_SYNCHRONIZE));
|
||||
syncLastFrame = (value != 0) ? true : false;
|
||||
syncLastFrame = params.get<bool>(CAP_PROP_AUDIO_SYNCHRONIZE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@ static float estimateBitrate(int codecId, size_t pixelNum, float fps)
|
||||
}
|
||||
else if (codecId == MFX_CODEC_AVC)
|
||||
{
|
||||
bitrate = (mp * 140 + 19) * pow(fps, 0.60f);
|
||||
bitrate = (mp * 140 + 19) * std::pow(fps, 0.60f);
|
||||
}
|
||||
else if (codecId == MFX_CODEC_HEVC)
|
||||
{
|
||||
bitrate = (mp * 63 + 45) * pow(fps, 0.60f);
|
||||
bitrate = (mp * 63 + 45) * std::pow(fps, 0.60f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -789,7 +789,7 @@ protected:
|
||||
bool checkAudioProperties();
|
||||
|
||||
template <typename CtrlT>
|
||||
bool readComplexPropery(long prop, long& val) const;
|
||||
bool readComplexProperty(long prop, long& val) const;
|
||||
template <typename CtrlT>
|
||||
bool writeComplexProperty(long prop, double val, long flags);
|
||||
_ComPtr<IMFAttributes> getDefaultSourceConfig(UINT32 num = 10);
|
||||
@@ -1388,9 +1388,9 @@ bool CvCapture_MSMF::configureStreams(const cv::VideoCaptureParameters& params)
|
||||
{
|
||||
if (params.has(CAP_PROP_VIDEO_STREAM))
|
||||
{
|
||||
double value = params.get<double>(CAP_PROP_VIDEO_STREAM);
|
||||
int value = params.get<int>(CAP_PROP_VIDEO_STREAM);
|
||||
if (value == -1 || value == 0)
|
||||
videoStream = static_cast<int>(value);
|
||||
videoStream = value;
|
||||
else
|
||||
{
|
||||
CV_LOG_ERROR(NULL, "VIDEOIO/MSMF: CAP_PROP_VIDEO_STREAM parameter value is invalid/unsupported: " << value);
|
||||
@@ -1399,8 +1399,8 @@ bool CvCapture_MSMF::configureStreams(const cv::VideoCaptureParameters& params)
|
||||
}
|
||||
if (params.has(CAP_PROP_AUDIO_STREAM))
|
||||
{
|
||||
double value = params.get<double>(CAP_PROP_AUDIO_STREAM);
|
||||
if (value == -1 || value > -1)
|
||||
int value = params.get<int>(CAP_PROP_AUDIO_STREAM);
|
||||
if (value == -1 || value >= 0)
|
||||
audioStream = static_cast<int>(value);
|
||||
else
|
||||
{
|
||||
@@ -1414,7 +1414,7 @@ bool CvCapture_MSMF::setAudioProperties(const cv::VideoCaptureParameters& params
|
||||
{
|
||||
if (params.has(CAP_PROP_AUDIO_DATA_DEPTH))
|
||||
{
|
||||
int value = static_cast<int>(params.get<double>(CAP_PROP_AUDIO_DATA_DEPTH));
|
||||
int value = params.get<int>(CAP_PROP_AUDIO_DATA_DEPTH);
|
||||
if (value != CV_8S && value != CV_16S && value != CV_32S && value != CV_32F)
|
||||
{
|
||||
CV_LOG_ERROR(NULL, "VIDEOIO/MSMF: CAP_PROP_AUDIO_DATA_DEPTH parameter value is invalid/unsupported: " << value);
|
||||
@@ -1427,7 +1427,7 @@ bool CvCapture_MSMF::setAudioProperties(const cv::VideoCaptureParameters& params
|
||||
}
|
||||
if (params.has(CAP_PROP_AUDIO_SAMPLES_PER_SECOND))
|
||||
{
|
||||
int value = static_cast<int>(params.get<double>(CAP_PROP_AUDIO_SAMPLES_PER_SECOND));
|
||||
int value = params.get<int>(CAP_PROP_AUDIO_SAMPLES_PER_SECOND);
|
||||
if (value < 0)
|
||||
{
|
||||
CV_LOG_ERROR(NULL, "VIDEOIO/MSMF: CAP_PROP_AUDIO_SAMPLES_PER_SECOND parameter can't be negative: " << value);
|
||||
@@ -1440,8 +1440,7 @@ bool CvCapture_MSMF::setAudioProperties(const cv::VideoCaptureParameters& params
|
||||
}
|
||||
if (params.has(CAP_PROP_AUDIO_SYNCHRONIZE))
|
||||
{
|
||||
int value = static_cast<UINT32>(params.get<double>(CAP_PROP_AUDIO_SYNCHRONIZE));
|
||||
syncLastFrame = (value != 0) ? true : false;
|
||||
syncLastFrame = params.get<bool>(CAP_PROP_AUDIO_SYNCHRONIZE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -2120,7 +2119,7 @@ bool CvCapture_MSMF::setTime(int numberFrame)
|
||||
}
|
||||
|
||||
template <typename CtrlT>
|
||||
bool CvCapture_MSMF::readComplexPropery(long prop, long & val) const
|
||||
bool CvCapture_MSMF::readComplexProperty(long prop, long & val) const
|
||||
{
|
||||
_ComPtr<CtrlT> ctrl;
|
||||
if (FAILED(videoFileSource->GetServiceForStream((DWORD)MF_SOURCE_READER_MEDIASOURCE, GUID_NULL, IID_PPV_ARGS(&ctrl))))
|
||||
@@ -2188,64 +2187,64 @@ double CvCapture_MSMF::getProperty( int property_id ) const
|
||||
else
|
||||
break;
|
||||
case CAP_PROP_BRIGHTNESS:
|
||||
if (readComplexPropery<IAMVideoProcAmp>(VideoProcAmp_Brightness, cVal))
|
||||
if (readComplexProperty<IAMVideoProcAmp>(VideoProcAmp_Brightness, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_CONTRAST:
|
||||
if (readComplexPropery<IAMVideoProcAmp>(VideoProcAmp_Contrast, cVal))
|
||||
if (readComplexProperty<IAMVideoProcAmp>(VideoProcAmp_Contrast, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_SATURATION:
|
||||
if (readComplexPropery<IAMVideoProcAmp>(VideoProcAmp_Saturation, cVal))
|
||||
if (readComplexProperty<IAMVideoProcAmp>(VideoProcAmp_Saturation, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_HUE:
|
||||
if (readComplexPropery<IAMVideoProcAmp>(VideoProcAmp_Hue, cVal))
|
||||
if (readComplexProperty<IAMVideoProcAmp>(VideoProcAmp_Hue, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_GAIN:
|
||||
if (readComplexPropery<IAMVideoProcAmp>(VideoProcAmp_Gain, cVal))
|
||||
if (readComplexProperty<IAMVideoProcAmp>(VideoProcAmp_Gain, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_SHARPNESS:
|
||||
if (readComplexPropery<IAMVideoProcAmp>(VideoProcAmp_Sharpness, cVal))
|
||||
if (readComplexProperty<IAMVideoProcAmp>(VideoProcAmp_Sharpness, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_GAMMA:
|
||||
if (readComplexPropery<IAMVideoProcAmp>(VideoProcAmp_Gamma, cVal))
|
||||
if (readComplexProperty<IAMVideoProcAmp>(VideoProcAmp_Gamma, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_BACKLIGHT:
|
||||
if (readComplexPropery<IAMVideoProcAmp>(VideoProcAmp_BacklightCompensation, cVal))
|
||||
if (readComplexProperty<IAMVideoProcAmp>(VideoProcAmp_BacklightCompensation, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_MONOCHROME:
|
||||
if (readComplexPropery<IAMVideoProcAmp>(VideoProcAmp_ColorEnable, cVal))
|
||||
if (readComplexProperty<IAMVideoProcAmp>(VideoProcAmp_ColorEnable, cVal))
|
||||
return cVal == 0 ? 1 : 0;
|
||||
break;
|
||||
case CAP_PROP_TEMPERATURE:
|
||||
if (readComplexPropery<IAMVideoProcAmp>(VideoProcAmp_WhiteBalance, cVal))
|
||||
if (readComplexProperty<IAMVideoProcAmp>(VideoProcAmp_WhiteBalance, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_PAN:
|
||||
if (readComplexPropery<IAMCameraControl>(CameraControl_Pan, cVal))
|
||||
if (readComplexProperty<IAMCameraControl>(CameraControl_Pan, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_TILT:
|
||||
if (readComplexPropery<IAMCameraControl>(CameraControl_Tilt, cVal))
|
||||
if (readComplexProperty<IAMCameraControl>(CameraControl_Tilt, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_ROLL:
|
||||
if (readComplexPropery<IAMCameraControl>(CameraControl_Roll, cVal))
|
||||
if (readComplexProperty<IAMCameraControl>(CameraControl_Roll, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_IRIS:
|
||||
if (readComplexPropery<IAMCameraControl>(CameraControl_Iris, cVal))
|
||||
if (readComplexProperty<IAMCameraControl>(CameraControl_Iris, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_EXPOSURE:
|
||||
case CAP_PROP_AUTO_EXPOSURE:
|
||||
if (readComplexPropery<IAMCameraControl>(CameraControl_Exposure, cVal))
|
||||
if (readComplexProperty<IAMCameraControl>(CameraControl_Exposure, cVal))
|
||||
{
|
||||
if (property_id == CAP_PROP_EXPOSURE)
|
||||
return cVal;
|
||||
@@ -2254,12 +2253,12 @@ double CvCapture_MSMF::getProperty( int property_id ) const
|
||||
}
|
||||
break;
|
||||
case CAP_PROP_ZOOM:
|
||||
if (readComplexPropery<IAMCameraControl>(CameraControl_Zoom, cVal))
|
||||
if (readComplexProperty<IAMCameraControl>(CameraControl_Zoom, cVal))
|
||||
return cVal;
|
||||
break;
|
||||
case CAP_PROP_FOCUS:
|
||||
case CAP_PROP_AUTOFOCUS:
|
||||
if (readComplexPropery<IAMCameraControl>(CameraControl_Focus, cVal))
|
||||
if (readComplexProperty<IAMCameraControl>(CameraControl_Focus, cVal))
|
||||
{
|
||||
if (property_id == CAP_PROP_FOCUS)
|
||||
return cVal;
|
||||
|
||||
@@ -42,9 +42,9 @@ VideoCapture_obsensor::VideoCapture_obsensor(int, const cv::VideoCaptureParamete
|
||||
alignFilter = std::make_shared<ob::Align>(OB_STREAM_COLOR);
|
||||
#endif
|
||||
|
||||
int color_width = params.get<double>(CAP_PROP_FRAME_WIDTH, OB_WIDTH_ANY);
|
||||
int color_height = params.get<double>(CAP_PROP_FRAME_HEIGHT, OB_HEIGHT_ANY);
|
||||
int color_fps = params.get<double>(CAP_PROP_FPS, OB_FPS_ANY);
|
||||
int color_width = params.get<int>(CAP_PROP_FRAME_WIDTH, OB_WIDTH_ANY);
|
||||
int color_height = params.get<int>(CAP_PROP_FRAME_HEIGHT, OB_HEIGHT_ANY);
|
||||
int color_fps = params.get<int>(CAP_PROP_FPS, OB_FPS_ANY);
|
||||
|
||||
auto colorProfiles = pipe->getStreamProfileList(OB_SENSOR_COLOR);
|
||||
if (color_width == OB_WIDTH_ANY && color_height == OB_HEIGHT_ANY && color_fps == OB_FPS_ANY)
|
||||
@@ -60,9 +60,9 @@ VideoCapture_obsensor::VideoCapture_obsensor(int, const cv::VideoCaptureParamete
|
||||
config->enableStream(colorProfile->as<ob::VideoStreamProfile>());
|
||||
}
|
||||
|
||||
int depth_width = params.get<double>(CAP_PROP_OBSENSOR_DEPTH_WIDTH, OB_WIDTH_ANY);
|
||||
int depth_height = params.get<double>(CAP_PROP_OBSENSOR_DEPTH_HEIGHT, OB_HEIGHT_ANY);
|
||||
int depth_fps = params.get<double>(CAP_PROP_OBSENSOR_DEPTH_FPS, OB_FPS_ANY);
|
||||
int depth_width = params.get<int>(CAP_PROP_OBSENSOR_DEPTH_WIDTH, OB_WIDTH_ANY);
|
||||
int depth_height = params.get<int>(CAP_PROP_OBSENSOR_DEPTH_HEIGHT, OB_HEIGHT_ANY);
|
||||
int depth_fps = params.get<int>(CAP_PROP_OBSENSOR_DEPTH_FPS, OB_FPS_ANY);
|
||||
|
||||
auto depthProfiles = pipe->getStreamProfileList(OB_SENSOR_DEPTH);
|
||||
if (depth_width == OB_WIDTH_ANY && depth_height == OB_HEIGHT_ANY && depth_fps == OB_FPS_ANY)
|
||||
|
||||
Reference in New Issue
Block a user