Context.Direct imaging has made significant progress over the past decade, in part thanks to a new generation of instruments and excellent adaptive optic systems, but also thanks to advanced post-processing techniques. The combination of these two factors allowed the detection of several giant planets with separations as close as 0.2 arcsec with contrasts typically reaching 9–10 magnitudes at nearinfrared wavelengths. Observing strategies and data rates vary depending on the instrument and the wavelength, withL-andM-band observations yielding tens of thousands of images to be combined.Aims.We present a new approach, tailored for VLT/NaCo observations performed with the Annular Groove Phase Mask (AGPM) coronagraph, but that can be applied to other instruments using similar coronagraphs. Our pipeline aims to improve the post-processing of the observations on two fronts: identifying the location of the star behind the AGPM to better align the science frames and performing frame selection.Methods.Our method relies on finding the position of the AGPM in the sky frame observations, and correlating it with the circular aperture of the coronagraphic mask. This relationship allows us to retrieve the location of the AGPM in the science frames. We are then able to model the torus shape visible in the sky-subtracted science frames, as a combination of negative and positive 2D Gaussian functions. The model provides additional information that is useful to design our frame selection criteria.Results.We tested our pipeline on three targets (βPictoris, R CrA, and HD 34282), two of which have companions at intermediate and close separations, and the third hosts a bright circumstellar disk. We find that the centering of the science frames has a significant impact on the signal-to-noise ratio (S/N) of the companions. Our results suggest that the best reduction is achieved when performing the principal component analysis centered on the location of the AGPM and derotating the frames centered at the location of the star before collapsing the final datacube. We improved the S/N of companions aroundβPictoris and R CrA by 24 ± 3% and 117 ± 11% respectively, compared to other state-of-the-art reductions. We find that the companion position for all the centering strategies are consistent within 3σ. Finally, we find that even for NaCo observations with tens of thousands of frames, frame selection yields just marginal improvement for point sources, but may improve the final images for objects with extended emission such as disks.Conclusions.We propose a novel approach to identify the location of the star behind a coronagraph even when it cannot easily be determined by other methods. We led a thorough study on the importance of frame selection, concluding that the improvements are marginal in most cases, but may yield better contrast in some specific cases. Our approach can be applied to the wealth of archival NaCo data and, assuming that the field of view includes the edges of the coronagraphic mask, its implementation can be adapted to other instruments with coronagraphs similar to the AGPM used on NaCo (e.g., Keck/NIRC2, LBT/LMIRCam).