Page 1 of 1

Find & extract circle (stamp or seal) from image

Posted: 2016-09-14T02:52:52-07:00
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.

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

Posted: 2016-09-14T03:04:12-07:00
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

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

Posted: 2016-09-14T06:10:00-07:00
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)