Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best algorithm to locate a point in an image file?

I want to create a mark sheet recognizer. Here is the description:

  1. My system uses black and white color scheme.
  2. The mark sheet paper has a small black rectangle on each corner and an additional small black rectangle, to determine orientation, near one of the previous rectangles.
  3. The paper is scanned to yield an image (in bmp format for example).

The first step is to locate these five references in image as eficient as possible.

My rough idea is to trace row by row and from left to right for each row. It sounds very slow I think.

Is there any better way to do that?

Thank you in advance.

regards,

Suugaku

like image 523
xport Avatar asked May 24 '10 12:05

xport


2 Answers

You can start by searching where you typically expect to find the reference images. You can do this by keeping statistics of where they were before. In particular if you have two frames taken one after the other, the chances are the reference points won't have moved very far.

Once you have found one or more of the reference points, the position of the others becomes heavily constrained so you can make a very good guess as to where the others must lie. Each time you find a new point it provides more hints as to where the remaining points can be.

So you can start by using a bit of guesswork to find the points quickly, and revert to a line-by-line scan if that fails.

like image 164
Mark Byers Avatar answered Oct 24 '22 02:10

Mark Byers


Speed is not an issue if you use the BitMap.LockBits() instance method (https://web.archive.org/web/20121203144033/http://www.bobpowell.net/lockingbits.htm). Then, all you need is a couple of hours.

like image 24
Fredrik Johansson Avatar answered Oct 24 '22 02:10

Fredrik Johansson