Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Ask help for chamfer matching sample code

Hello, I got chamfermatching.cpp and sample code from OpenCV 2.4.9 and I am trying to make the algorithm to match characters. Please see my source files and testing images attached. I got below results:

The program can match e1.png in e2.png, minCost is 0.0626175. It can match e1.png in e1.png(match itself), minCost is 0.0730605. But it can also match e1.png in a.png, minCost is 0.0681643.

You see, this means the match is not good, it cannot distinguish letter a, letter e and bigger letter e. I did a little change to the sample code. Commenting or uncommenting Canny() lines in opencv_test.cpp has the similar results.

I doubt the problem is in the implementation of chamferMatching2() function. Its declaration is: CV_EXPORTS_W int chamferMatching2( Mat& img, Mat& templ, CV_OUT vector<vector<point> >& results, CV_OUT vector<float>& cost, double templScale=1, int maxMatches = 20, double minMatchDistance = 1.0, int padX = 3, int padY = 3, int scales = 5, double minScale = 0.6, double maxScale = 1.6, double orientationWeight = 0.5, double truncate = 20);

You see, there are a lot of default parameters. I doubt the problem exists here. Maybe I should adjust the default parameters? Can you give me some guide to fix the problem?

Thanks in advancea.pnge1.png(/upfiles/14078926822989436.png)e2.png(/upfiles/14078928183252037.jpg)(/upfiles/14078927264801916.png)

Ask help for chamfer matching sample code

Hello, I got chamfermatching.cpp and sample code from OpenCV 2.4.9 and I am trying to make the algorithm to match characters. Please see my source files and testing images attached. I got below results:

The program can match e1.png in e2.png, minCost is 0.0626175. It can match e1.png in e1.png(match itself), minCost is 0.0730605. But it can also match e1.png in a.png, minCost is 0.0681643.

You see, this means the match is not good, it cannot distinguish letter a, letter e and bigger letter e. I did a little change to the sample code. Commenting or uncommenting Canny() lines in opencv_test.cpp has the similar results.

I doubt the problem is in the implementation of chamferMatching2() function. Its declaration is: CV_EXPORTS_W int chamferMatching2( Mat& img, Mat& templ, CV_OUT vector<vector<point> >& results, CV_OUT vector<float>& cost, double templScale=1, int maxMatches = 20, double minMatchDistance = 1.0, int padX = 3, int padY = 3, int scales = 5, double minScale = 0.6, double maxScale = 1.6, double orientationWeight = 0.5, double truncate = 20);

You see, there are a lot of default parameters. I doubt the problem exists here. Maybe I should adjust the default parameters? Can you give me some guide to fix the problem?

Thanks in advancea.pnga.pnge1.png(/upfiles/14078926822989436.png)e2.png(/upfiles/14078928183252037.jpg)(/upfiles/14078927264801916.png)chamfermatching2.cppopencv_test.cpp

Ask help for chamfer matching sample code

Hello, I got chamfermatching.cpp and sample code from OpenCV 2.4.9 and I am trying to make the algorithm to match characters. Please see my source files and testing images attached. I got below results:

The program can match e1.png in e2.png, minCost is 0.0626175. It can match e1.png in e1.png(match itself), minCost is 0.0730605. But it can also match e1.png in a.png, minCost is 0.0681643.

You see, this means the match is not good, it cannot distinguish letter a, letter e and bigger letter e. I did a little change to the sample code. Commenting or uncommenting Canny() lines in opencv_test.cpp has the similar results.

I doubt the problem is in the implementation of chamferMatching2() function. Its declaration is: CV_EXPORTS_W int chamferMatching2( Mat& img, Mat& templ, CV_OUT vector<vector<point> >& results, CV_OUT vector<float>& cost, double templScale=1, int maxMatches = 20, double minMatchDistance = 1.0, int padX = 3, int padY = 3, int scales = 5, double minScale = 0.6, double maxScale = 1.6, double orientationWeight = 0.5, double truncate = 20);

You see, there are a lot of default parameters. I doubt the problem exists here. Maybe I should adjust the default parameters? Can you give me some guide to fix the problem?

Thanks in advancea.pngadvance! a.png e1.png e2.png chamfermatching2.cpp opencv_test.cpp

Ask help for chamfer matching sample code

Hello, I got chamfermatching.cpp and sample code from OpenCV 2.4.9 and I am trying to make the algorithm to match characters. Please see my source files and testing images attached. I got below results:

The program can match e1.png in e2.png, minCost is 0.0626175. It can match e1.png in e1.png(match itself), minCost is 0.0730605. But it can also match e1.png in a.png, minCost is 0.0681643.

You see, this means the match is not good, it cannot distinguish letter a, letter e and bigger letter e. I did a little change to the sample code. Commenting or uncommenting Canny() lines in opencv_test.cpp has the similar results.

