jonathan
jonathan

Reputation: 1

Is it possible to do image comparison with actionscript?

If I have a base image of a grid of fruits (lets say a pear, apple and an orange, two rows of this order). Is it possible for action script to take another image (lets say scanned) which I have changed one of the fruit in each row (like pear, pineapple orange on the first row and pineapple, apple and orange on the second row) and output the fruit that is missing? So in this example apple and pear would be the output since they have been changed with a pineapple.

Upvotes: 0

Views: 920

Answers (3)

nicoptere
nicoptere

Reputation: 1069

+1 @Trevor Boyle

the bitmapData has a built-in compare() method that returns:

The result of the compare() method is a new BitmapData object with each pixel showing the difference in the RGB values between the two bitmaps.

this might allow you to perform a check between 2 images and spot the "difference blobs" then determine how "similar" the pictures are from each other.

the problem in your case is that the 2 sources can be very different and chances are that the compare function won't find anything to match or just return the whole bitmapdaat area.

then, as Trevor mentioned, the solution could be to train a feature recognition engine and let it decide how "similar" the 2 pictures are ; if the positions of the different fiducial patterns lie roughly in a grid, in a given order.

Upvotes: 0

Trevor Boyle
Trevor Boyle

Reputation: 1025

ASSURF is an open source library that allows you to do image recognition. http://code.google.com/p/in-spirit/wiki/ASSURF

... but depending upon what you are trying to achieve might be able to fudge it so that maybe you look for a certain colour in each object, or convert them to black and white shapes and look at the negative space, or hide a QR code in the corner or something.

Upvotes: 3

Alex
Alex

Reputation: 2372

It doesn't have image analysis like this built in, but the BitmapData class lets you access an image's pixels so you can write your own analysis functions.

Upvotes: 0

Related Questions