Why does using normxcorr2 slow down my code seriously?
Show older comments
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 Comments
Fego Etese
on 6 Apr 2020
Fego Etese
on 6 Apr 2020
Adam Danz
on 6 Apr 2020
If that's the case, I'm not sure there are many options. If you're certain that normxcorr2 is the bottleneck and that the rest of your code is running optimally in terms of coding efficiency and memory management, there may not be a way to speed that up. If you have concerns that other parts of your code may be suboptimal, you could attach the minimally required section of code and an example file to read in and I could take a look at it at some point.
The good news is that 1-2 hours is manageable for something that only needs to be done once. If it's something you'd run frequently, I can see how that time is a problem. I'd suggest saving outputs as they are produced so if you have an error, you can determine where to start the analysis again. I also recommend using dbstop if error so if you have an error, you can poke around to see what caused the error without waiting for the error to happen again.
Adam Danz
on 6 Apr 2020
Perhaps someone with a background in this type of analysis could suggest a different approach to try.
Fego Etese
on 7 Apr 2020
Fego Etese
on 7 Apr 2020
Adam Danz
on 7 Apr 2020
Why are you using Live Code file format instead of an m-file? Live Code is great for instructions and presentations but I wouldn't use to for lengthy data anlysis. The first thing I'd do is move the code to m-file and see if that makes a big difference.
Anyways, I can't run your code without having the inputs. You could attach a mat file or any files needed so I can run your functions.
Fego Etese
on 7 Apr 2020
Adam Danz
on 7 Apr 2020
Neither mat file contains the winsize variable.
Fego Etese
on 8 Apr 2020
Accepted Answer
More Answers (0)
Categories
Find more on Template Matching in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
