Advertisement
riyanris

Untitled

Sep 18th, 2020
1,483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.48 KB | None | 0 0
  1. %Read the image
  2. img = imread('image.jpg');
  3. %Get the size (rows and columns) of the image
  4. [r,c] = size(img);
  5. rr=r/3;
  6. %Wrire code to split the image into three equal parts and store them in B, G, R channels
  7. B=imcrop(img,[1,1,c,rr-1]);
  8. size(B)
  9. G=imcrop(img,[1,rr+1,c,rr-1]);
  10. size(G)
  11. R=imcrop(img,[1,2*rr+1,c,rr-1]);
  12. size(R)
  13. %concatenate R,G,B channels and assign the RGB image to ColorImg variable
  14. ColorImg(:,:,1) = R;
  15. ColorImg(:,:,2) = G;
  16. ColorImg(:,:,3) = B;
  17. imshow(ColorImg)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement