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.
331
341
CV_PROP_RW cv::Rect targetRoi;//!< Region of interest in the output frame containing the decoded frame.
332
342
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.
343
+
CV_PROP_RW bool histogramEnabled;//!< Flag indicating whether histogram output has been enabled and is supported.
344
+
CV_PROP_RW int nCounterBitDepth;//!< Bit depth of histogram bins.
345
+
CV_PROP_RW int nMaxHistogramBins;//!< Max number of histogram bins.
/** @brief Grabs, decodes and returns the next video frame and frame luma histogram.
392
+
393
+
@param [out] frame The video frame.
394
+
@param [out] histogram Histogram of the luma component of the encoded frame, see note.
395
+
@param stream Stream for the asynchronous version.
396
+
@return `false` if no frames have been grabbed.
397
+
398
+
If no frames have been grabbed (there are no more frames in video file), the methods return false.
399
+
The method throws an Exception if error occurs.
400
+
401
+
@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.
379
406
*/
380
407
CV_WRAP virtual FormatInfo format() const = 0;
@@ -534,16 +561,18 @@ but it cannot go below the number determined by NVDEC.
534
561
@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.
535
562
@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,
536
563
defaults to the full frame.
564
+
@param enableHistogramOutput Request output of decoded luma histogram \a hist from VideoReader::nextFrame(GpuMat& frame, GpuMat& hist, Stream& stream) if supported.
CV_Error(Error::StsUnsupportedFormat, "Video source is not supported by hardware video decoder");
128
124
CV_LOG_ERROR(NULL, "Video source is not supported by hardware video decoder.");
129
125
}
126
+
127
+
if (videoFormat.histogramEnabled){
128
+
if (decodeCaps.bIsHistogramSupported) {
129
+
if (decodeCaps.nCounterBitDepth != 32) {
130
+
std::ostringstream warning;
131
+
warning << "Luma histogram output disabled due to current device using " << decodeCaps.nCounterBitDepth << " bit bins. Histogram output only supports 32 bit bins.";
0 commit comments