combining RGB to get a full image
Show older comments
image_RGB = cat(2,final_red,final_green,final_blue)
imshow(image_RGB);
can anyone suggest me that this code is correct for combining RGB components for getting full image
as soon as possible
Accepted Answer
More Answers (2)
Wayne King
on 23 Oct 2011
Hi, You don't want to concatenate along the column dimension. An RGB image has 3 dimensions. You want to concatenate along the 3rd dimension.
imdata = imread('ngc6543a.jpg');
RC = imdata(:,:,1);
GC = imdata(:,:,2);
BC = imdata(:,:,3);
im = cat(3,RC,GC,BC);
isequal(imdata,im)
imshow(im)
5 Comments
prem preet
on 23 Oct 2011
prem preet
on 23 Oct 2011
Wayne King
on 23 Oct 2011
please post the exact error message
prem preet
on 23 Oct 2011
prem preet
on 23 Oct 2011
tablo tofiq
on 6 May 2016
Edited: Stephen23
on 6 May 2016
display image in three color red&green&blue
a=imread('autumn.tif');
a1=a;
a1(:,:,2)=0;
a1(:,:,3)=0;
subplot(3,1,1)
imshow(a1)
a2=a;
a2(:,:,1)=0;
a2(:,:,3)=0;
subplot(3,1,2)
imshow(a2)
a3=a;
a3(:,:,1)=0;
a3(:,:,2)=0;
subplot(3,1,3)
imshow(a3)
1 Comment
Stephen23
on 6 May 2016
Without three intermediate variables:
b = imread('autumn.tif');
b(:,:,4) = 0;
subplot(3,1,1)
imshow(b(:,:,[1,4,4]))
subplot(3,1,2)
imshow(b(:,:,[4,2,4]))
subplot(3,1,3)
imshow(b(:,:,[4,4,3]))
Categories
Find more on Blue in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!