Why does using normxcorr2 slow down my code seriously?

조회 수: 10 (최근 30일)
Fego Etese
Fego Etese 2020년 4월 6일
편집: Fego Etese 2020년 4월 9일
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
Adam Danz
Adam Danz 2020년 4월 7일
Neither mat file contains the winsize variable.
Fego Etese
Fego Etese 2020년 4월 8일
I apologize, forgot to add that winsize is 29

댓글을 달려면 로그인하십시오.

채택된 답변

Adam Danz
Adam Danz 2020년 4월 8일
편집: Adam Danz 2020년 4월 8일
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
Fego Etese
Fego Etese 2020년 4월 9일
I will go with the surf algorithm. Thanks for your help. I really appreciate it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by