Ask Your Question

Revision history [back]

Matching two letters arabic?

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?