Solved

compare two images

Posted on 2001-09-18
3
632 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Accepted Solution

by:
toffe071900 earned 20 total points
ID: 6489989
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
ID: 6490780
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
ID: 8916372
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

635 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