Advertisement
Guest User

Untitled

a guest
Feb 14th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.12 KB | None | 0 0
  1. I = imread('D:\lastsem\assignment1.jpg');
  2. figure;
  3. imshow(I);
  4.  
  5. [row,col,color] = size(I);
  6. K = uint8(ones(row,col,color));
  7.  
  8. a = 1;
  9. b = 1;
  10. c = 1;
  11.  
  12. for i = 1:row
  13.     for j = col:-1:1
  14.         K(i,a,1)=I(i,j,1);
  15.         a = a+1;
  16.     end
  17.     a=1;
  18. end
  19.  
  20. for i = 1:row
  21.     for j = col:-1:1
  22.         K(i,b,2)=I(i,j,2);
  23.         b = b+1;
  24.     end
  25.     b=1;
  26. end
  27.  
  28. for i = 1:row
  29.     for j = col:-1:1
  30.         K(i,c,3)=I(i,j,3);
  31.         c = c+1;
  32.     end
  33.     c=1;
  34. end
  35.  
  36. figure;
  37. imshow(K);
  38.  
  39. L = uint8(ones(row,2*col,color));
  40.  
  41. for i= 1:row
  42.     for j= 1:col
  43.         L(i,j,1) = I(i,j,1);
  44.     end
  45. end
  46. a=1;
  47. for i= 1:row
  48.     for j= col+1:2*col
  49.         L(i,j,1) = K(i,a,1);
  50.         a=a+1;
  51.     end
  52.     a=1;
  53. end
  54.  
  55. for i= 1:row
  56.     for j= 1:col
  57.         L(i,j,2) = I(i,j,2);
  58.     end
  59. end
  60. a=1;
  61. for i= 1:row
  62.     for j= col+1:2*col
  63.         L(i,j,2) = K(i,a,2);
  64.         a=a+1;
  65.     end
  66.     a=1;
  67. end
  68.  
  69. for i= 1:row
  70.     for j= 1:col
  71.         L(i,j,3) = I(i,j,3);
  72.     end
  73. end
  74. a=1;
  75. for i= 1:row
  76.     for j= col+1:2*col
  77.         L(i,j,3) = K(i,a,3);
  78.         a=a+1;
  79.     end
  80.     a=1;
  81. end
  82.  
  83. figure;
  84. imshow(L);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement