Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Need help translating MATLAB to C
조회 수: 1 (최근 30일)
이전 댓글 표시
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
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!