Ask Your Question

Steven Mao's profile - activity

2016-08-10 21:28:04 -0600 answered a question How to make image of template matching result

You can get the matching result use this codes.

Mat img = imread(filename);
Mat tmpl = imread(tmplname);
Mat mask = imread(maskname);
Mat res;

if(img.empty())
{
    help();
    cout << "can not open " << filename << endl;
    return -1;
}

if(tmpl.empty())
{
    help();
    cout << "can not open " << tmplname << endl;
    return -1;
}

if(mask.empty())

{ help(); cout << "can not open " << maskname << endl; return -1; }

//int method = CV_TM_SQDIFF; int method = CV_TM_CCORR_NORMED; matchTemplate(img, tmpl, res, method, mask);

double minVal, maxVal; Point minLoc, maxLoc; Rect rect; minMaxLoc(res, &minVal, &maxVal, &minLoc, &maxLoc);

if(method == CV_TM_SQDIFF || method == CV_TM_SQDIFF_NORMED) rect = Rect(minLoc, tmpl.size()); else rect = Rect(maxLoc, tmpl.size());

rectangle(img, rect, Scalar(0, 255, 0), 2);

imshow("detected template", img); waitKey();

return 0; }

2016-06-02 08:07:49 -0600 answered a question Script error for descriptors_1.rows

Maybe the define type of i should be unsigned type. hope it can help you.

2016-05-22 02:35:33 -0600 answered a question To find available algorithms in your version of OPENCV?

Hi,friend,do you know how to get the algorithms list for the OpenCV3.0.0? I code your sample above and do not find getList function in Algorithm class of OpenCV3.0.0 , thanks!

2016-05-22 02:35:33 -0600 answered a question Overhead Videos of Pedestrians

I think that a simple webcam can be used to gain some useful video files which suit for this project.Hope to help you.^_^