Info

此问题已关闭。 请重新打开它进行编辑或回答。

Need help translating MATLAB to C

1 次查看(过去 30 天)
dee koshy
dee koshy 2012-3-1
关闭: MATLAB Answer Bot 2021-8-20
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 个评论
Walter Roberson
Walter Roberson 2012-3-1
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.

回答(0 个)

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by