Skip to content

Commit 8ef3ca0

Browse files
authored
Move API doc to wiki
1 parent 6613807 commit 8ef3ca0

File tree

1 file changed

+1
-73
lines changed

1 file changed

+1
-73
lines changed

README.md

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -9,79 +9,7 @@ Once installed, `import MTM`should work.
99
Example jupyter notebooks can be downloaded from the tutorial folder of the github repository and executed in the newly configured python environement.
1010

1111
# Documentation
12-
The package MTM contains mostly 2 important functions:
13-
14-
## matchTemplates
15-
`matchTemplates(listTemplates, image, method=cv2.TM_CCOEFF_NORMED, N_object=float("inf"), score_threshold=0.5, maxOverlap=0.25, searchBox=None)`
16-
17-
This function searches each template in the image, and return the best N_object location which offer the best scores and which do not overlap above the `maxOverlap` threshold.
18-
19-
__Parameters__
20-
- _listTemplates_:
21-
list of tuples (LabelString, Grayscale or RGB numpy array) templates to search in each image, associated to a label
22-
23-
- _image_ : Grayscale or RGB numpy array
24-
image in which to perform the search, it should be the same bitDepth and number of channels than the templates
25-
26-
- _method_ : int
27-
one of OpenCV template matching method (0 to 5), default 5=0-mean cross-correlation
28-
29-
- _N_object_: int
30-
expected number of objects in the image
31-
32-
- score_threshold: float in range [0,1]
33-
if N>1, returns local minima/maxima respectively below/above the score_threshold
34-
35-
- _maxOverlap_: float in range [0,1]
36-
This is the maximal value for the ratio of the Intersection Over Union (IoU) area between a pair of bounding boxes.
37-
If the ratio is over the maxOverlap, the lower score bounding box is discarded.
38-
39-
- _searchBox_ : tuple (X, Y, Width, Height) in pixel unit
40-
optional rectangular search region as a tuple
41-
42-
__Returns__
43-
- Pandas DataFrame with 1 row per hit and column "TemplateName"(string), "BBox":(X, Y, Width, Height), "Score":float
44-
- if N=1, return the best match independently of the score_threshold
45-
- if N<inf, returns up to N best matches that passed the score_threshold
46-
- if N=inf, returns all matches that passed the score_threshold
47-
48-
49-
The function `findMatches` performs the same detection without the Non-Maxima Supression.
50-
51-
## drawBoxesOnRGB
52-
The 2nd important function is `drawBoxesOnRGB` to display the detections as rectangular bounding boxes on the initial image.
53-
To be able to visualise the detection as colored bounding boxes, the function return a RGB copy of the image if a grayscale image is provided.
54-
It is also possible to draw the detection bounding boxes on the grayscale image using drawBoxesOnGray (for instance to generate a mask of the detections).
55-
`drawBoxesOnRGB(image, hits, boxThickness=2, boxColor=(255, 255, 00), showLabel=True, labelColor=(255, 255, 0), labelScale=0.5 )`
56-
57-
This function returns a copy of the image with predicted template locations as bounding boxes overlaid on the image
58-
The name of the template can also be displayed on top of the bounding boxes with showLabel=True.
59-
60-
__Parameters__
61-
- _image_ : numpy array
62-
image in which the search was performed
63-
64-
- _hits_ : pandas dataframe
65-
hits as returned by matchTemplates or findMatches
66-
67-
- _boxThickness_: int
68-
thickness of bounding box contour in pixels. -1 will fill the bounding box (useful for masks).
69-
70-
- _boxColor_: (int, int, int)
71-
RGB color for the bounding box
72-
73-
- _showLabel_: Boolean, default True
74-
Display label of the bounding box (field TemplateName)
75-
76-
- _labelColor_: (int, int, int)
77-
RGB color for the label
78-
79-
- _labelScale_: float, default=0.5
80-
scale for the label sizes
81-
82-
__Returns__
83-
- _outImage_: RGB image
84-
original image with predicted template locations depicted as bounding boxes
12+
The [wiki](https://github.com/multi-template-matching/MultiTemplateMatching-Python/wiki) section of the repo contains a mini API documentation with description of the key functions of the package.
8513

8614
# Examples
8715
Check out the [jupyter notebook tutorial](https://github.com/multi-template-matching/MultiTemplateMatching-Python/tree/master/tutorials) for some example of how to use the package.

0 commit comments

Comments
 (0)