2
votes

I have two images of the same scene but of a different type: image1:Type RGB ([400 400 3]) and image2:type infrared ([400 400 1]).I am seeking an image by concatenating the image1 and image2 to get an image3 ([400 400 4]).

im1=imread('rgbimage.jpg');
im2=imread('infraredimage.jpg');
im3=cat(4,im1,im2);

I try with function cat in matlab but I get this error:

Error using cat
Dimensions of matrices being concatenated are not consistent.

if someone can help me , thank you

1

1 Answers

4
votes

Concatenating two images with dimensions [400 400 3] and [400 400 1] to [400 400 4] is a concatenation among the third dimension. Use im3=cat(3,im1,im2);