How can I speed up a custom function that uses the Image Processing Toolbox "normxcorr2" function using GPU Coder in MATLAB R2024a?
Afficher commentaires plus anciens
I have a custom function that computes the correlation of two input images, and it makes use of the "normxcorr2" Image Processing Toolbox function. The function calls "normxcorr2" many times in a for-loop, and MATLAB Profiler indicates that it is the biggest user of computational resources in my custom function.
My custom function takes 70 seconds to run when my two input images are 5000x5000. If I use a "parfoor" loop, I am able to speed it up, but I would like to get it even faster.
How can I use GPU Coder to speed my custom function up?
Below is the pseudocode for my function:
% ... more code above ...
[m, n] = imageDimensions;
total = m * n;
res = zeros(1, total);
for partition_idx = 1:total
[subImage1, subImage2] = getSubImagesByPartition(image1, image2, partition_idx);
res(i) = normxcorr2(subImage1, subImage2) % part of function that is very slow
end
return res;
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Get Started with GPU Coder dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!