|
4 | 4 | Multi-Template-Matching is an accessible method to perform object-detection in images using one or several template images for the search. |
5 | 5 | The strength of the method compared to previously available single-template matching, is that by combining the detections from multiple templates, |
6 | 6 | one can improve the range of detectable patterns. This helps if you expect variability of the object-perspective in your images, such as rotation, flipping... |
7 | | -The detections from the different templates are not simply combined, they are filtered using Non-Maxima Supression (NMS) to prevent overlapping detections. |
| 7 | +The detections from the different templates are not simply combined, they are filtered using Non-Maxima Suppression (NMS) to prevent overlapping detections. |
8 | 8 |
|
9 | 9 | The python implementations of mtm only perform the detection and filtering with NMS. |
10 | | -For the templates, you can provde a list of images to use. You can also perform geometrical transformation (kind of data augmentation) of existing templates if you expect these transformation in the image (ex: rotation/flipping). |
| 10 | +For the templates, you can provide a list of images to use. You can also perform geometrical transformation (kind of data augmentation) of existing templates if you expect these transformation in the image (ex: rotation/flipping). |
11 | 11 |
|
12 | 12 | This implementation relies on the packages scikit-image and shapely, but not on OpenCV contrary to the python implementation originally published (and still available). |
13 | 13 | It is more object-oriented, especially it should be easier to adapt to other shapes (detection with rectangular template but outlining detected region with a non-rectangular shape), by implementing another type of Detection object. |
14 | | -In this implementation the detection are of type `BoundingBox` which is derived from the shapely `Polygon` class. Therefore you can use all functions available for Polygon with a BoundingBox. |
| 14 | +In this python implementation, the detections are of type `BoundingBox` and hold a reference to a shapely `Polygon` object (a subtype of [geometric object](https://shapely.readthedocs.io/en/latest/manual.html#geometric-objects)). |
| 15 | +While most functions required for multi-template-matching are directly available through the BoundingBox object, you can also use functions and attributes available to shapely Polygon by accessing the `polygon`attribute of a BoundingBox. |
15 | 16 |
|
16 | | -The main function `mtm.matchTemplates` returns the best predicted locations provided a scoreThreshold and an optional number of objects expected in the image. |
| 17 | +Core functions available in mtm are : |
| 18 | + |
| 19 | +- the main function `mtm.matchTemplates` |
| 20 | +It returns the best predicted locations provided a scoreThreshold and an optional number of objects expected in the image. |
| 21 | +It performs the search for each template followed by overlap-based Non-Maxima Suppression (NMS) to remove redundant/overlapping detections. |
| 22 | +If a number N of expected object is mentioned, it returns at max N detection but potentially less depending on the score threshold. |
| 23 | + |
| 24 | +- the function `mtm.findMatches` |
| 25 | +It performs the search for each template and return all detections above the score-threshold, or a single top-score detection for each template if `singleMatch` is true. |
| 26 | +Contrary to `mtm.matchTemplates`, __it does not perform NMS__ so you will potentially get overlapping detections. |
| 27 | +Usually one should use directly `mtm.matchTemplates`. |
17 | 28 |
|
18 | 29 | The website of the project https://multi-template-matching.github.io/Multi-Template-Matching/ references most of the information, including presetnations, posters and recorded talks/tutorials. |
19 | 30 |
|
20 | 31 | # Installation |
21 | | -Coming soon. |
| 32 | +Open a command prompt (or Anaconda prompt if using Anaconda) and type |
| 33 | +`pip install mtm` |
| 34 | + |
| 35 | +For development purpose, you can clone/download this repo, open a command prompt in the root directory of the repo and use pip to install the package in editable mode. |
| 36 | +`pip install -e .` |
| 37 | +mind the dot specifying to use the active directory (ie the one you open the prompt in). |
| 38 | +In editable mode, any change to the source code is directly reflected the next time you import the package. |
22 | 39 |
|
23 | 40 | # Examples |
24 | 41 | Check out the [jupyter notebook tutorial](https://github.com/multi-template-matching/mtm-python-oop/tree/master/tutorials) for some example of how to use the package. |
|
0 commit comments