Image comparison

I want to comapre two images, the second image here is a part of the first image i.e. a sub-image . I want an algorithm with which I would be able to check whether the subimage is a part of the first image
[212 byte] By [Chikua] at [2007-10-2 19:59:38]
# 1
Good, go for it! Post again if you get stuck somewhere.
prometheuzza at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...
# 2

well the algorithm for the problem can be very complex if implemented using pattern recognition on a NN i.e. neural networks. NN in it self is quite vast field .you will have to go through it's various theories of neural network models on neuron , precepton networs , their design , then you will you will have to deign one complex network which will invove whole lot of math . you neeed to be good at maths . then you need to train that brin (NN) how to rcognize pattern i.e. adjust weights . if you are intrested better get your self some books on pattern recognition in doing . this is a field of on going research . may be you would like to some thing or there is a better waythat you find some library for doing it. hope fully thats what even you would prefer. well i have heard ( i have just heard of it and dont have much idea)of one such library GIFT (gnu image finding tool) .

neural networs isnt the only way to implement pattern rcognition it can be ai ,may some use of fuzzy concepts etc its' a huge field with whole lot of scope of resarchand as well as competeion where people are vying & striving to get better ,efficient ,more precise and accurately performing, computationally less expensive algorithms and ppl are trying to understand how we recognize pattern trying to simulate that on computer trying to impart brins to computer letting them learn things and be trainedetc.

you can google around to find such other open or closed source free to use pattern recognition library but i am not sure about the language in which it's implemented so you may tweak around a little.if this tool dosent dosent work out you will surely find some other good pattern recognition project in open source communitymay be on source forge. better google around for it. the advantage of pattern recognition is the SUB-image need not be exact the part of SUPER-image

here are some web address

SPRLIB/ANNLIB

* Web site: www.ph.tn.tudelft.nl/~sprlib/

http://tldp.org/HOWTO/AI-Alife-HOWTO-3.html

http://www.google.co.in/search?hs=C4C&hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=gnu+pattern+recognition+library&btnG=Search&meta=

http://ravl.sourceforge.net/

well gocr is onother lib of pattern recognition specilize fo ocr

using pattern recognition may not be necessary if SUB-image is exact part of SUPER-image(not even scaled up or down version) be the thing that you may have to use .in that caase simmply use pixel grabber ( some thing avilable in java refer java official docomenttion or some tutorial well i ahvae abook by jhon zukovski it has an example of pixel grabber but if u find proper documentation it would do)to make a image to a 2d matrix with each cell containg and try to see if whole matrix matches some part of sub matrix using loops. hope fully you are good enough to use loops to do that. . please note you muset check that caomparison should be stopped as soon as some pixel mis matches to make code efficient .this may still take alot of time in execution depending on size of image so you may use a progress bar if you wish

regards

Message was edited by:

amol_gupta

amol_guptaa at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...
# 3

> I want to comapre two images, the second image here is a part of the first image i.e. a sub-image .

> I want an algorithm with which I would be able to check whether the subimage is a part of the first image

Given that specification, I can derive a very simple algorithm, which I present herewith:

return true;

YAT_Archivista at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...
# 4

> I want to comapre two images, the second image here

> is a part of the first image i.e. a sub-image . I

> want an algorithm with which I would be able to check

> whether the subimage is a part of the first image

I dunno wether this needs NN or not but some thought cam to my mind.

Since u just wanna check subimage...

Extract block of the same size of the image to be found starting with (0,0)

Loop through each pixel value in the block and match same pixel position value.

if all the pixel value matches return true else exit the loop

move to the second column of the image and extract a new block and continue the same process.

This is going to be very cumbersome...but workable..

cheers

ygchandera at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...
# 5

A common way of handling image match poblems is to use correlation.

Correlation is very robust as it gives you a new image containing the probabilites of there being a match between the original and th subimage. Therefore even if the subimage is not exactly the same as a part of the original you can still fins a match.

However, nieve correlation is scale and rotation sensitive so it cannot match a sub image that has been rotated or scaled when compared to the original.

matfud

matfuda at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...
# 6

Hi, amol_gupta and matfud , thank you very much for your valuable suggestions. But matfud , let me remind you that pixel comparison is useful when we are having two images of same resolution or size and here the situation is different. The suggestion made by amol_gupta about pattern recognition sounds interesting, I"ll have to try that, lets see if am good at maths.

But if anyone who knows a solution to this problem please give your suggestions, I am still open to them.

Chikua at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...
# 7

Chiku,

I am not talking about pixel comparison. I am talking about correlation. Correlation is a very robust method that provides you with a probability of image A existing inside image B. The images dont have to be the same size nor does one have to be an exact subimage of the other.

However, correlation in its simplest form cannot handle scale differences or rotation. In more complex version, like multiscale correlation, these are not issues.

Using neural networks to match images is a research project. You could do your PhD on it and not find a particularly robust system (I nearly did). In other words; please try a simple deterministic approach before trying one of the most comlpex approachs out there.

matfud

matfuda at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...
# 8
who said to do phd one can always go around and look for open source libraries also.it's matter of choice that you implement it on your own or use some one else's work(lib.)
amol_guptaa at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...
# 9
Have it your own way. You are causing work for yourself.
matfuda at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...
# 10
hi I want a simaple code example for Image comparison using Image Correlation plz send if u can(Gupta)Plz try to send as soon as possibleMessage was edited by: anksingh
anksingha at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...
# 11

I have solved a similar problem. What I needed was to find images within a big images. (Same pixel match). The first implementation was a pure brute force, by checking pixel by pixel. However, when I needed to speed things up, I used the images hash value, and, for each portion of the big image, also got the sub-images hash values. Then, the procecess of finding ws simply to find an equivalent hash inside the big image.

Jacek_Kustraa at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...
# 12
I want to compare 2 jpg images to check minute differences.Also,what is the best way to convert jpg image into grayscale?What is the latest compressing technique with grayscale images?
rdeep_raj@yahoo.coma at 2007-7-13 22:39:10 > top of Java-index,Other Topics,Algorithms...