Ask Your Question

VA's profile - activity

2016-06-20 07:58:47 -0600 asked a question Template matching using single template from multiple images
cout << "Size of Template image =" << Img_Templ.size() << endl;
Img_Result = Img_Scene.clone();//img_Scene is huge image
Mat img1 = Img_Result(Rect(0, 0, 1000, 1000));
Mat img2 = Img_Result(Rect(Img_Result.cols - 1000, 0, 1000, 1000));
vector<Mat> List_roi;
List_roi.push_back(img1);
List_roi.push_back(img2);
vector<Mat>images;
Point  Point_TemplateLocation;
for (int i = 0; i < List_roi.size(); i++)
{
    if (!FindTemplateMatching(List_roi[i], Img_Templ, Point_TemplateLocation))
    {cout << "No Match Found";
    }
    else
    {images.push_back(img1);
    images.push_back(img2);
        rectangle(images[i], Point_TemplateLocation, Point(Point_TemplateLocation.x + Img_Templ.cols, Point_TemplateLocation.y + Img_Templ.rows), Scalar(0, 0, 255), 2, 8, 0);
        putText(images[i], format("Object1 %d", i), Point(Point_TemplateLocation.x + Img_Templ.cols / 4, Point_TemplateLocation.y + Img_Templ.rows / 2), 1, 1, Scalar(255, 0, 0), 1, -1);

    }}
  // display result is here
waitKey(0);
return 0;  }