12

I am designing a system that will scan in standardized forms to images (e.g., TBitmap). I would like to identify alignment marks on these pages and use the locations of these crop marks to rotate the page to its proper orientation (so top is actually up) and to crop the image to the location of the alignment marks.

An example image of a typical mark I'd need to locate is:

Crop mark
(source: tpub.com)

What are techniques to evaluate an image obtained from a scanner to locate various marks within the image? I'd need to locate multiple marks and their center point locations.

Community
  • 1
  • 1
Greg Bishop
  • 517
  • 1
  • 5
  • 16
  • 2
    I know that many imaging sdks including LEADTools have this built in. I don't know how to implement it myself, but I think I'd do a horizontal-line detection algorithm (within x Degrees), and a vertical line detection algorithm, and then check all possible + points for a 90%-continuous-circle. http://www.leadtools.com/help/leadtools/v15/main/api/dllsteps/detectingregistrationmarks.htm – Warren P Mar 21 '12 at 18:59
  • 2
    Hmm, I'm no expert, but that isn't a crop mark, it's an alignment mark for the printer to use when doing 4 color printing. The crop marks are simple straight lines. – mj2008 Mar 21 '12 at 20:43
  • Warren P: Thanks for the link and suggested method. I'm open to a commercial library if that's what it takes. I also have the liberty to change the symbol used, so the LeadTools product may be a viable solution. – Greg Bishop Mar 21 '12 at 21:00
  • MJ2008: Fair point, my terminology may be off. What I really need is to be able to identify some type of mark so that I can crop to it. I'm certainly open to calling it an alignment mark; although for my purpose at least, it is also a crop mark, I suppose. – Greg Bishop Mar 21 '12 at 21:01
  • I suspect the marks aren't always equal in size, but you might want to get some inspiration from [this Dutch post](http://www.nldelphi.com/forum/showthread.php?t=37228) which uses ScanLine, rather effectively. – NGLN Mar 21 '12 at 23:46
  • [Vincent Morard](http://imanalyse.free.fr/?page=research) has written the C++ open source [ImAnalyse](http://imanalyse.free.fr/?page=imanalyse). If a commercial library is an option, a [high profile freelancer](http://imanalyse.free.fr/?page=freelance) could be another alternative too. Disclaimer: I have no relation with him. – menjaraz Mar 22 '12 at 04:51
  • @WarrenP The one solution you gave to OP, about LEADtools, do you have any idea about any open source alternative for detection of alignment marks in an image? – Akashdeep Saluja Jun 04 '14 at 09:29

3 Answers3

6

Just brainstorming some possible approaches.

Template Matching

A brute-force method would be to have a bitmap image of what a registration mark should look like. Then, for every possible rectangle in the image that has the same width and height as the template bitmap, you compare the image pixels to the template pixels. If most of the corresponding pixels match, you've probably found a registration mark. This is very compute intensive because you have to scan over all possible positions, rotations, scale factors, etc. You can whittle this down by taking advantage of things you know. For example, your registration mark is symmetric, so you don't need to check all possible rotations. Perhaps you know the exact size the mark should be and thus can avoid iterating over different scale factors. Finally, you might know that the registration marks should be near the corners and thus can skip over most of the middle of the image.

Interesting Points

Find a way to identify "interesting points" in the image. For example, points that seem to be at the center of an intersection could be found by doing a convolution with a small kernel that reinforces pixels that have matching pixels in the cardinal directions and then threshold the result. This gives a list of pixels that seem to be intersection points (there might be some noise). You can search this subset of coordinates for a "constellation" that looks like the five intersection points in your registration mark. You might still need to apply template matching to find the most likely positions, but this would vastly reduce the number of locations, rotations, and scale factors that you'd otherwise have to try.

Feature Detection

There are algorithms for line detection, circle detection, etc. You might be able to run a bunch of these and then look for a combination of two crossing line segments within a circle. This may be the most robust way, but it's probably also the hardest to get working.

Some preprocessing steps, like running edge detectors, thresholding, or dilation, and erosion filters might also help if the images aren't real clean to begin with.

Adrian McCarthy
  • 45,555
  • 16
  • 123
  • 175
  • 2
    Why not use OCR if the crop/alignement mark can be seen/handled as a character if it's not already a right one ? It just crosses my mind. – menjaraz Mar 22 '12 at 05:27
  • menjaraz: I've considered using OCR, too. However, I've never used it before. Is it possible to "train" an OCR tool to learn new characters? Would it be possible for the OCR to return the center point? Or, if a "T" symbol were used, could OCR return the intersection of the two lines in the "T"? – Greg Bishop Mar 22 '12 at 15:19
2

I found this french PDF resource by Colin BOUVRY dealing with Recognition of characters and symbols etched on glass.

If you are not comfortable with french, you don't have to worry: A bunch of valuable source codes in Delphi are listed at the bottom of the document, believe me!

Thanks.

menjaraz
  • 7,551
  • 4
  • 41
  • 81
0

For mark above you can use Hough transform for circles and lines, then check if any cross-line is in the center of any circle then it is your mark. I am not sure about delphi but Hough transform algorithm is well known and implemented in a plenty of libs.

Vit
  • 793
  • 4
  • 17