can someone help me with the explanation of this code
6 views (last 30 days)
Show older comments
clear all;
close all;
clc;
I=imread('normal1.jpg');
figure,imshow(I)
%%Crop
I2 = imcrop(I);
figure, imshow(I2)
w=size(I2,1);
h=size(I2,2);
disp(w);
disp(h);
%%LBP
scale = 2.^[7 6 5; 0 -inf 4; 1 2 3];
a = zeros(3,3)
for i=2:w-1
for j=2:h-1
J0=I2(i,j);
disp(J0);
I3(i-1,j-1)=I2(i-1,j-1)>J0; %%11
I3(i-1,j)=I2(i-1,j)>J0; %%12
I3(i-1,j+1)=I2(i-1,j+1)>J0; %%13
I3(i,j+1)=I2(i,j+1)>J0; %%23
I3(i+1,j+1)=I2(i+1,j+1)>J0; %%33
I3(i+1,j)=I2(i+1,j)>J0; %%32
I3(i+1,j-1)=I2(i+1,j-1)>J0; %%31
I3(i,j-1)=I2(i,j-1)>J0; %%21
a(1,1)=I3(i-1,j-1);
a(1,2)=I3(i-1,j);
a(1,3)= I3(i-1,j+1);
a(2,1)=I3(i,j-1);
a(2,2)=J0;
a(2,3)=I3(i,j+1);
a(3,1)=I3(i+1,j-1);
a(3,2)= I3(i+1,j);
a(3,3)=I3(i+1,j+1);
disp(a);
I2(i,j)=I3(i-1,j-1)*2^7+I3(i-1,j)*2^6+I3(i-1,j+1)*2^5+I3(i,j+1)*2^4+I3(i+1,j+1)*2^3+I3(i+1,j)*2^2+I3(i+1,j-1)*2^1+I3(i,j-1)*2^0;
disp(I2)
end
end
%%disp(I2)
figure,imshow(I2)
figure,imhist(I2(:))
figure,imhist(I2)
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!