permaculture playing cards*
The moose likes Java in General and the fly likes Image Processing / Pattern Recognition Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Image Processing / Pattern Recognition" Watch "Image Processing / Pattern Recognition" New topic
Author

Image Processing / Pattern Recognition

Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 435
Hi,
I need to make a standalone application that has a method which takes two images as parameters as compare them. One image source that has been store on the system and the second one will come from some source like a specialized camera etc. This image will also be stored temporarily and compared to the original image.
Some steps could be:
1) cleaning the temp image.
2) comparing the temp with the stored image bit by bit (or some other method).
3) returning true if 80-90% bits of the two images agree.
But I am not very clear about it. Any help ? I want to know how to go about it?.

Thanx in Advance
Maki Jav


Help gets you when you need it!
Tanveer Rameez
Ranch Hand

Joined: Dec 11, 2000
Posts: 158
Hi,
I will just expalin in short.
1. obtain the pixel array of the image stored in system using PixelGrabber class (probably it is in java.awt.image package). See the api doc or any book for how to use it.
Then also obtain the pixel array of the temp image. then compare each element of one array with element of the other array i.e.
int identical=0;
boolean similar;
for(inr i=0;i<array1.length;i++)
{
if(array1[i]==array2[i]) identical++;
}
then at the end check :
if(identical>array1.length*0.8) similar=true;
else similar=false;

I am explaining without much explaination, but i hope u will get the point.
regards
Tanveer
Originally posted by Maki Jav:
Hi,
I need to make a standalone application that has a method which takes two images as parameters as compare them. One image source that has been store on the system and the second one will come from some source like a specialized camera etc. This image will also be stored temporarily and compared to the original image.
Some steps could be:
1) cleaning the temp image.
2) comparing the temp with the stored image bit by bit (or some other method).
3) returning true if 80-90% bits of the two images agree.
But I am not very clear about it. Any help ? I want to know how to go about it?.

Thanx in Advance
Maki Jav


Author of JPhotoBrush Pro (www.jphotobrushpro.com)
Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 435
Tanveer,
Thank you for the reply. I will get back on this latter
Thanx once again,
Maki Jav
Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 435
The one problem I am facing is to clean the picture recieved before it is analyzed. Ideas anyone?
Maki Jav
Tanveer Rameez
Ranch Hand

Joined: Dec 11, 2000
Posts: 158
What do u mean by 'clean' ? Do you mean 'despectable' or 'remove noise' to remove noise? Cleaning cannot exactly retore the original. So after cleaning you cannot compare pixel by pixel in the orginal picture so accurately.
Then maybe instead of doing a if(array1[i]==array2[i]), you migth have to have somthing like this:
if( array1[i]<array2[i]+deviation && array1[i]>array2[i]-deviation ) kind of thing so that the pixels are nearly equal(not exactly equal). U have to set the deviation variable intelligently.
Remember that if you image is a RGB image then you have to extract the R,G,B component and compare them separately.
But the things are not that straightforward to get good results. The concepts r not specific to Java, so I suggest you read some books on image processing, pattern recognition and then use Java to implement the concept/algorithm.
Tanveer
[ October 01, 2003: Message edited by: Tanveer Rameez ]
[ October 01, 2003: Message edited by: Tanveer Rameez ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
This is a pretty complex topic, and the type of solution that will work best for you may vary greatly depending on what types of images you're dealing with, and what types of variations are possible between images. Is it possible you'll have two images which are "identical" except that one is lit more brightly than the other? (Taken at a different time of day, for example?) In this case you may well find that none (or virtually none) of the pixels exactly match, but most of them are close in value. Might one image be shifted up or down relative to another? Enlarged or shrunk? Rotated? How big a difference are you looking for? Say you've got two images of a warehouse lot, and one image has a man wearing a ski mask and carrying off a stero system. That many may be an obvious difference to you, but he's only taking up 5% of the avilable pixels, or less. Will you be interested in large differences of a few pixels? Tiny differences in many pixels? Some combination of this?
I don't expect we can give you a good solution here; there are too many complexities. I just wanted to give you a taste of the considerations you'll need to get into. As Tanveer said, you should probably find an introductory book on image processing to get a feel for the subject. There are many different techniques; many are useful for some types of problems, and useless for others. You've probably got a pretty long project ahead of you. Enjoy...


"I'm not back." - Bill Harding, Twister
Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 435
Thanks for the replies.
Actually I have just to write the class for doing the job. I think that the user intends to use it for identification.
I think the distance form which the picture will be taken, the lighting condition of the room etc will be as constant as possible.
You must have seen in the movies in which a person fixes his head in a gadet for the computer to scan the guy's retina...
something similar is perhaps required by that person who asked me to do the project for him.

Maki Jav
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
I think the distance form which the picture will be taken, the lighting condition of the room etc will be as constant as possible.
Well, it's the "as possible" that's key. You may have to find out how constant it is. For a retina scan, I'd wonder how precisely they can center the scan on your eye. What if next time they do it, they're off to the left by a few pixels? I'd recommend getting some sample images. Ideally, get a set of images representing the same person but taken at different times, possibly under different conditions. Have the person try to move their head around during the process, to see how far off center their pupil image might be. Maybe this is a non-issue; maybe it's critical; hard to say from here. Good luck.
Bruno Dery
Ranch Hand

Joined: Oct 05, 2003
Posts: 37
For pattern recognition I think you need the Fast Fourrier Transform (FFT). I'm not completely sure because that's one of those studies I was bad at in college
But anyways, we were using it to do all kinds of image processing, like eliminating noise, applying filters or identifying contours. The main I remember is that it's a complex algorythm but its supposed to be powerful
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
FFT is definitely an important tool for image processing. Also try searching on "wavelets", which from my limited understanding can be thought of as a sort of weighted Fourier transform which can be more suited to analyzing a non-periodic signal/image. Fourier transforms can be treated as a subset of wavelet theory. Here is a good intro to wavelets for Java programmers.
However, both FFT and wavelets are far from the only tools available, and many of the others are a lot simpler. I'd recommend studying some sort of overview book on image processing to get a tast of the different techniques available, before you spend a lot of time understanding FFT or wavelets. And again, understanding the problem well, and what sorts of variations in image you should expect, and which variation you should detect vs. which variations you should ignore, is VERY important. This will probably dictate which processing techniques are useful to you.
[ October 06, 2003: Message edited by: Jim Yingst ]
Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 435
Thank you for the replies.
The face will be used for recognition...
I am in need to know more about FFT and wavelet...
and other similar stuff.
I guess that there are no easier java libraries available for the task.
Have to start from zero, right?!
But hey! thanks guys... keep me posted

Maki Jav
[ October 12, 2003: Message edited by: Maki Jav ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Image Processing / Pattern Recognition
 
Similar Threads
IE float problem
Why did it have to be PNG
Applet graphics
Resizing Large JPG Problem
Help!Help!