I have two matrix A and B, I want to find pattern B in matrix A. So I get 2 pattern similar like pattern B. What the name of this operation? and How I write this in mathematics notation?
Thank you in advance
I have two matrix A and B, I want to find pattern B in matrix A. So I get 2 pattern similar like pattern B. What the name of this operation? and How I write this in mathematics notation?
Thank you in advance
You are looking for Chamfer-Matching: it will yield a zero value at all center points where the pattern occurs.
Ordinary template matching (aka cross correlation) does not work in your case, because that would also consider the white points of the template, not only the black points. Chamfer-Matching, instead, only sums the distance transform values of A at the black points of B. If '1' stands for black, and D is the distance transform of A, and B is centered such that its midpoint has coordinate $(0,0))$, then Chamfer-Matching computes the following image C:
$$C(x,y) = \sum_{dx,dy} D(x+dx, y+dy)\cdot B(dx, dy)$$