OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Sun, 09 Mar 2014 18:18:39 -0500find max with sub accuracyhttp://answers.opencv.org/question/5584/find-max-with-sub-accuracy/Hello
I want to find the position of the maximum value of a matrix. i can use the minMaxLoc function for that. But i wonder if there is way to find this position with sub accurracy by fitting a parabola(or something similar) to the values and get the max of this parabola?
i found this image which explains the situation
![](/upfiles/1356817091594464.png)
left image contains the discreet values and i want to find the position with the maximum value in the right image
cheersSat, 29 Dec 2012 15:43:46 -0600http://answers.opencv.org/question/5584/find-max-with-sub-accuracy/Answer by osman for <p>Hello</p>
<p>I want to find the position of the maximum value of a matrix. i can use the minMaxLoc function for that. But i wonder if there is way to find this position with sub accurracy by fitting a parabola(or something similar) to the values and get the max of this parabola?</p>
<p>i found this image which explains the situation
<img alt="" src="/upfiles/1356817091594464.png"></p>
<p>left image contains the discreet values and i want to find the position with the maximum value in the right image</p>
<p>cheers</p>
http://answers.opencv.org/question/5584/find-max-with-sub-accuracy/?answer=5648#post-id-5648Thanks a lot for your answer.
But i couldnt understand it completely. lets say we have 9x9 matrix like this one:
![image description](/upfiles/1356863875745067.png)
The max location is 5,5. The subpixel position would be 4.5,4.5 since it is symmetric.
if it was not completely symmetric, for example:
![image description](/upfiles/13568640237615465.png)
the maximum location shifts toward right and is something like 4.666(just guessing something a bit to the right) , 4.5
With **minMaxLoc** i can only get the positions as 5,5 in both cases. and even if i smooth these matrices and get then the max locations, they will be the same again 5,5. Is there a way to get these 4.5 and 4.666 values?
i am missing a point?
thanksWed, 02 Jan 2013 04:56:50 -0600http://answers.opencv.org/question/5584/find-max-with-sub-accuracy/?answer=5648#post-id-5648Answer by GrumbleLion for <p>Hello</p>
<p>I want to find the position of the maximum value of a matrix. i can use the minMaxLoc function for that. But i wonder if there is way to find this position with sub accurracy by fitting a parabola(or something similar) to the values and get the max of this parabola?</p>
<p>i found this image which explains the situation
<img alt="" src="/upfiles/1356817091594464.png"></p>
<p>left image contains the discreet values and i want to find the position with the maximum value in the right image</p>
<p>cheers</p>
http://answers.opencv.org/question/5584/find-max-with-sub-accuracy/?answer=29688#post-id-29688I hate to dig up this old question, however he might still have email notification turned on.
check out the new topic. http://answers.opencv.org/question/29665/getting-subpixel-with-matchtemplate/
I have a link to my source code.Sun, 09 Mar 2014 18:18:39 -0500http://answers.opencv.org/question/5584/find-max-with-sub-accuracy/?answer=29688#post-id-29688Answer by John vdK for <p>Hello</p>
<p>I want to find the position of the maximum value of a matrix. i can use the minMaxLoc function for that. But i wonder if there is way to find this position with sub accurracy by fitting a parabola(or something similar) to the values and get the max of this parabola?</p>
<p>i found this image which explains the situation
<img alt="" src="/upfiles/1356817091594464.png"></p>
<p>left image contains the discreet values and i want to find the position with the maximum value in the right image</p>
<p>cheers</p>
http://answers.opencv.org/question/5584/find-max-with-sub-accuracy/?answer=5662#post-id-5662If I understand you well, you are trying to fit some arbitrary basis function to your data and want to find a (possibly local) maximum of that function.
A blunt and computationally expensive way of doing that is to select an environment of the maximum you are interested in, compute the 2D fourier transform, possibly remove some high frequencies from that to your taste, and transform back at higher resolution (scale your transform appropriately). Then, you can find the maximum of the regridded smoothed function, which may or may not have anything to do with your original data.
There are many choices of basis functions possible. Use a priori knowledge of the sampled data as much as you can to choose your basis.
Wed, 02 Jan 2013 17:25:32 -0600http://answers.opencv.org/question/5584/find-max-with-sub-accuracy/?answer=5662#post-id-5662Answer by Mostafa Sataki for <p>Hello</p>
<p>I want to find the position of the maximum value of a matrix. i can use the minMaxLoc function for that. But i wonder if there is way to find this position with sub accurracy by fitting a parabola(or something similar) to the values and get the max of this parabola?</p>
<p>i found this image which explains the situation
<img alt="" src="/upfiles/1356817091594464.png"></p>
<p>left image contains the discreet values and i want to find the position with the maximum value in the right image</p>
<p>cheers</p>
http://answers.opencv.org/question/5584/find-max-with-sub-accuracy/?answer=5591#post-id-5591In the first,Smooth your matrix by gaussian then find maximum in new matrix.
**Note :**This technique is used to find the local maximum in accumulator Because of the discrete nature in Which maximum votes will win by the votes of its close neighbors.Sun, 30 Dec 2012 03:44:18 -0600http://answers.opencv.org/question/5584/find-max-with-sub-accuracy/?answer=5591#post-id-5591Comment by osman for <p>In the first,Smooth your matrix by gaussian then find maximum in new matrix.</p>
<p><strong>Note :</strong>This technique is used to find the local maximum in accumulator Because of the discrete nature in Which maximum votes will win by the votes of its close neighbors.</p>
http://answers.opencv.org/question/5584/find-max-with-sub-accuracy/?comment=5649#post-id-5649Thanks a lot for your answer.
But i couldnt understand it completely. lets say we have 9x9 matrix like this one:
![image description](/upfiles/1356863875745067.png)
The max location is 5,5. The subpixel position would be 4.5,4.5 since it is symmetric.
if it was not completely symmetric, for example:
![image description](/upfiles/13568640237615465.png)
the maximum location shifts toward right and is something like 4.666(just guessing something a bit to the right) , 4.5
With **minMaxLoc** i can only get the positions as 5,5 in both cases. and even if i smooth these matrices and get then the max locations, they will be the same again 5,5. Is there a way to get these 4.5 and 4.666 values?
i am missing a point?
thanksWed, 02 Jan 2013 04:57:38 -0600http://answers.opencv.org/question/5584/find-max-with-sub-accuracy/?comment=5649#post-id-5649