@Name(value="cv::cudacodec::VideoReader") @Properties(inherit=opencv_cudacodec.class) public class VideoReader extends Pointer
Available if Nvidia's Video Codec SDK is installed.
Decoding support is dependent on the GPU, refer to the Nvidia Video Codec SDK Video Encode and Decode GPU Support Matrix for details.
\note - An example on how to use the VideoReader interface can be found at opencv_source_code/samples/gpu/video_reader.cpp
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
VideoReader(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
FormatInfo |
format()
\brief Returns information about video file format.
|
boolean |
get(int propertyId,
double[] propertyVal) |
boolean |
get(int propertyId,
DoubleBuffer propertyVal) |
boolean |
get(int propertyId,
DoublePointer propertyVal)
\brief Returns the specified VideoReader property
|
boolean |
getVideoReaderProps(int propertyId,
double[] propertyValOut) |
boolean |
getVideoReaderProps(int propertyId,
double[] propertyValOut,
double propertyValIn) |
boolean |
getVideoReaderProps(int propertyId,
DoubleBuffer propertyValOut) |
boolean |
getVideoReaderProps(int propertyId,
DoubleBuffer propertyValOut,
double propertyValIn) |
boolean |
getVideoReaderProps(int propertyId,
DoublePointer propertyValOut) |
boolean |
getVideoReaderProps(int propertyId,
DoublePointer propertyValOut,
double propertyValIn) |
boolean |
grab() |
boolean |
grab(Stream stream)
\brief Grabs the next frame from the video source.
|
boolean |
nextFrame(GpuMat frame) |
boolean |
nextFrame(GpuMat frame,
Stream stream)
\brief Grabs, decodes and returns the next video frame.
|
boolean |
nextFrameWithHist(GpuMat frame,
GpuMat histogram) |
boolean |
nextFrameWithHist(GpuMat frame,
GpuMat histogram,
Stream stream)
\brief Grabs, decodes and returns the next video frame and frame luma histogram.
|
boolean |
retrieve(GpuMat frame) |
boolean |
retrieve(GpuMat frame,
long idx) |
boolean |
retrieve(Mat frame) |
boolean |
retrieve(Mat frame,
long idx)
\brief Returns previously grabbed video data.
|
boolean |
retrieve(UMat frame) |
boolean |
retrieve(UMat frame,
long idx) |
boolean |
set(int colorFormat)
\brief Set the desired ColorFormat for the frame returned by nextFrame()/retrieve().
|
boolean |
set(int propertyId,
double propertyVal)
\brief Sets a property in the VideoReader.
|
boolean |
setVideoReaderProps(int propertyId,
double propertyVal) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public VideoReader(Pointer p)
Pointer(Pointer)
.@Cast(value="bool") public boolean nextFrame(@ByRef GpuMat frame, @ByRef(nullValue="cv::cuda::Stream::Null()") Stream stream)
frame
- [out] The video frame.stream
- Stream for the asynchronous version.false
if no frames have been grabbed.
If no frames have been grabbed (there are no more frames in video file), the methods return false. The method throws an Exception if error occurs.
@Cast(value="bool") @Name(value="nextFrame") public boolean nextFrameWithHist(@ByRef GpuMat frame, @ByRef GpuMat histogram, @ByRef(nullValue="cv::cuda::Stream::Null()") Stream stream)
frame
- [out] The video frame.histogram
- [out] Histogram of the luma component of the encoded frame, see note.stream
- Stream for the asynchronous version.false
if no frames have been grabbed.
If no frames have been grabbed (there are no more frames in video file), the methods return false. The method throws an Exception if error occurs.
\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.
@Cast(value="bool") @Name(value="nextFrame") public boolean nextFrameWithHist(@ByRef GpuMat frame, @ByRef GpuMat histogram)
@ByVal public FormatInfo format()
@Cast(value="bool") public boolean grab(@ByRef(nullValue="cv::cuda::Stream::Null()") Stream stream)
stream
- Stream for the asynchronous version.true
(non-zero) in the case of success.
The method/function grabs the next frame from video file or camera and returns true (non-zero) in the case of success.
The primary use of the function is for reading both the encoded and decoded video data when rawMode is enabled. With rawMode enabled retrieve() can be called following grab() to retrieve all the data associated with the current video source since the last call to grab() or the creation of the VideoReader.
@Cast(value="bool") public boolean retrieve(@ByVal Mat frame, @Cast(value="const size_t") long idx)
frame
- [out] The returned data which depends on the provided idx.idx
- Determines the returned data inside image. The returned data can be the:
- Decoded frame, idx = get(PROP_DECODED_FRAME_IDX).
- Extra data if available, idx = get(PROP_EXTRA_DATA_INDEX).
- Raw encoded data package. To retrieve package i, idx = get(PROP_RAW_PACKAGES_BASE_INDEX) + i with i < get(PROP_NUMBER_OF_RAW_PACKAGES_SINCE_LAST_GRAB)false
if no frames have been grabbed
The method returns data associated with the current video source since the last call to grab() or the creation of the VideoReader. If no data is present the method returns false and the function returns an empty image.
@Cast(value="bool") public boolean retrieve(@ByVal UMat frame, @Cast(value="const size_t") long idx)
@Cast(value="bool") public boolean retrieve(@ByVal GpuMat frame, @Cast(value="const size_t") long idx)
@Cast(value="bool") public boolean set(@Cast(value="const cv::cudacodec::VideoReaderProps") int propertyId, double propertyVal)
propertyId
- Property identifier from cv::cudacodec::VideoReaderProps (eg. cv::cudacodec::VideoReaderProps::PROP_DECODED_FRAME_IDX,
cv::cudacodec::VideoReaderProps::PROP_EXTRA_DATA_INDEX, ...).propertyVal
- Value of the property.true
if the property has been set.@Cast(value="bool") public boolean setVideoReaderProps(@Cast(value="const cv::cudacodec::VideoReaderProps") int propertyId, double propertyVal)
@Cast(value="bool") public boolean set(@Cast(value="const cv::cudacodec::ColorFormat") int colorFormat)
colorFormat
- Value of the ColorFormat.true
unless the colorFormat is not supported.@Cast(value="bool") public boolean get(@Cast(value="const cv::cudacodec::VideoReaderProps") int propertyId, @ByRef DoublePointer propertyVal)
propertyId
- Property identifier from cv::cudacodec::VideoReaderProps (eg. cv::cudacodec::VideoReaderProps::PROP_DECODED_FRAME_IDX,
cv::cudacodec::VideoReaderProps::PROP_EXTRA_DATA_INDEX, ...).propertyVal
- - In: Optional value required for querying specific propertyId's, e.g. the index of the raw package to be checked for a key frame (cv::cudacodec::VideoReaderProps::PROP_LRF_HAS_KEY_FRAME).
- Out: Value of the property.true
unless the property is not supported.@Cast(value="bool") public boolean get(@Cast(value="const cv::cudacodec::VideoReaderProps") int propertyId, @ByRef DoubleBuffer propertyVal)
@Cast(value="bool") public boolean get(@Cast(value="const cv::cudacodec::VideoReaderProps") int propertyId, @ByRef double[] propertyVal)
@Cast(value="bool") public boolean getVideoReaderProps(@Cast(value="const cv::cudacodec::VideoReaderProps") int propertyId, @ByRef DoublePointer propertyValOut, double propertyValIn)
@Cast(value="bool") public boolean getVideoReaderProps(@Cast(value="const cv::cudacodec::VideoReaderProps") int propertyId, @ByRef DoublePointer propertyValOut)
@Cast(value="bool") public boolean getVideoReaderProps(@Cast(value="const cv::cudacodec::VideoReaderProps") int propertyId, @ByRef DoubleBuffer propertyValOut, double propertyValIn)
@Cast(value="bool") public boolean getVideoReaderProps(@Cast(value="const cv::cudacodec::VideoReaderProps") int propertyId, @ByRef DoubleBuffer propertyValOut)
@Cast(value="bool") public boolean getVideoReaderProps(@Cast(value="const cv::cudacodec::VideoReaderProps") int propertyId, @ByRef double[] propertyValOut, double propertyValIn)
Copyright © 2024. All rights reserved.