posted 11 years ago
You'd probably have to iterate over the SampleModel pixel by pixel checking for a similar pattern. I can think of a few ways to approach that algorithm, though I'm not at all sure of what would be considered a 'good' approach. Given an image i that we wan't to compare to a larger image i2, you could take the topmost row of pixels of i and compare one band against the same band of each row of pixels in i2 such that the y value is >= the height of i. If you don't find a match you've established that it's not in the image. If you do find a match you can compare the other bands and iterate down from there. If all the bands match all the way through i you've discovered the image within the image. As soon as you find a place that doesn't match you return to where you started with your first band and continue iterating down.