Merge pull request #13358 from terfendail:disflow_warn

pull/13363/head
Maksim Shabunin 6 years ago
commit 6481397710
  1. 3
      modules/video/src/dis_flow.cpp
  2. 6
      modules/video/src/variational_refinement.cpp

@ -226,9 +226,11 @@ DISOpticalFlowImpl::DISOpticalFlowImpl()
border_size = 16;
use_mean_normalization = true;
use_spatial_propagation = true;
coarsest_scale = 10;
/* Use separate variational refinement instances for different scales to avoid repeated memory allocation: */
int max_possible_scales = 10;
ws = hs = w = h = 0;
for (int i = 0; i < max_possible_scales; i++)
variational_refinement_processors.push_back(VariationalRefinement::create());
}
@ -1035,6 +1037,7 @@ void DISOpticalFlowImpl::Densification_ParBody::operator()(const Range &range) c
sum_Uy += coef * Sy_ptr[is * dis->ws + js];
sum_coef += coef;
}
CV_DbgAssert(sum_coef != 0);
Ux_ptr[i * dis->w + j] = sum_Ux / sum_coef;
Uy_ptr[i * dis->w + j] = sum_Uy / sum_coef;
}

@ -93,6 +93,7 @@ class VariationalRefinementImpl CV_FINAL : public VariationalRefinement
int red_even_len, red_odd_len;
int black_even_len, black_odd_len;
RedBlackBuffer();
void create(Size s);
void release();
};
@ -366,6 +367,10 @@ void VariationalRefinementImpl::updateRepeatedBorders(RedBlackBuffer &dst)
}
}
VariationalRefinementImpl::RedBlackBuffer::RedBlackBuffer()
{
release();
}
void VariationalRefinementImpl::RedBlackBuffer::create(Size s)
{
/* Allocate enough memory to include borders */
@ -386,6 +391,7 @@ void VariationalRefinementImpl::RedBlackBuffer::release()
{
red.release();
black.release();
red_even_len = red_odd_len = black_even_len = black_odd_len = 0;
}
VariationalRefinementImpl::ParallelOp_ParBody::ParallelOp_ParBody(VariationalRefinementImpl &_var, vector<Op> _ops,

Loading…
Cancel
Save