Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13,R14,R15,R16]=Image_Regionation(I2);
- I2 = imresize(I2, [66 66]);
- R1=I2(1:25,1:25);
- R2=I2(16:40,1:25);
- R3=I2(33:57,1:25);
- R4=I2(42:66,1:25);
- R5=I2(1:25,16:40);
- R6=I2(16:40,16:40);
- R7=I2(33:57,16:40);
- R8=I2(42:66,16:40);
- R9=I2(1:25,33:57);
- R10=I2(16:40,33:57);
- R11=I2(33:57,33:57);
- R12=I2(42:66,33:57);
- R13=I2(1:25,42:66);
- R14=I2(16:40,42:66);
- R15=I2(33:57,42:66);
- R16=I2(42:66,42:66);
- for x = 1:5
- % Specify images names with full path and extension
- full_name= fullfile('UsersUserDocumentsMATLABNew folderg', filenames(x).name);
- % Read images from Training folder
- I2 = imread(full_name);
- I3=I2;
- m=size(I2,1);
- n=size(I2,2);
- for i=2:m-1
- for j=2:n-1
- c=I2(i,j);
- I3(i-1,j-1)=I2(i-1,j-1)>c;
- I3(i-1,j)=I2(i-1,j)>c;
- I3(i-1,j+1)=I2(i-1,j+1)>c;
- I3(i,j+1)=I2(i,j+1)>c;
- I3(i+1,j+1)=I2(i+1,j+1)>c;
- I3(i+1,j)=I2(i+1,j)>c;
- I3(i+1,j-1)=I2(i+1,j-1)>c;
- I3(i,j-1)=I2(i,j-1)>c;
- LBP (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;
- end
- end
- % to show the histogram and LBP
- subplot(2,2,3);
- imshow(LBP, []);
- subplot(2,2,4);
- [pixelCounts, GLs] = imhist(uint8(LBP),59);
- bar(GLs, pixelCounts);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement