Need help with creating or modifying an RGB image.
Show older comments

% read in a jpg image
%
z=imread('Paraglider.jpg');
size(z)
%
% separate out the red, blue, and green components
%
r=z(:,:,1); % r=z(rows, columns, first page)
b=z(:,:,2);
g=z(:,:,3);
%
% look at the components
%
figure(6),clf
subplot(2,2,1),imshow(z),title('composite')
subplot(2,2,2),imshow(r),title('red')
%
% recombine components
%
figure(7),clf
subplot(2,2,1),imshow(cat(3,r,b,g)),title('r,b,g')
%
% write an image to a jpg file
%
outimage=cat(3,g,r,b);
imwrite(outimage,'ParaGRB.jpg')
1 Comment
KALYAN ACHARJYA
on 27 Apr 2019
Issue?
Accepted Answer
More Answers (0)
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!