# Workable low-resolution object/target recognition pattern and library?

I've spent quite some time researching this, but most of my Google search results have turned up academic research papers that are interesting but not very practical.

I'm working on a target/pattern recognition project** where a robot with a small camera attached to it will attempt to locate targets using a small wireless camera as it moves around a room. The targets will ideally be as small as possible (something like the size of a business card or smaller), but could be (less ideally) as large as 8x10 inches. The targets will be in the form of something easily printable.

The pattern recognition software needs to be able to recognize if a target (only one at a time) is in the field of vision, and needs to be able to accurately differentiate between at least 12 different target patterns, hopefully from maybe a 50x50 pixel portion of a 640x480 image.

Before playing with the camera, I had envisioned using somewhat small printed barcodes and the excellent zxing library to recognize the barcodes.

As it turns out, the camera's resolution is terrible - 640x480, and grainy and not well-focused. Here is an example still image. It's not very well-suited for capturing barcodes, especially while moving. I think it could work with 8x10 barcodes, but that's really larger than I'm looking for. (I'm using this particular camera because it is tiny, light, cheap, and includes a battery and wi-fi.)

I'm looking for two things: a suggestion or pointer to an optimal pattern that I could use for my targets, and a software library and/or algorithm that can help me identify these patterns from images. I have NO idea where to start with the right type of pattern so suggestions there would really help, especially if there is a project out there that does something resembling this. I've found OpenCV and OpenSIFT which both seem like potential candidates for software libraries, but neither seemed to have examples of doing the type of recognition I'm talking about. I'm thinking picking the right type of pattern is the big hurdle to overcome here, so any pointers to the optimal type of pattern would be great. Being able to recognize the pattern from all different angles is a must.

So far, my idea is to use patterns that perhaps look something like this, where the three concentric color rings are simply either red, green, or blue - allowing for up to 27 unique targets, or 81 if I use 4 rings. From about 2 feet, the capture of a 3x3 inch target (from my computer screen) looks like this which seems like it would be suitable for analysis but I feel like there should be a better type of pattern that would be more compact and easier to recognize - maybe just a plain black and white pattern of some sort with shapes on it?

Pointers to an optimal approach for this are greatly appreciated.

• If you're looking for a commercial solution a product called HexSight will almost certainly fit the bill. I guess one question is what sort of viewing angles do you expect between the robot and the targets as those would distort the way those targets look to the camera. I do believe people use OpenCV in very similar applications but I don't have direct experience there. There are standard machine vision targets such that you may find on commercial products like bottle caps etc. Let me see if I can find you a link. – Guy Sirton Jan 10 '14 at 3:27
• @GuySirton These products normally assumes good optics and sensors what is not the best case where. So reduced data per space is an option. Also the distortion that comes, will only affect the final result at high angles, otherwise it should be good even without correction in the image, as the circle will turn into an ellipse. – Diego C Nascimento Jan 11 '14 at 5:42
• @DiegoCNascimento HexSight is actually surprisingly good at dealing with bad images. Obviously you want to optimize your vision system if you want the best results but in real world applications images are often out of focus, things get obscured, process variations, dirt. If you have truly terrible signal to noise though you would use more specialized techniques (something like spread spectrum). – Guy Sirton Jan 11 '14 at 20:11
• @GuySirton well I don't know HexSight so it has just a generic assumption. Anyway, I don't know of commercial products that go with out of focus, and other optics that can be corrected with a lens with remote focus control, iris control, etc. Anyway trying the sample image of the OP on an edge detect seems to give good results, just a little out of focus. – Diego C Nascimento Jan 11 '14 at 20:34

Well, one of the things is that computer vision starts at light, lenses and camera, you need good ones. Its not only a question of resolution, it's also a question of sensor size, signal/noise ratio, and good lenses. There's no need for high resolution if your camera has poor optics.

So your environment is pretty challenging and there's no certainly that it will works in this way.

The 640x480 is not to low resolution. I have read a paper that proposed something like your circle, but without the spaces between the rings, so more light reflected and less wasted space, the circles are divided to represent a code of the place.

A simple circle divided into 4 segments with 4 colors would give you 256 distinct codes.

More or less this:

The lines are just for exemplification. Lets suppose you use 4 divisions with 4 colors: Red, Green, Blue and White. This would give you $4^4=256$ distinct marks. You could detect the circle with edge detect algorithms, and then you have the coordinates to get the color marks.

This needs that the orientation of the robot and the mark is always the same, if the robot or camera tilts, or you want to put the mark in any position, just add a first marker.

Adding a redundancy check to it is good to, as this will help removing false-positive marks.

• Thanks! It sounds like I'm maybe not too far from a workable pattern. Any pointers on techniques or libraries for recognizing such patterns, or am I best off writing the recognition code from scratch? – jkraybill Jan 9 '14 at 22:26
• @jkraybill, the most common is OpenCV, unfortunately most common doesn't not mean the better, but the changes to get support is better. About the algorithm I have just a idea. Maybe pass a edge detector filter (there are some), as the the circles are black in white you should get a good contrast. Then use some to detect the circles patern (two concentric circles). After that you will have the coordinates to get the color of the middle (passing some blur). Thanks is done by up voting :) – Diego C Nascimento Jan 10 '14 at 3:44