DEV Community

loading...

Discussion on: Stamp Detection using Computer Vision and Python

Collapse
codemouse92 profile image
Jason C. McDonald

Impressive!

I'm curious how you'd handle a couple of plausible additional cases, however:

  1. A round or oval company logo on the form.

  2. A square or rectangular stamp.

Collapse
6aravind profile image
Aravind Ramalingam Author • Edited

With some sample images this is not impossible, but would require some trail and error.

  1. Most probably the company logo would not change so we can filter out the logo contour by one of the options:

    • Resize the test image to your sample image size and find all contours in the test image. Make sure to not use any approximation while retreiving the contours points. Round or oval logo will have easily more than 7 or 8 points. By now we should be able find the logo contour. In the event both the logo and stamp are of same shape then we can calculate the area of the contours and identify which contour is what. If the area is also about the same, then use location. Most often or not, position of the company logo would be fixed. Compute the center of the contours and use the relative distance from center of image to identify the logo.
    • If the color of the logo is distinct from rest of the image then convert the image to HSL space and identify the logo.
  2. We can find the center of the contour using the moments and when combined with the extreme points of the contour it should be easy to identify square or rectangle stamps.

Hope you find this useful.