Pattern Recognition for Images
Hi all,
I'm trying to come up wtih an algorithm that I can use to detect patterns within images. The basic idea I'm starting with is to take an image of a dice and determine how many dots are on it (but to make sure to use actual pattern recognition). I've actually done some reading on fuzzy logic and am hoping I can apply this to my pattern recognition algorithm.
My basic questions are: what is the best algorithm to do this? how do I first define what my pattern is (i.e. the dots on the die)? do I need to use a clustering algorithm first?
If anyone can give me a hand or provide any references, I would greatly appreciate it.
Thanks in advance,
Anthony
[699 byte] By [
akoso16a] at [2007-9-30 23:42:07]

Can' t you use neural networks for doing the pattern recognition.
Neural networks are often mentioned in combination with image
pattern recognition. Certainly in case of a small amount of possible patterns
which is the case with a dice (can only have six possibilities)
kind regards,
There are a couple image processing algorithms that you would want to apply first before doing any pattern recognition. I would suggest doing a lowpass filter on the image to get rid of any noise from the image before doing anything else. This will get rid of the "pepper" noise that you may encounter. There are a couple algorithms for this, but the item that comes to mind for this particular case would just be a threshold. So for example, if you have a grayscale image, all values above a certain value are black, and all others are white. Then you can apply the lowpass filter to get rid of any specs that may be on the dice.
So for the lowpass, you could use a median filter with a given mask of say 3x3 or something along those lines.
After doing this, the pattern recognition algorithm is up to you. It may require trying a couple different things before settling on one in particular. I would suggest doing a region growing algorithm first to get your "areas" (or the dots on the dice). Then do an area calculation of the various regions that you obtain, and if you are above a certain area, then you have one dot. Then just repeat this for the total areas that you have. I would think that you will encounter a very large area for the white space, but I haven't done any of this type of stuff since last spring.
That should give a good start. Here are a couple links of courses that I took in undergrad, and you can dig around some of the lecture slides or whatever. There may be some good information there.
http://panda.ece.utk.edu/~hqi/REAL/
http://panda.ece.utk.edu/~hqi/ece472-572/
Some of the other relevant issues prior to discussing your pattern recognition algorithm are to ask what kind of pictures. Ar these photographs of actual die lying on some cluttered table taken at some odd angle so that you must infer the direction of gravity to decide which face is the top face, OR are these images taken top down looking only at the single die face, because the images are taken from some computer game.
These would be radically different pattern recognition problems and it seems to me inappropriate to discuss the "best method" until we have some idea of the domaine you are actually working in.
Thanks for the replies. The images that I will be using are photographs that I have taken (so there could be some glare, flash, etc.), but they will be taken with a view from above, with only one side showing (for now), on a dark table, with nothing else on the table (again, for now). I'm trying to make the situation easy to start and then add complexity as I progress.
Anthony
From the top down on a reasonablly dark sufrace you can probably skip most of the filtering by histograming in the x and y directions.
Just sum the pixels across an entire row and across an entire column. Do this for every row and column. You will then find that the spots stand out as bright spots in the one dimensional array.
It is generally faster to do you processing in one dimension rather than two.
From the array you can get a reasonable estimate of the width of the spots (convenient that circular spots have a uniform cross section), which will let you build properly shaped 2 dimensional filter. (bright in the center dark circular rim)
You can then apply the filter to every pair of x,y coordinates to verify if that intersection actually contains a dot that matches the filter.
The histogram is just a trick that smoothes the image by creating bulk statistics and at the same time give you a way to estimate the radius of the die dots in the image (assuming that you picture are not necessarily from the same distance) and it limits the areas in the image that you need to go back an process more fully.
> nice to join sunHey, you made it. Cheer up, buddy.
I have lots of java code for face detection, if you want email to medrhu00@yahoo.com