Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

compare two images

Posted on 2001-09-18
3
Medium Priority
?
642 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 60 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

824 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