Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Problem converting formula of Welford algorthm

1 view (last 30 days)
Syakira Akmal
Syakira Akmal on 26 Apr 2017
Closed: MATLAB Answer Bot on 20 Aug 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);

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!