Solved

compare two images

Posted on 2001-09-18
3
588 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:shaikchanbasha
3 Comments
 

Accepted Solution

by:
toffe071900 earned 20 total points
Comment Utility
i suppose you could use pixelgrabber on both pics to get arrays of the contents and then compare each element in the two arrays

-toffe
0
 
LVL 1

Expert Comment

by:Lab_Rat
Comment Utility
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;
     }
0
 
LVL 20

Expert Comment

by:Venabili
Comment Utility
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
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now