Matching two letters arabic?

asked 2016-03-21 04:32:20 -0600

Hello, My requirement is to match a computer generated image and scanned image of same letter so images are almost similar but not a perfect match of pixel to pixel. like this:

1:image description

2:image description

If you zoom these images you will notice the difference in pixels. I want approximate match of them.

So first i am trying to match two arabic shapes, I have implemented this approach.

1: Reading two images as below: image description image description

2: Applying Canny operator to fetch outline for both shapes which result like this.

int thresh=150;
Canny(imagegray1, imageresult1,thresh, thresh*3);
Canny(imagegray2, imageresult2,thresh, thresh*3);

image description image description

3: now i want to do matching of both shapes i have tried matchShapes() and Hausdorff distance functions using contours but problem is findContours() giving me more than one contour.

findContours(imageresult1,contours1,hierarchy1,CV_RETR_CCOMP,CV_CHAIN_APPROX_NONE ,cvPoint(0,0));
findContours(imageresult2,contours2,hierarchy2,CV_RETR_CCOMP,CV_CHAIN_APPROX_NONE ,cvPoint(0,0));

I am planning two fit bezier curves to outlined images (by treating all black pixel as (x,y)). Can someone suggest me how to get approximate matching of images?

edit retag flag offensive close merge delete

Comments

1

" findContours() giving me more than one contour." -- before moving on, you should try to analyze first, why this happens, i.e Canny usually finds an outer and an inner contour. if your images are as clear as above, you could try, if it gets better, if you use a plain threshold() instead of Canny()

also try RETR_EXTERNAL to restrict it to the most 'outer' contour.

berak gravatar imageberak ( 2016-03-21 04:36:22 -0600 )edit

I have also tried RETR_EXTERNAL which giving me more than one contour but didn' t tried plain threshold() let me check if it helps. Do you know other statistical technique if i treat my image as a set of (x,y) points Thanks

techgargmukul gravatar imagetechgargmukul ( 2016-03-21 04:46:55 -0600 )edit

will https://en.wikipedia.org/wiki/Iterati... ICP algorithm work? if I ttreat these images as follows

Set1 =[(x1, y1), (x2, y2), ..., (xN, yN)]
Set2 =[(a1, b1), (a2, b2), ..., (aN, bN)]
techgargmukul gravatar imagetechgargmukul ( 2016-03-21 05:15:06 -0600 )edit
sturkmen gravatar imagesturkmen ( 2016-03-21 06:41:09 -0600 )edit

have you try this

LBerger gravatar imageLBerger ( 2016-03-21 16:20:19 -0600 )edit