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:
2:
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:
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);
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?
" 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.
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
will https://en.wikipedia.org/wiki/Iterati... ICP algorithm work? if I ttreat these images as follows
take a look at https://github.com/Itseez/opencv/blob...
have you try this