You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CV_PROP_RW cv::Rect srcRoi;//!< Region of interest decoded from video source.
332
342
CV_PROP_RW cv::Rect targetRoi;//!< Region of interest in the output frame containing the decoded frame.
333
343
CV_PROP_RW bool videoFullRangeFlag;//!< Output value indicating if the black level, luma and chroma of the source are represented using the full or limited range (AKA TV or "analogue" range) of values as defined in Annex E of the ITU-T Specification. Internally the conversion from NV12 to BGR obeys ITU 709.
344
+
CV_PROP_RW bool enableHistogram;//!< Flag requesting histogram output if supported. Exception will be thrown when requested but not supported.
345
+
CV_PROP_RW int nCounterBitDepth;//!< Bit depth of histogram bins if histogram output is requested and supported.
346
+
CV_PROP_RW int nMaxHistogramBins;//!< Max number of histogram bins if histogram output is requested and supported.
/** @brief Grabs, decodes and returns the next video frame and frame luma histogram.
393
+
394
+
@param [out] frame The video frame.
395
+
@param [out] histogram Histogram of the luma component of the encoded frame, see note.
396
+
@param stream Stream for the asynchronous version.
397
+
@return `false` if no frames have been grabbed.
398
+
399
+
If no frames have been grabbed (there are no more frames in video file), the methods return false.
400
+
The method throws an Exception if error occurs.
401
+
402
+
@note Histogram data is collected by NVDEC during the decoding process resulting in zero performance penalty. NVDEC computes the histogram data for only the luma component of decoded output, not on post-processed frame(i.e. when scaling, cropping, etc. applied). If the source is encoded using a limited range of luma values (FormatInfo::videoFullRangeFlag == false) then the histogram bin values will correspond to to this limited range of values and will need to be mapped to contain the same output as cuda::calcHist(). The MapHist() utility function can be used to perform this mapping on the host if required.
/** @brief Returns information about video file format.
380
407
*/
381
408
CV_WRAP virtual FormatInfo format() const = 0;
@@ -535,16 +562,18 @@ but it cannot go below the number determined by NVDEC.
535
562
@param srcRoi Region of interest (x/width should be multiples of 4 and y/height multiples of 2) decoded from video source, defaults to the full frame.
536
563
@param targetRoi Region of interest (x/width should be multiples of 4 and y/height multiples of 2) within the output frame to copy and resize the decoded frame to,
537
564
defaults to the full frame.
565
+
@param enableHistogram Request output of decoded luma histogram \a hist from VideoReader::nextFrame(GpuMat& frame, GpuMat& hist, Stream& stream), if hardware supported.
if (!(decodeCaps.bIsSupported && (decodeCaps.nOutputFormatMask & (1 << cudaVideoSurfaceFormat_NV12)))){
127
-
CV_LOG_ERROR(NULL, "Video source is not supported by hardware video decoder.");
128
-
CV_Error(Error::StsUnsupportedFormat, "Video source is not supported by hardware video decoder");
126
+
if (!(decodeCaps.bIsSupported && (decodeCaps.nOutputFormatMask & (1 << cudaVideoSurfaceFormat_NV12)))) {
127
+
CV_Error(Error::StsUnsupportedFormat, "Video source is not supported by hardware video decoder refer to Nvidia's GPU Support Matrix to confirm your GPU supports hardware decoding of the video source's codec.");
128
+
}
129
+
130
+
if (videoFormat.enableHistogram) {
131
+
if (!decodeCaps.bIsHistogramSupported) {
132
+
CV_Error(Error::StsBadArg, "Luma histogram output is not supported for current codec and/or on current device.");
133
+
}
134
+
135
+
if (decodeCaps.nCounterBitDepth != 32) {
136
+
std::ostringstream error;
137
+
error << "Luma histogram output disabled due to current device using " << decodeCaps.nCounterBitDepth << " bit bins. Histogram output only supports 32 bit bins.";
0 commit comments