I used the cv2 for template matching with the following code:
result = cv2.matchTemplate(img_gray,template,cv2.TM_CCOEFF_NORMED)
Then, I used a code for fitting 2D Gaussian on the result of template matching my data is the result of template matching contain the value show quality of matching with the coordinate of (x,y)
.
After fitting 2D_Gaussian
as we can see in the following plot the best result is the dark blue circle. I want to extract this area as a form of the covariance matrix. I get the best match with this code:
_minVal, _maxVal, minLoc, maxLoc = cv2.minMaxLoc(result, None).
As you can see in the following image is (27, 40)
with a value of 0.82
which shows the quality of the match. How can I estimate the covariance matrix when I have the best point of the match with the surrounding area as we can see?