0

I'm trying to calculate the centroid of a star image:

enter image description here

I'm fitting a 2D gaussian with least squares in order to get the centroid of the star with sub-pixel accuracy. And, in fact, I get a float number for the coordinates X and Y of the centroid using http://photutils.readthedocs.io/en/stable/api/photutils.centroid_2dg.html?highlight=centroid_2dg

Now I want to test this algorithm with different position of the real centroid and compare them with the calculated centroid, but I don't know how to "move" the centroid within sub-pixel accuracy. I only know hot to move it in a pixel order.

Can anyone help me?

  • 1
    I think you might be confused. If you are trying to for example place the centroid "in the middle of 4 pixels", there is no way for that. You must think that a pixel can take only one value since it is the minimal representation of space in here. One solution would be to up sample the image but maintaining the Gaussian filter size, this is the closer I can get to your "interpolation " idea. – m33n May 09 '18 at 11:00
  • Ok, thank you! yes I'm confused because I don't know how the function I'm using really works. – Cristina PM May 09 '18 at 11:56
  • @m33n: no, you can achieve subpixel translation by interpolation. –  May 09 '18 at 12:38

1 Answers1

1

Though you can perform subpixel translation by interpolation (bilinear or bicubic), I would suggest a better approach.

Take a higher resolution image (IMO synthetic is good enough), smooth it to remove high frequencies (and lower the Nyquist frequency), and subsample. This will allow you to apply small displacements (by whole pixels at high resolution) and obtain the corresponding low-resolution images.

  • But if I subsample, wouldn't I lose important info about the center of the star? Sorry, I’m not quite sure what I’m supposed to do, could you exaplin it more? – Cristina PM May 09 '18 at 12:59