Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Template matching using single template from multiple images

$
0
0
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 List_roi; List_roi.push_back(img1); List_roi.push_back(img2); vectorimages; 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; }

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>