Reputation: 107
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
Upvotes: 2
Views: 254
Reputation: 36710
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);
Upvotes: 4