Trying to vectorize a column-wise image processing step
Mostra commenti meno recenti
I have a single-precision dataset specdata of size nPix x nObs. Each column 1..nObs is a (diffcols x diffrows) image stored unfolded. (nPix=diffrows*diffcols)
I can batch process them easily like this:
blurredData = zeros( size( specdata ), 'single');
for a=1:nObs
blurredData(:,a) = reshape(imgaussfilt( reshape(specdata(:,a),...
diffcols,diffrows), 0.75 ), nPix,1);
end
But, I would like to cleverly vectorize this loop if possible. This:
f = @( D, diffrows, diffcols, nPix ) reshape(imgaussfilt( reshape(D,diffcols,diffrows), 0.75 ), nPix,1);
ii = 1:nObs;
S(:, ii ) = f(specdata(:,ii),diffrows,diffcols,nPix);
blows up ("To RESHAPE the number of elements must not change."), apparently because I'm passing all of specdata to the reshape.
Any thoughts? Is there some obvious vectorization I am missing?
Thanks.
Risposta accettata
Più risposte (1)
Chad
il 29 Set 2017
0 voti
Categorie
Scopri di più su Image Filtering in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!