Very Fast Radial Profile
Version 1.0.1 (1,26 KB) von
Sergey Loginov
Radial profile of an image without a "for loop". At size 2048x1792 it works 50 times faster than prevalent "for loop" variants
Over the years there were several questions posted here at MathWorks about how to compute a radial profile (like average spectral density). The same answer was repeated every time: go in a for loop over all radii and average the data which lays in a circle. When dealing with an image of just 1024x1024 it starts to be faster to deconvolve an image than to compute a radial profile!
MatLab has a very fast own function accumarray which can do the trick with zero for loops. I have written a basic radial profiler which calls accumarray twice: first time to create radial ticks, and second time to create the average profile. In my application with 2048x1792 data I have ahieved 50x accelearation compared with the "for loop" approach.
If you need to speed-up this function even more, consider using bwdist instead of meshgrid.
This function can be further improved further in terms of accuracy of averaging by taking into account subpixel subtelties.
Zitieren als
Sergey Loginov (2024). Very Fast Radial Profile (https://www.mathworks.com/matlabcentral/fileexchange/101480-very-fast-radial-profile), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Erstellt mit
R2021b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.0.1 | typos in the summary |
||
1.0.0 |