Problem with the following.
Afficher commentaires plus anciens
This is my MATLAB code for the following:
F(m, n) = w0I0 + w1I1 + w2I2
where
I0 = I2^α0 (m, n)
I1 = I2^α1 (m − 1, n) + I2^α1 (m + 1, n) + I2^α1 (m, n − 1) + I2^α1 (m, n + 1)
I2 = I2^α2 (m − 1, n − 1) + I2^α2 (m + 1, n − 1) + I2^α2 (m + 1, n − 1) + I2^α2 (m + 1, n + 1)
The value of alpha0,alpha1,alpha2,w0,w1,w2 are declared in code. But it shows some error. I dono why?
code:
[file path] = uigetfile ('*.bmp','Select any Image');
if file ~=0
I = imread (strcat(path,file));
[m n] = size (I);
h=1;
alpha0 = 8*h;
alpha1 = h;
alpha2 = h;
w0 = 2;
w1 = -0.125;
w2 = -0.125;
% Compute I0
for j = 1 : n
for i = 1 : m
I0(i,j) = I(i,j)^(2*alpha0);
end
end
% Compute I1
for j = 1 : n
for i = 1 : m
I1(i,j) = I(i-1,j)^(2*alpha1) + I(i+1,j)^(2*alpha1) + I(i,j-1)^(2*alpha1) + I(i,j+1)^(2*alpha1);
end
end
% Compute I2
for j = 1 : n
for i = 1 : m
I2(i,j) = I(i-1,j-1)^(2*alpha2) + I(i+1,j-1)^(2*alpha2) + I(i+1,j-1)^(2*alpha2) + I(i+1,j+1)^(2*alpha2);
end
end
F(m,n) = (w0*I0(m,n)) + (w1*I1(m,n)) + (w2*I2(m,n));
figure, imshow(F);
end
2 commentaires
Oleg Komarov
le 3 Sep 2012
What error do you get?
Sabarinathan Vadivelu
le 5 Sep 2012
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Variables dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!