# Working with mathTemplate

**URL:** <https://forum.opencv.org/t/working-with-mathtemplate/8147>\
**Category:** C++\
**Tags:** matchtemplate\
**Created:** [March 28, 2022, 2:23pm UTC](https://forum.opencv.org/t/working-with-mathtemplate/8147 "2022-03-28T14:23:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elizaveta1995](https://avatars.discourse-cdn.com/v4/letter/e/bb73d2/32.png) [@Elizaveta1995](https://forum.opencv.org/u/Elizaveta1995)\
**Post date:** [March 28, 2022, 2:23pm UTC](https://forum.opencv.org/t/working-with-mathtemplate/8147/1 "2022-03-28T14:23:14Z")

</div>

I am mastering OpenCV and tried to find images in a picture using matchTemplate. There were a lot of questions:

1. I got strange results. When I use the getImage function (from the book “Learning image processing with OpenCV”), I get some results, and when I use it only for NORMED convertTo methods, I get other results.
2. Which of the ways to get images after the matchTemplate operation should be used - convert To only for NORMED or getImage for any results of the matchTemplate operation?
3. Did I understand correctly that for a particular image I need to see the results of all the matchTemplate methods in order to choose the best method?
4. If I need to count the number of elements in the image after using matchTemplate, do I need to see the results of all the methods? choose the desired method and count the number of white (dark) spots corresponding to the number of images?  
The project attached to [OpenCVquestions.zip — Яндекс.Диск](https://disk.yandex.ru/d/zZtIV8aIhcEmFw)

---

<div class="post-metadata">

**Author:** ![Elizaveta1995](https://avatars.discourse-cdn.com/v4/letter/e/bb73d2/32.png) [@Elizaveta1995](https://forum.opencv.org/u/Elizaveta1995)\
**Post date:** [April 6, 2022, 7:51pm UTC](https://forum.opencv.org/t/working-with-mathtemplate/8147/2 "2022-04-06T19:51:45Z")

</div>

Is this really such a difficult question and no one can answer it?
