Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Shape module

I am trying to calculate distance between 2 images using shape context method (C++)

my code is:

cv::Ptr <cv::shapecontextdistanceextractor> mysc = cv::createShapeContextDistanceExtractor();
Mat query = imread("images/26.bmp", IMREAD_GRAYSCALE);
vector<point> contQuery = simpleContour(query);
Mat iiIm = imread("database/u0/training_Set/35.bmp", IMREAD_GRAYSCALE);
vector<point> contii = simpleContour(iiIm);
float distance = mysc->computeDistance(contQuery, contii); 
cout << distance << endl;

But when i add theses lines before the mentioned code:

Mat test = imread("images/8.bmp", IMREAD_GRAYSCALE); 
vector<point> testContour= simpleContour(test);

distance changes and gives new value, So why calling simpleContour() for another image can change the next values.

Shape module

I am trying to calculate distance between 2 images using shape context method (C++)

my code is:

cv::Ptr <cv::shapecontextdistanceextractor> mysc = cv::createShapeContextDistanceExtractor();
Mat query = imread("images/26.bmp", IMREAD_GRAYSCALE);
vector<point> contQuery = simpleContour(query);
Mat iiIm = imread("database/u0/training_Set/35.bmp", imread("images/25.bmp", IMREAD_GRAYSCALE);
vector<point> contii = simpleContour(iiIm);
float distance = mysc->computeDistance(contQuery, contii); 
cout << distance << endl;

But when i add theses lines before the mentioned code:

Mat test = imread("images/8.bmp", IMREAD_GRAYSCALE); 
vector<point> testContour= simpleContour(test);

distance changes and gives new value, So why calling simpleContour() for another image can change the next values.

Shape module

I am trying to calculate distance between 2 images using shape context method (C++)

my code is:

cv::Ptr <cv::shapecontextdistanceextractor> mysc = cv::createShapeContextDistanceExtractor();
Mat query = imread("images/26.bmp", IMREAD_GRAYSCALE);
vector<point> contQuery = simpleContour(query);
Mat iiIm = imread("images/25.bmp", IMREAD_GRAYSCALE);
vector<point> contii = simpleContour(iiIm);
float distance = mysc->computeDistance(contQuery, contii); 
cout << distance << endl;

But when i add theses lines before the mentioned code:

Mat test = imread("images/8.bmp", IMREAD_GRAYSCALE); 
vector<point> testContour= simpleContour(test);

distance changes and gives new value, So why calling simpleContour() for another image can change the next values.values. implementation of simpleContour() exists in this file:
https://github.com/Itseez/opencv/blob/master/samples/cpp/shape_example.cpp