.. highlight:: cpp\r
\r
\r
+\r
gpu::BroxOpticalFlow\r
--------------------\r
.. ocv:class:: gpu::BroxOpticalFlow\r
.. ocv:function:: void gpu::GoodFeaturesToTrackDetector_GPU::releaseMemory()\r
\r
\r
+\r
gpu::FarnebackOpticalFlow\r
-------------------------\r
.. ocv:class:: gpu::FarnebackOpticalFlow\r
};\r
\r
\r
+\r
gpu::FarnebackOpticalFlow::operator ()\r
--------------------------------------\r
Computes a dense optical flow using the Gunnar Farneback’s algorithm.\r
.. seealso:: :ocv:func:`calcOpticalFlowFarneback`\r
\r
\r
+\r
gpu::FarnebackOpticalFlow::releaseMemory\r
----------------------------------------\r
Releases unused auxiliary memory buffers.\r
.. ocv:function:: void gpu::FarnebackOpticalFlow::releaseMemory()\r
\r
\r
+\r
gpu::PyrLKOpticalFlow\r
---------------------\r
.. ocv:class:: gpu::PyrLKOpticalFlow\r
\r
gpu::interpolateFrames\r
----------------------\r
-Interpolate frames (images) using provided optical flow (displacement field).\r
+Interpolates frames (images) using provided optical flow (displacement field).\r
\r
.. ocv:function:: void gpu::interpolateFrames(const GpuMat& frame0, const GpuMat& frame1, const GpuMat& fu, const GpuMat& fv, const GpuMat& bu, const GpuMat& bv, float pos, GpuMat& newFrame, GpuMat& buf, Stream& stream = Stream::Null())\r
\r
\r
\r
\r
+gpu::VideoWriter_GPU\r
+---------------------\r
+Video writer class.\r
+\r
+.. ocv:class:: gpu::VideoWriter_GPU\r
+\r
+The class uses H264 video codec.\r
+\r
+.. note:: Currently only Windows platform is supported.\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::VideoWriter_GPU\r
+-------------------------------------\r
+Constructors.\r
+\r
+.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU();\r
+.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);\r
+.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);\r
+.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);\r
+.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);\r
+\r
+ :param fileName: Name of the output video file. Only AVI file format is supported.\r
+\r
+ :param frameSize: Size of the input video frames.\r
+\r
+ :param fps: Framerate of the created video stream.\r
+\r
+ :param params: Encoder parameters. See :ocv:class:`gpu::VideoWriter_GPU::EncoderParams` .\r
+\r
+ :param format: Surface format of input frames ( ``SF_UYVY`` , ``SF_YUY2`` , ``SF_YV12`` , ``SF_NV12`` , ``SF_IYUV`` , ``SF_BGR`` or ``SF_GRAY``). BGR or gray frames will be converted to YV12 format before encoding, frames with other formats will be used as is.\r
+\r
+ :param encoderCallback: Callbacks for video encoder. See :ocv:class:`gpu::VideoWriter_GPU::EncoderCallBack` . Use it if you want to work with raw video stream.\r
+\r
+The constructors initialize video writers. FFMPEG is used to write videos. User can implement own multiplexing with ``EncoderCallBack`` .\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::open\r
+--------------------------\r
+Initializes or reinitializes video writer.\r
+\r
+.. ocv:function:: void gpu::VideoWriter_GPU::open(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);\r
+.. ocv:function:: void gpu::VideoWriter_GPU::open(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);\r
+.. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);\r
+.. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);\r
+\r
+The method opens video writer. Parameters are the same as in the constructor :ocv:func:`gpu::VideoWriter_GPU::VideoWriter_GPU` . The method throws :ocv:class:`Exception` if error occurs.\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::isOpened\r
+------------------------------\r
+Returns true if video writer has been successfully initialized.\r
+\r
+.. ocv:function:: bool gpu::VideoWriter_GPU::isOpened() const;\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::close\r
+---------------------------\r
+Releases the video writer.\r
+\r
+.. ocv:function:: void gpu::VideoWriter_GPU::close();\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::write\r
+---------------------------\r
+Writes the next video frame.\r
+\r
+.. ocv:function:: void gpu::VideoWriter_GPU::write(const cv::gpu::GpuMat& image, bool lastFrame = false);\r
+\r
+ :param image: The written frame.\r
+\r
+ :param lastFrame: Indicates that it is end of stream. The parameter can be ignored.\r
+\r
+The method write the specified image to video file. The image must have the same size and the same surface format as has been specified when opening the video writer.\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::EncoderParams\r
+-----------------------------------\r
+.. ocv:class:: gpu::VideoWriter_GPU::EncoderParams\r
+\r
+Different parameters for CUDA video encoder. ::\r
+\r
+ struct EncoderParams\r
+ {\r
+ int P_Interval; // NVVE_P_INTERVAL,\r
+ int IDR_Period; // NVVE_IDR_PERIOD,\r
+ int DynamicGOP; // NVVE_DYNAMIC_GOP,\r
+ int RCType; // NVVE_RC_TYPE,\r
+ int AvgBitrate; // NVVE_AVG_BITRATE,\r
+ int PeakBitrate; // NVVE_PEAK_BITRATE,\r
+ int QP_Level_Intra; // NVVE_QP_LEVEL_INTRA,\r
+ int QP_Level_InterP; // NVVE_QP_LEVEL_INTER_P,\r
+ int QP_Level_InterB; // NVVE_QP_LEVEL_INTER_B,\r
+ int DeblockMode; // NVVE_DEBLOCK_MODE,\r
+ int ProfileLevel; // NVVE_PROFILE_LEVEL,\r
+ int ForceIntra; // NVVE_FORCE_INTRA,\r
+ int ForceIDR; // NVVE_FORCE_IDR,\r
+ int ClearStat; // NVVE_CLEAR_STAT,\r
+ int DIMode; // NVVE_SET_DEINTERLACE,\r
+ int Presets; // NVVE_PRESETS,\r
+ int DisableCabac; // NVVE_DISABLE_CABAC,\r
+ int NaluFramingType; // NVVE_CONFIGURE_NALU_FRAMING_TYPE\r
+ int DisableSPSPPS; // NVVE_DISABLE_SPS_PPS\r
+\r
+ EncoderParams();\r
+ explicit EncoderParams(const std::string& configFile);\r
+\r
+ void load(const std::string& configFile);\r
+ void save(const std::string& configFile) const;\r
+ };\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::EncoderParams::EncoderParams\r
+--------------------------------------------------\r
+Constructors.\r
+\r
+.. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams();\r
+.. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const std::string& configFile);\r
+\r
+ :param configFile: Config file name.\r
+\r
+Creates default parameters or reads parameters from config file.\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::EncoderParams::load\r
+-----------------------------------------\r
+Reads parameters from config file.\r
+\r
+.. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::load(const std::string& configFile);\r
+\r
+ :param configFile: Config file name.\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::EncoderParams::save\r
+-----------------------------------------\r
+Saves parameters to config file.\r
+\r
+.. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::save(const std::string& configFile) const;\r
+\r
+ :param configFile: Config file name.\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::EncoderCallBack\r
+-----------------------------------\r
+.. ocv:class:: gpu::VideoWriter_GPU::EncoderCallBack\r
+\r
+Callbacks for CUDA video encoder. ::\r
+ class EncoderCallBack\r
+ {\r
+ public:\r
+ enum PicType\r
+ {\r
+ IFRAME = 1,\r
+ PFRAME = 2,\r
+ BFRAME = 3\r
+ };\r
+\r
+ virtual ~EncoderCallBack() {}\r
+\r
+ virtual unsigned char* acquireBitStream(int* bufferSize) = 0;\r
+ virtual void releaseBitStream(unsigned char* data, int size) = 0;\r
+ virtual void onBeginFrame(int frameNumber, PicType picType) = 0;\r
+ virtual void onEndFrame(int frameNumber, PicType picType) = 0;\r
+ };\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::EncoderCallBack::acquireBitStream\r
+-------------------------------------------------------\r
+Callback function to signal the start of bitstream that is to be encoded.\r
+\r
+.. ocv:function:: unsigned char* gpu::VideoWriter_GPU::EncoderCallBack::acquireBitStream(int* bufferSize);\r
+\r
+Callback must allocate buffer for CUDA encoder and return pointer to it and it's size.\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::EncoderCallBack::releaseBitStream\r
+-------------------------------------------------------\r
+Callback function to signal that the encoded bitstream is ready to be written to file.\r
+\r
+.. ocv:function:: void gpu::VideoWriter_GPU::EncoderCallBack::releaseBitStream(unsigned char* data, int size);\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::EncoderCallBack::onBeginFrame\r
+---------------------------------------------------\r
+Callback function to signal that the encoding operation on the frame has started.\r
+\r
+.. ocv:function:: void gpu::VideoWriter_GPU::EncoderCallBack::onBeginFrame(int frameNumber, PicType picType);\r
+\r
+ :param picType: Specify frame type (I-Frame, P-Frame or B-Frame).\r
+\r
+\r
+\r
+gpu::VideoWriter_GPU::EncoderCallBack::onEndFrame\r
+-------------------------------------------------\r
+Callback function signals that the encoding operation on the frame has finished.\r
+\r
+.. ocv:function:: void gpu::VideoWriter_GPU::EncoderCallBack::onEndFrame(int frameNumber, PicType picType);\r
+\r
+ :param picType: Specify frame type (I-Frame, P-Frame or B-Frame).\r
+\r
+\r
+\r
.. [Brox2004] T. Brox, A. Bruhn, N. Papenberg, J. Weickert. *High accuracy optical flow estimation based on a theory for warping*. ECCV 2004.\r