![]() |
IPSDK
4_1_0_2
IPSDK : Image Processing Software Development Kit
|
Computes a dense optical flow occurred between two input images. More...
Computes a dense optical flow occurred between two input images.
This algorithm computes the optical flow between 2 input images using the deep flow algorithm [1].
The optical flow is the apparent motion of objects that occurred between two images. It relies on the assumption of intensity conservation and can be expressed as:
where
is a pixel
in the image at the time
,
is the time between two frames and
is the displacement that occurred during
.
Assuming the displacement is small enough, this equation can be approximated by a first order Taylor expansion:
where
is the partial derivative of the image along the dimension
.
Dividing by
and using the intensity conservation assumption, the equation becomes:
where
and
.
This equation can not be directly solved since we only have one equation for 2 unknowns to estimate.
The DeepFlow is one of the several technics to solve the equation above. It is a variational method that integrates a multiscale approach to overcome the limit of small displacement assumption.
In this algorithm, solving the optical flow problem consists in minimizing the energy
defined as:
where
is the energy of the data term, ensuring that the intensities stay close,
represents the smoothing term, ensuring a local consistency of the flow gradient and
is a matching term, ensuring that the estimated flow is close to the input a priori flow. In practice, this implementation stays to more standard variation model and ignores the mathcing term [2]. The equation becomes:
is iteratively minimized using a Successive Over-relaxation (SOR) approach, taking the flow estimated at the scale
as initialization of the estimation at the scale
.
The algorithm takes the following parameters:
: the smoothness weight
: the color constancy weight (see [1] for more details)
: the gradient constancy weight
: Relaxation factor in SORThe figure below presents and example of flow estimation. A random and smooth deformation field was applied to the image of lena. The deep flow was calculated with the folowing parameters: 200 layers (maximum), downscale factor = 0.95, 5 fixed point iterations, 25 SOR iterations,
,
,
,
:
[1] Philippe Weinzaepfel, Jerome Revaud, Zaid Harchaoui, and Cordelia Schmid. Deepflow: Large displacement optical flow with deep matching. In Computer Vision (ICCV), 2013 IEEE International Conference on, pages 1385–1392. IEEE, 2013.
[2] Brox, T., Bruhn, A., Papenberg, N., Weickert, J. (2004). High Accuracy Optical Flow Estimation Based on a Theory for Warping. In: Pajdla, T., Matas, J. (eds) Computer Vision - ECCV 2004. ECCV 2004.
Attribute description for algorithm :
| Name | ToolTip | Default Initializer |
|---|---|---|
| ipsdk::imaproc::attr::InSingleImg1 | [Input] First single image | X |
| ipsdk::imaproc::attr::InSingleImg2 | [Input] Second single image | X |
| ipsdk::imaproc::attr::InDeepFlowParams | [Input] Parameters to st up the deep flow | X |
| ipsdk::imaproc::attr::InOptRealSeqImg | [InOut Optional] Real sequence image | X |
| ipsdk::imaproc::attr::OutOptWk1RealImg | [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) | X |
| ipsdk::imaproc::attr::OutOptWk2RealImg | [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) | X |
| ipsdk::imaproc::attr::OutOptWk3RealImg | [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) | X |
| ipsdk::imaproc::attr::OutOptWk4RealImg | [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) | X |
| ipsdk::imaproc::attr::OutOptWk5RealImg | [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) | X |
| ipsdk::imaproc::attr::OutOptWk6RealImg | [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) | X |
| ipsdk::imaproc::attr::OutOptWk7RealImg | [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) | X |
| ipsdk::imaproc::attr::OutOptWk8RealImg | [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) | X |
| ipsdk::imaproc::attr::OutRealImg1 | [Output] image for processing operation (data contained in image buffer are reals) | customOutput (_pOutRealImg1, createSeqFromImage(_pInSingleImg1,2)) |
| ipsdk::imaproc::attr::OutRealImg2 | [Output] image for processing operation (data contained in image buffer are reals) | customOutput (_pOutRealImg2, createSeqFromImage(_pInSingleImg1,2)) |
| ipsdk::imaproc::attr::OutRealSeqImg | [Output] Real sequence image | customOutput (_pOutRealSeqImg, outputDeepFlow2d(_pInSingleImg1)) |
Global rule description for algorithm :
matchSize (_pInSingleImg1,_pInSingleImg2) &&
matchSize (eMatchImageSizeType::eMIST_XYZC,_pInSingleImg1,_pOutRealImg1) &&
ipsdk::imaproc::customImageProperty (_pOutRealSeqImg,
matchDeepFlow2d (_pInSingleImg1)) &&
ipsdk::processor::If (
ipsdk::processor::isSet (_pInOptRealSeqImg),
matchSize (_pInOptRealSeqImg,_pOutRealSeqImg),
ipsdk::processor::none ())
| IPSDKIPLREGISTRATION_API ipsdk::image::ImagePtr ipsdk::imaproc::registration::deepFlow2dImg | ( | const image::ImageConstPtr & | pInImg1, |
| const image::ImageConstPtr & | pInImg2 | ||
| ) |
wrapper function for Computes a dense optical flow occurred between two input images
| ipsdk::processor::IPSDKBaseProcessingException | on failure |
| IPSDKIPLREGISTRATION_API ipsdk::image::ImagePtr ipsdk::imaproc::registration::deepFlow2dImg | ( | const image::ImageConstPtr & | pInImg1, |
| const image::ImageConstPtr & | pInImg2, | ||
| const ipsdk::imaproc::attr::DeepFlowParamsConstPtr & | pParams | ||
| ) |
wrapper function for Computes a dense optical flow occurred between two input images
| ipsdk::processor::IPSDKBaseProcessingException | on failure |
| IPSDKIPLREGISTRATION_API void ipsdk::imaproc::registration::deepFlow2dImg | ( | const image::ImageConstPtr & | pInImg1, |
| const image::ImageConstPtr & | pInImg2, | ||
| const image::ImagePtr & | pOutFlowImg | ||
| ) |
wrapper function for Computes a dense optical flow occurred between two input images
| ipsdk::processor::IPSDKBaseProcessingException | on failure |
| IPSDKIPLREGISTRATION_API void ipsdk::imaproc::registration::deepFlow2dImg | ( | const image::ImageConstPtr & | pInImg1, |
| const image::ImageConstPtr & | pInImg2, | ||
| const ipsdk::imaproc::attr::DeepFlowParamsConstPtr & | pParams, | ||
| const image::ImagePtr & | pOutFlowImg | ||
| ) |
wrapper function for Computes a dense optical flow occurred between two input images
| ipsdk::processor::IPSDKBaseProcessingException | on failure |
1.8.14