Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Problem converting formula of Welford algorthm

1 vue (au cours des 30 derniers jours)
Syakira Akmal
Syakira Akmal le 26 Avr 2017
Clôturé : MATLAB Answer Bot le 20 Août 2021
Hai, please someone help me because using code below, for different image, i still get the same value for alpha, theta and image normalization.
a = imread('3.JPG');
imshow(a);
b = roipoly(a);
%to set point
[X,Y] = size(b);
%to calculate mean image
m = mean2(b);
%to calculate standard deviation
sd = std2(b);
% initialise
sMinusMean=0;
% mean-variance moving window operation
for i=1:X
for j=1:Y
iMean = [X,Y]-m;
sMinusMean=sMinusMean+iMean;
end
end
%image normalised
iNeu=sMinusMean/sd;
[X,Y]= size(iNeu);
% gradient orientation
g1= [X,Y+1]-[X,Y-1];
g2= [X+1,Y]-[X-1,Y];
theta=atan2(g1,g2);
% magnitude
a1= [X*X,(Y+1)*X]-[X*X,(Y-1)*X];
a2= [(X+1)*Y,Y*Y]-[(X-1),Y*Y];
a3= a1+a2;
alpha=sqrt(a3);

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by