How to concatenate only two planes of an image.
1 回表示 (過去 30 日間)
古いコメントを表示
I have split an RGB image into its 3 different components, now i need a new image that is just the combination of the red and green planes. How do I do this? I used the 'cat' function, and then displayed the image, but it just displays these images next to each other.
0 件のコメント
回答 (2 件)
Image Analyst
2016 年 3 月 24 日
Try this
blackImage = zeros(size(redChannel), 'uint8');
rgbImage = cat(3, redChannel, greenChannel, blackImage);
imshow(rgbImage);
2 件のコメント
Image Analyst
2016 年 3 月 25 日
Then to get a 2D image, stitch them together either side by side or top and bottom
tallImage = [redChannel; greenChannel];
wideImage = [redChannel, greenChannel];
Of course the images will be gray scale not color since to be color you need a third dimension.
Azzi Abdelmalek
2016 年 3 月 24 日
img = imread('ngc6543a.jpg');
red = img(:,:,1); % Red
green = img(:,:,2); % Green
blue = img(:,:,3); % Blue
[n,m,~]=size(img)
a = zeros(n, m);
out=cat(3,red,green,a)
3 件のコメント
Vivek
2023 年 1 月 14 日
Same problem Aditya I have two images and I want to make a single image from these two but using these commands the output image is in 3d dimension but I want to in 2D dimension.
Image Analyst
2023 年 1 月 14 日
@Vivek I think you overlooked my answer above.
It will do that.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!