Chamfer Matching match score
I am currently working on a project that will utilize the chamfer matching algorithm. The program will show an image and then a user will try draw the image using a touch device. The program will then match and compute the similarity scores of the hand drawn image vs the given image based on their edges.
I had reviewed the chamfer matching example from the /opencv/samples/cpp. The example provides a way on how to use the chamerMatching() effectively but it does not provide the chamfer distance score between the template image and the image edge map. My question is what is the specific function/method i should use to get the chamfer score of the hand drawn image against the given image. Is there also a way to get the similarity score in percentage?
I think, if you transfer both images to binary, you can count pixels in matching points using mask from original image. Btw if you are trying to compare images, you probably should use contour images, not colored one's.
first of all, you can use
cvtColor(input_image, output_image, CV_BGR2GRAY);
to transfer image to binary, also, to count only black and white pixels, you will need to threshold already binary image withthreshold( input_image, output_image, 200, 255, THRESH_BINARY );
, after that with a help of countNonZero you can count them. That will only work for black-n-white images so keep it on mind.but to work only with a selected region you need something like this, i think.
Thanks man it solved my problem.
thanks for this post! i got an idea for my own problem :)