mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 02:16:34 +08:00
Fixed coarse scale evaluation for DIS optical flow estimator
This commit is contained in:
@@ -1316,7 +1316,8 @@ bool DISOpticalFlowImpl::ocl_calc(InputArray I0, InputArray I1, InputOutputArray
|
|||||||
else
|
else
|
||||||
flow.create(I1Mat.size(), CV_32FC2);
|
flow.create(I1Mat.size(), CV_32FC2);
|
||||||
UMat &u_flowMat = flow.getUMatRef();
|
UMat &u_flowMat = flow.getUMatRef();
|
||||||
coarsest_scale = (int)(log((2 * I0Mat.cols) / (4.0 * patch_size)) / log(2.0) + 0.5) - 1;
|
coarsest_scale = min((int)(log(max(I0Mat.cols, I0Mat.rows) / (4.0 * patch_size)) / log(2.0) + 0.5), /* Original code serach for maximal movement of width/4 */
|
||||||
|
(int)(log(min(I0Mat.cols, I0Mat.rows) / patch_size) / log(2.0))); /* Deepest pyramid level greater or equal than patch*/
|
||||||
|
|
||||||
ocl_prepareBuffers(I0Mat, I1Mat, u_flowMat, use_input_flow);
|
ocl_prepareBuffers(I0Mat, I1Mat, u_flowMat, use_input_flow);
|
||||||
u_Ux[coarsest_scale].setTo(0.0f);
|
u_Ux[coarsest_scale].setTo(0.0f);
|
||||||
@@ -1382,7 +1383,8 @@ void DISOpticalFlowImpl::calc(InputArray I0, InputArray I1, InputOutputArray flo
|
|||||||
else
|
else
|
||||||
flow.create(I1Mat.size(), CV_32FC2);
|
flow.create(I1Mat.size(), CV_32FC2);
|
||||||
Mat flowMat = flow.getMat();
|
Mat flowMat = flow.getMat();
|
||||||
coarsest_scale = (int)(log((2 * I0Mat.cols) / (4.0 * patch_size)) / log(2.0) + 0.5) - 1;
|
coarsest_scale = min((int)(log(max(I0Mat.cols, I0Mat.rows) / (4.0 * patch_size)) / log(2.0) + 0.5), /* Original code serach for maximal movement of width/4 */
|
||||||
|
(int)(log(min(I0Mat.cols, I0Mat.rows) / patch_size) / log(2.0))); /* Deepest pyramid level greater or equal than patch*/
|
||||||
int num_stripes = getNumThreads();
|
int num_stripes = getNumThreads();
|
||||||
|
|
||||||
prepareBuffers(I0Mat, I1Mat, flowMat, use_input_flow);
|
prepareBuffers(I0Mat, I1Mat, flowMat, use_input_flow);
|
||||||
|
Reference in New Issue
Block a user