Question:
how to compare two images?
Swapnil
2012-04-02 23:51:45 UTC
dat means how to find in a database if dat image is already available or not by comparing?
if available den how to show the details of dat available image.
Three answers:
James Bond
2012-04-03 00:03:40 UTC
It comes under content based image retrieval (CBIR).

As of now,google supports only text bases search.

Scientist are trying for having image based retrieval.

Read about blobs in Oracle or other data base systems.

I am unaware they can allow you to make query based on images
Alikas
2012-04-03 07:02:21 UTC
Medopal's answer will perform an approximate comparison for RGB images with no alpha chanel. The reason the comparison is approximate is because the RGB values are being "squashed" into a single integer, whereas the image colour resolution could be a lot higher than this.



To perform an exhaustive comparison you need to compare each image band separately:



BufferedImage image1 = ...

BufferedImage image2 = ...



Raster r1 = image1.getData();

Raster r2 = image2.getData();

boolean ret; // Stores result.



// Check image sizes and number of bands. If there are different

// then no need to compare images as they are definitely not equal.

if (r1.getNumBands() != r2.getNumBands() ||

r1.getWidth() != r2.getWidth() ||

r1.getHeight() != r2.getHeight()) {

ret = false;

} else {

// #Bands and image bounds match so compare each sample in turn.



ret = true;



search:

for (int i=0; i
for (int x=0; x
for (int y=0; y
if (r1.getSample(x, y, i) != r2.getSample(x, y, i) {

// At least one sample differs so result is false;

ret = false;

// Use labeled break to terminate all loops.

break search;

}

}

}

}



done:

}
2012-04-03 09:45:32 UTC
you may compare two images in adobe photoshop ...


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...