Link to home
Start Free TrialLog in
Avatar of shaikchanbasha
shaikchanbasha

asked on

compare two images

Hai Java Guys,

How to compare two images using java.If any thing different at any place ,we have to give details of that pixel.It is GIS project.If anybody know solution for this plz let me know.Thank you in asdvance.

Basha
ASKER CERTIFIED SOLUTION
Avatar of toffe071900
toffe071900

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could simplify it to begin with....

Check the dimensions of the images are the same, if thy're not then you know before you do any more time consuming proccessing that the images arn't the same.

On the other hand if the width and the height are the same in each picture, then you can go on to set up 2 arrays containing the picture information and compare the two togeather.


e.g:

//Returns true if the images are equal
public boolean imagesAreEqual(Image i1,Image i2)
     {
     if((i1.getWidth()!=i2.getWidth)||(i1.getHeight()!=i2.getHeight)) return false;
     //Grab the two pictures here....
     //and now compare...
     for(int index=0;index<picLength;index++)
          if(pic1[index]!=pic2[index]) return false;
     return true;
     }
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points for toffe

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Venabili
EE Cleanup Volunteer