I doubt the problem is in the implementation of chamferMatching2() function. Its declaration is: CV_EXPORTS_W int chamferMatching2( Mat& img, Mat& templ, CV_OUT vector<vector<point> >& results, CV_OUT vector<float>& cost, double templScale=1, int maxMatches = 20, double minMatchDistance = 1.0, int padX = 3, int padY = 3, int scales = 5, double minScale = 0.6, double maxScale = 1.6, double orientationWeight = 0.5, double truncate = 20);

You see, there are a lot of default parameters. I doubt the problem exists here. Maybe I should adjust the default parameters? Can you give me some guide to fix the problem?

Thanks in advance! a.png e1.png e2.png chamfermatching2.cpp opencv_test.cppchamfermatching2.cpp: http://pastebin.com/rKb1gKex opencv_test.cpp: http://pastebin.com/7Xz0ef6s

Ask help for chamfer matching sample code

Hello, I got chamfermatching.cpp and sample code from OpenCV 2.4.9 and I am trying to make the algorithm to match characters. Please see my source files and testing images attached. I got below results:

The program can match e1.png in e2.png, minCost is 0.0626175. It can match e1.png in e1.png(match itself), minCost is 0.0730605. But it can also match e1.png in a.png, minCost is 0.0681643.

You see, this means the match is not good, it cannot distinguish letter a, letter e and bigger letter e. I did a little change to the sample code. Commenting or uncommenting Canny() lines in opencv_test.cpp has the similar results.

I doubt the problem is in the implementation of chamferMatching2() function. Its declaration is: CV_EXPORTS_W int chamferMatching2( Mat& img, Mat& templ, CV_OUT vector<vector<point> >& results, CV_OUT vector<float>& cost, double templScale=1, int maxMatches = 20, double minMatchDistance = 1.0, int padX = 3, int padY = 3, int scales = 5, double minScale = 0.6, double maxScale = 1.6, double orientationWeight = 0.5, double truncate = 20);

You see, there are a lot of default parameters. I doubt the problem exists here. Maybe I should adjust the default parameters? Can you give me some guide to fix the problem?

Thanks in advance! a.png

e1.png

e2.png

chamfermatching2.cpp: http://pastebin.com/rKb1gKex http://pastebin.com/rKb1gKex

opencv_test.cpp: http://pastebin.com/7Xz0ef6s

Ask help for chamfer matching sample code

Hello, I got chamfermatching.cpp and sample code from OpenCV 2.4.9 and I am trying to make the algorithm to match characters. Please see my source files and testing images attached. I got below results:

The program can match e1.png in e2.png, minCost is 0.0626175. It can match e1.png in e1.png(match itself), minCost is 0.0730605. But it can also match e1.png in a.png, minCost is 0.0681643.

You see, this means the match is not good, it cannot distinguish letter a, letter e and bigger letter e. I did a little change to the code. Commenting or uncommenting Canny() lines in opencv_test.cpp has the similar results.

I doubt the problem is in the implementation of chamferMatching2() function. Its declaration is: CV_EXPORTS_W int chamferMatching2( Mat& img, Mat& templ, CV_OUT vector<vector<point> >& results, CV_OUT vector<float>& cost, double templScale=1, int maxMatches = 20, double minMatchDistance = 1.0, int padX = 3, int padY = 3, int scales = 5, double minScale = 0.6, double maxScale = 1.6, double orientationWeight = 0.5, double truncate = 20);

You see, there are a lot of default parameters. I doubt the problem exists here. Maybe I should adjust the default parameters? Can you give me some guide to fix the problem?

Thanks in advance! advance!

a.png

e1.png

e2.png

chamfermatching2.cpp: http://pastebin.com/rKb1gKex

opencv_test.cpp: http://pastebin.com/7Xz0ef6s

Ask help for chamfer matching sample code

Hello, I got chamfermatching.cpp and sample code from OpenCV 2.4.9 and I am trying to make the algorithm to match characters. Please see my source files and testing images attached. I got below results:

The program can match e1.png in e2.png, minCost is 0.0626175. It can match e1.png in e1.png(match itself), minCost is 0.0730605. But it can also match e1.png in a.png, minCost is 0.0681643.

You see, this means the match is not good, it cannot distinguish letter a, letter e and bigger letter e. I did a little change to the code. Commenting or uncommenting Canny() lines in opencv_test.cpp has the similar results.

I doubt the problem is in the implementation of chamferMatching2() function. Its declaration is: CV_EXPORTS_W int chamferMatching2( Mat& img, Mat& templ, CV_OUT vector<vector<point> >& results, CV_OUT vector<float>& cost, double templScale=1, int maxMatches = 20, double minMatchDistance = 1.0, int padX = 3, int padY = 3, int scales = 5, double minScale = 0.6, double maxScale = 1.6, double orientationWeight = 0.5, double truncate = 20);

You see, there are a lot of default parameters. I doubt the problem exists here. Maybe I should adjust the default parameters? Can you give me some guide to fix the problem?

Thanks in advance!

a.png

e1.png

e2.png

chamfermatching2.cpp: http://pastebin.com/rKb1gKex

opencv_test.cpp: http://pastebin.com/7Xz0ef6s