Why does using normxcorr2 slow down my code seriously?

10 visualizaciones (últimos 30 días)
Fego Etese
Fego Etese el 6 de Abr. de 2020
Editada: Fego Etese el 9 de Abr. de 2020
I am working on template matching in fingeprints and after extracting minutiae points, I extract a template using a window size of 29 by 29 around a minutiae point for each minutiae, then i want to get the most unique of the template points in respect to the fingperint image. I am supposed to use cross correlation to match the each extracted template round the fingeprint image to find out the one that correlates the least as when compared to its correlation on its original location and from what i've read normxcorr2 seems to be the best for that, but when i implemented it, it takes so long to finish, if i actually let it finish it could take more than an hour because it takes over a minute for just one minutiae point and there are about 200 I have extracted. The approach i used is to extract a template of the same size around each pixel in the fingerprint image and cross correlate it with the minutiae template.
Please what can I do to solve this issue now? because it runs too slowly.
I can post the code if needed. Please help.
  11 comentarios
Adam Danz
Adam Danz el 7 de Abr. de 2020
Neither mat file contains the winsize variable.
Fego Etese
Fego Etese el 8 de Abr. de 2020
I apologize, forgot to add that winsize is 29

Iniciar sesión para comentar.

Respuesta aceptada

Adam Danz
Adam Danz el 8 de Abr. de 2020
Editada: Adam Danz el 8 de Abr. de 2020
The normxcorr2 function is the bottleneck of processing speed in your code consuming 49% of the total processing time however, you can make some improvements to make the process more efficient.
Using variable names from this line of code,
corrmat = normxcorr2(primtemplate, querytemplate);
it's often the case that querytemplate is a matrix of 0s and there's no purpose in sending a matrix of 0s through normxcorr2. You can reduce the number of calls to normxcorr2 by adding this condition after computing quertytemplate. It will skip to the next col loop before executing normxcorr2.
if all(querytemplate==0, 'all')
continue
end
I haven't deconstructed your code but at a glance, it looks like you may be repeating computations when a new primtemplate is chosen. Once two windows have been correlated, there's no reason to execute that computation again.
Lastly, the normxcorr2 function supports GPU arrays which can greatly speed up processing.
  7 comentarios
Fego Etese
Fego Etese el 9 de Abr. de 2020
I will go with the surf algorithm. Thanks for your help. I really appreciate it.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by