Ask Your Question
1

Sub-pixel estimation with match template

asked 2017-08-29 03:43:31 -0600

Arun1994 gravatar image

updated 2017-08-29 04:08:54 -0600

berak gravatar image

Hello guys,

I am trying to make particle image velocimetry using OpenCV and I have a few questions. Does Matchtemplate module take care of subpixel estimation? I have two images filled with particles and the second image is with particles translated by a small distance dx. I cannot always say that this movement is exactly in an integer value of pixels. so the particle maybe split in two pixels.

When I use Match template to find the center of the rectangle, is it considering the sub-pixels too? It is very important in my case for accuracy.

Arun

edit retag flag offensive close merge delete

Comments

exclamation marks & "urgent" tags will only get you downvotes...

berak gravatar imageberak ( 2017-08-29 04:09:35 -0600 )edit

Hello Guys , I need to find the first three peaks of the correlation. Can you please say if I can find all the coorelation values in the the variable res if,

res = cv2.matchTemplate(imA,imB,'cv2.TM_CCORR_NORMED')

how can I search for the top three peak correlations for the two images?

Arun1994 gravatar imageArun1994 ( 2017-08-31 05:13:04 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2017-08-29 12:09:22 -0600

matman gravatar image

You can use matchTemplate. Then search for the best fitting point in the result image. At least create a (e.g. 5x5) window around this pixel and calculate the centroid of this window. This should give you some subpixel accuracy.

edit flag offensive delete link more

Comments

LBerger gravatar imageLBerger ( 2017-08-29 12:36:48 -0600 )edit
1

This is also an interesting project.

matman gravatar imagematman ( 2017-08-29 12:40:01 -0600 )edit

Thanks for the reply . I am not sure if the centroid method is the best idea. I am trying to use it to get velocity components and if they are not accurate, the further calculations would be a big mess. All that I need is the top three peaks and use a gaussian fit to interpolate the center .

Arun1994 gravatar imageArun1994 ( 2017-08-31 05:16:54 -0600 )edit
0

answered 2017-08-29 04:14:44 -0600

berak gravatar image

no, template matching does not care about sub-pixels. (it also finds the top-left corner of the Rect, not the center)

for sub-pixel accuracy, maybe have a look at optical flow

edit flag offensive delete link more

Comments

Thank you , and yes I will take a look at it :)

Arun1994 gravatar imageArun1994 ( 2017-08-31 09:19:59 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-08-29 03:43:31 -0600

Seen: 3,371 times

Last updated: Aug 29 '17