# 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

left image contains the discreet values and i want to find the position with the maximum value in the right image

cheers

edit retag close merge delete

Sort by ยป oldest newest most voted

I 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.

more

If 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.

more

In 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.

more

But i couldnt understand it completely. lets say we have 9x9 matrix like this one:

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:

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?

thanks

( 2013-01-02 04:57:38 -0500 )edit

Official site

GitHub

Wiki

Documentation

## Stats

Asked: 2012-12-29 15:43:46 -0500

Seen: 2,086 times

Last updated: Mar 09 '14