I need to learn about 2D pattern searching algorithms. Tips and links greatly appreciated.
More to the point:
Given a matrix of M[m,n] with values in K
example
000000000000
000001000000
0101
00010010 = M, K = {0, 1}
0101
00010001
10111
1010111
and a matrix L[i, j] with values in K + {X} representing a "shape"
example, the shape of letter "L"
1
X
1
X = L
11
What algoritms can answer to the following questions:
- Can L be found in M ?
- How many times L can be found in M (disjunctive L's, no common pieces (1's or 0's))
- How many times L can be found in M (can have common pieces (1's or 0's))
- How many times L, and K (K is defined similarly like L, K != L) can be found in M (disjoint) etc.
The language of implementation is to be JavaScript, but any other will do.
EDIT Also found this PDF.