Finding matching submatrics inside a matrix

Posted by DaveO on Stack Overflow See other posts from Stack Overflow or by DaveO
Published on 2012-06-18T06:52:49Z Indexed on 2012/06/18 9:16 UTC
Read the original article Hit count: 283

Filed under:
|

I have a 100x200 2D array expressed as a numpy array consisting of black (0) and white (255) cells. It is a bitmap file. I then have 2D shapes (it's easiest to think of them as letters) that are also 2D black and white cells.

I know I can naively iterate through the matrix but this is going to be a 'hot' portion of my code so speed is an concern. Is there a fast way to perform this in numpy/scipy?

I looked briefly at Scipy's correlate function. I am not interested in 'fuzzy matches', only exact matches. I also looked at some academic papers but they are above my head.

© Stack Overflow or respective owner

Related posts about python

Related posts about numpy