【问题标题】:how to concatenate two images of different dimension in matlab如何在matlab中连接两个不同维度的图像
【发布时间】:2015-11-23 22:05:04
【问题描述】:

我有两张相同场景但类型不同的图像: image1:Type RGB ([400 400 3]) 和 image2:type 红外 ([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.

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

【问题讨论】:

    标签: arrays image matlab


    【解决方案1】:

    将尺寸为[400 400 3] 和[400 400 1] 的两个图像连接到[400 400 4] 是第三维之间的连接。使用im3=cat(3,im1,im2);

    【讨论】:

    • 非常感谢它的作品,据我了解, cat (dim, A, B) dim 表示两个图像之间最大的维度。我很感激先生。
    • @PhDMa No. dim 表示您想要连接矩阵的维度。所以[A;B] 与cat(1,A,B) 相同,[A B] 与cat(2,A,B) 相同。
    • 谢谢@Parag S. Chandakkar。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-09
    • 2022-01-22
    • 2018-10-29
    • 1970-01-01
    • 2021-05-02
    • 1970-01-01
    相关资源
    最近更新 更多