Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Need help translating MATLAB to C
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
function [normim, mask, maskind] = attemptridgesegment(im, blksze, thresh)
im = normalize(im,0,1);
fun = @(block_struct)std2(block_struct.data) * ones(size(block_struct.data));
stddevim = blockproc(im, [blksze blksze], fun);
mask = stddevim > thresh;
maskind = find(mask);
im = im - mean(im(maskind));
normim = im/std(im(maskind));
function[n] = normalize(f, reqmean, reqvar)
if (nargin == 1)
if ndims(f)==2
if ~isa(f,'double')
f = double(f); end
n = f - min(f(:));
n = n/max(n(:));
end
end
if (nargin ==3)
f = double(f);
f = f - mean(f(:));
f = f/std(f(:));
n = reqmean + f*sqrt(reqvar);
end
1 Kommentar
Walter Roberson
am 1 Mär. 2012
I don't see any good reason for the multiplication by ones() -- that just replicates the data, which isn't going to change the mean since everything is going to be replicated the same number of times. I suppose it would make a difference to the standard deviation, but my instinct is that you are worsening your std with the replication.
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!