Find & extract circle (stamp or seal) from image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ethaniel
Posts: 5
Joined: 2015-04-22T15:46:32-07:00
Authentication code: 6789

Find & extract circle (stamp or seal) from image

Post by ethaniel »

Hello,

I have images of documents that contain circle stamps (seals) on them.
Example: http://data28.i.gallery.ru/albums/smsdo ... d0b2ce.jpg

Documents can be of different sizes and colours. Stamps can be different colours and in different positions (but only 1 stamp per page)

Is it possible to detect the stamp and save it in another image?

Thank you.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Find & extract circle (stamp or seal) from image

Post by snibgo »

What visually defines the stamp? In this case, the stamp has high colour saturation.

Code: Select all

convert stampdoc.jpg -colorspace HCL -channel G -separate +channel
 -threshold 50% -format %@ info:
The result is:

Code: Select all

436x439+189+2141
Using that result:

Code: Select all

convert stampdoc.jpg -crop 436x439+189+2141 +repage sd_stamp.png
Image
snibgo's IM pages: im.snibgo.com
ethaniel
Posts: 5
Joined: 2015-04-22T15:46:32-07:00
Authentication code: 6789

Re: Find & extract circle (stamp or seal) from image

Post by ethaniel »

This works for high-contrast, but what about softer or black&white images, etc...?
Thank you for the quick reply. I would like to chip in $50 for beer if this is a easy problem to solve.

http://data26.i.gallery.ru/albums/smsdo ... 960bf2.jpg (soft)
http://data27.i.gallery.ru/albums/smsdo ... 46fd59.jpg (photo)
http://data26.i.gallery.ru/albums/smsdo ... b374d9.jpg (photo)
http://data27.i.gallery.ru/albums/smsdo ... 50bbdd.jpg (positioned incorrectly)
http://data27.i.gallery.ru/albums/smsdo ... 934d43.jpg (flares)
http://data27.i.gallery.ru/albums/smsdo ... cf5ee3.jpg (scan marks)
Post Reply