Advertisement
Guest User

Untitled

a guest
May 1st, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. [R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13,R14,R15,R16]=Image_Regionation(I2);
  2.  
  3. I2 = imresize(I2, [66 66]);
  4.  
  5. R1=I2(1:25,1:25);
  6. R2=I2(16:40,1:25);
  7. R3=I2(33:57,1:25);
  8. R4=I2(42:66,1:25);
  9. R5=I2(1:25,16:40);
  10. R6=I2(16:40,16:40);
  11. R7=I2(33:57,16:40);
  12. R8=I2(42:66,16:40);
  13. R9=I2(1:25,33:57);
  14. R10=I2(16:40,33:57);
  15. R11=I2(33:57,33:57);
  16. R12=I2(42:66,33:57);
  17. R13=I2(1:25,42:66);
  18. R14=I2(16:40,42:66);
  19. R15=I2(33:57,42:66);
  20. R16=I2(42:66,42:66);
  21.  
  22. for x = 1:5
  23. % Specify images names with full path and extension
  24. full_name= fullfile('UsersUserDocumentsMATLABNew folderg', filenames(x).name);
  25.  
  26. % Read images from Training folder
  27. I2 = imread(full_name);
  28. I3=I2;
  29. m=size(I2,1);
  30. n=size(I2,2);
  31. for i=2:m-1
  32. for j=2:n-1
  33. c=I2(i,j);
  34. I3(i-1,j-1)=I2(i-1,j-1)>c;
  35. I3(i-1,j)=I2(i-1,j)>c;
  36. I3(i-1,j+1)=I2(i-1,j+1)>c;
  37. I3(i,j+1)=I2(i,j+1)>c;
  38. I3(i+1,j+1)=I2(i+1,j+1)>c;
  39. I3(i+1,j)=I2(i+1,j)>c;
  40. I3(i+1,j-1)=I2(i+1,j-1)>c;
  41. I3(i,j-1)=I2(i,j-1)>c;
  42. LBP (i,j) =I3(i-1,j-1)*2^7+I3(i-1,j)*2^6+I3(i-1,j+1)*2^5+ ...
  43. I3(i,j+1)*2^4+I3(i+1,j+1)*2^3+I3(i+1,j)*2^2+ ...
  44. I3(i+1,j-1)*2^1+I3(i,j-1)*2^0;
  45. end
  46. end
  47.  
  48.  
  49. % to show the histogram and LBP
  50. subplot(2,2,3);
  51. imshow(LBP, []);
  52. subplot(2,2,4);
  53. [pixelCounts, GLs] = imhist(uint8(LBP),59);
  54. bar(GLs, pixelCounts);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement