Make code for svm region descriptors more efficient
Mostrar comentarios más antiguos
I'm having a rather large image (32000 x 32000) where I have detected regions of interest ("blobs" of approx. size of 150 cells). In the end I would like to have a Mean/Standard deviation descriptor for each region/blob to feed into a svm.
I've written the following function, which worked fine for smaller image subsets (6000x10000), to test the code. But when applying it on the whole image (32000x32000) it already takes ages to calculate the descriptor for 400 regions (and I will have to calculate it for over a million regions in the end).
dimDescriptor = size(Image,3)*2;
MeStdDescriptor = zeros(size(points,1),dimDescriptor);
for i = 1:size(points,1)
for band = 1:size(Image,3)
banddata = Image(:,:,band);
MeStdDescriptor(i,band) = mean(banddata(regionMask==i));
MeStdDescriptor(i,band+4) = std(banddata(regionMask==i));
end
end
"Points" is a vector with all the unique numbers of my regions/blobs (here 1:400). "regionMask" is a mask (same size as image), which I have created in advance, where every region/blob has a unique number and the rest is zero.
Does anybody have a suggestion of how to improve this code to make it faster? Thank you very much!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Deep Learning Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!