Ask Your Question
0

find max with sub accuracy

asked 2012-12-29 15:43:46 -0600

osman gravatar image

updated 2012-12-30 02:14:51 -0600

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 flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
1

answered 2014-03-09 18:18:39 -0600

GrumbleLion gravatar image

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.

edit flag offensive delete link more
0

answered 2013-01-02 17:25:32 -0600

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.

edit flag offensive delete link more
0

answered 2012-12-30 03:44:18 -0600

updated 2012-12-30 12:51:33 -0600

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.

edit flag offensive delete link more

Comments

Thanks a lot for your answer.

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

image description

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

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

osman gravatar imageosman ( 2013-01-02 04:57:38 -0600 )edit

Question Tools

Stats

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

Seen: 3,172 times

Last updated: Mar 09 '14