首页 文章

如何在matlab中连接两个不同维度的图像

提问于
浏览
2

我有两个相同场景但不同类型的图像:image1:类型RGB([400 400 3])和image2:类型红外线([400 400 1]) . 我通过连接image1和image2来寻找图像得到一个image3([400 400 4]) .

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

我在matlab中尝试使用函数cat,但是我收到了这个错误:

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

如果有人可以帮助我,谢谢你

1 回答

  • 4

    将维度 [400 400 3][400 400 1] 连接到 [400 400 4] 的两个图像连接在第三维之间 . 使用 im3=cat(3,im1,im2);

相关问题