How to concatenate only two planes of an image.

3 Ansichten (letzte 30 Tage)
Aditya
Aditya am 24 Mär. 2016
Kommentiert: Image Analyst am 14 Jan. 2023
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.

Antworten (2)

Image Analyst
Image Analyst am 24 Mär. 2016
Try this
blackImage = zeros(size(redChannel), 'uint8');
rgbImage = cat(3, redChannel, greenChannel, blackImage);
imshow(rgbImage);
  2 Kommentare
Aditya
Aditya am 24 Mär. 2016
Thank you for helping, I have tried this already but i want the new image to be only in 2 dimensions not 3.
Image Analyst
Image Analyst am 25 Mär. 2016
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.

Melden Sie sich an, um zu kommentieren.


Azzi Abdelmalek
Azzi Abdelmalek am 24 Mär. 2016
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 Kommentare
Vivek
Vivek am 14 Jan. 2023
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by