* The size of the block depends on hardware in use, and can be queried using the function getGridSize().
* The block-based flow vectors generated by the hardware can be converted to dense representation (i.e. per-pixel flow vectors) using upSampler() helper function, if needed.
* The flow vectors are stored in CV_16SC2 format with x and y components of each flow vector in 16-bit signed fixed point representation S10.5.
@param inputImage Input image.
@param referenceImage Reference image of the same size and the same type as input image.
@param flow A buffer consisting of inputImage.Size() / getGridSize() flow vectors in CV_16SC2 format.
@param stream Stream for the asynchronous version.
@param hint Hint buffer if client provides external hints. Must have same size as flow buffer.
Caller can provide flow vectors as hints for optical flow calculation.
@param cost Cost buffer contains numbers indicating the confidence associated with each of the generated flow vectors.
Higher the cost, lower the confidence. Cost buffer is of type CV_32SC1.
@note
- Client must use critical sections around each calc() function if calling it from multiple threads.
*/
CV_WRAPvirtualvoidcalc(
InputArrayinputImage,
InputArrayreferenceImage,
InputOutputArrayflow,
Stream&stream=Stream::Null(),
InputArrayhint=cv::noArray(),
OutputArraycost=cv::noArray())=0;
/** @brief Releases all buffers, contexts and device pointers.
*/
CV_WRAPvirtualvoidcollectGarbage()=0;
/** @brief Returns grid size of output buffer as per the hardware's capability.
*/
CV_WRAPvirtualintgetGridSize()const=0;
};
//
// BroxOpticalFlow
...
...
@@ -342,6 +383,70 @@ public:
booluseInitialFlow=false);
};
//
// NvidiaOpticalFlow
//
/** @brief Class for computing the optical flow vectors between two images using NVIDIA Optical Flow hardware and Optical Flow SDK 1.0.
@note
- A sample application demonstrating the use of NVIDIA Optical Flow can be found at