How to match two images and find out mistakes

asked 2012-10-07 18:08:24 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

I have a template of a letter and many of it's variations (see below) which i acquire from a digital pen :


image description

Test 1

image description

Test 2

image description

These letters are always scaled to be in the same bounding box .

I want to detect the mistakes in the letter , like the mistake in Test 1 is that that there is a extra line , and mistake in Test 2 is that there is a missing segment . Similarly there can be a mistake in which there is a curve instead of a line segment . I want to find the parts which need to be corrected . How should i go about doing it ?

edit retag flag offensive close merge delete


I would suggest you find a way to connect to the dots. Perhaps using a findContours or something to that effect then detecting lines and measuring them

imran gravatar imageimran ( 2012-10-09 08:30:47 -0600 )edit

Connect the dots, skeletonize the shape, use morphology hit-or-miss to find junctions and endpoints. A perfect A would have 3 junctions and 2 endpoints. If you get more or less of them, you will know where a mistake is located. That will work provided you know what character you are working with.

Witek gravatar imageWitek ( 2014-04-20 05:25:31 -0600 )edit

what's the best way to connect the dots?

dpwicaksa gravatar imagedpwicaksa ( 2016-01-12 05:26:41 -0600 )edit