Forums Register Login

Analysing if a Jpeg exists in another Jpeg

+Pie Number of slices to send: Send
I want to write a Jpeg that recognizes if it exists in another jpeg.

Example:

I got a jpeg, 50*50 pixels, which I have cut out from a bigger jpeg 100*100

How Do I write a function that can tell me if picture 1 exists within picture 2?

Code example please!

/BondePer
+Pie Number of slices to send: Send
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.
Run away! Run away! Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 712 times.
Similar Threads
Which image is loading Fastly .jpg or .gif?
Displaying images in a JESS GUI
Http Response
creating Image
general(intermediate)
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:35:58.