Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Need help translating MATLAB to C

1 visualización (últimos 30 días)
dee koshy
dee koshy el 1 de Mzo. de 2012
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentario
Walter Roberson
Walter Roberson el 1 de Mzo. de 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.

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by