Given an image that contains an NxM grid of icons with text below them, somewhat like this:
I'm wondering how to split it up into the individual icons with text. Some wrinkles:
- The image won't always be the same size (nor will the icons); it might show 18 icons as 6x3, or 16 icons as 4x4, etc.
- The window might be scrolled, such that the top and/or bottom row of icons are "chopped off" in the image (I can keep or discard the incomplete ones, whatever's easiest).
- The background behind the icons isn't white. It's a complicated pattern with gradients that aren't purely horizontal or vertical, and where there are some discontinuities—so it's not as easy as "find a horizontal line where all the pixels are the same color value" or "where each color value is consistently
+xfrom the previous one". But the icons are in very vibrant colors, and the background is pretty subdued; I'm hoping that might be detectable?
Essentially what I need is a generalized way to detect the "space" between the rows and columns of icons, and know what position to "cut" right in the middle of that space, like I was using a paper cutter.
I have to automate this by programming, so I'm less interested in an already-existing software tool that can do it, and more interested in how to approach the problem (what strategies/algorithms would help solve it). I know so little about this area that I'm not even sure what this problem is called. :) Thanks!