First time here? Check out the FAQ!
answered 2015-08-13 10:32:56 -0600
If you want to extract a rectangular area from dist, the recommended way is
dist
dist.operator()(Rect(i,j-2,5,1))
So, your statement in the loop should read
search_mask = dist.operator()(Rect(i, j - 2, 5, 1)).clone();