【问题标题】:How to put an image into an array? [duplicate]如何将图像放入数组? [复制]
【发布时间】:2013-03-25 12:09:24
【问题描述】:

我有this matlab function,它应该在图像中标记连接的组件。 这里的问题是:我怎样才能给这个函数输入?

function [ component_num, c ] = i4mat_components ( m, n, a )  

如果您感到困惑,您可以轻松打开给定的链接并在那里阅读更多信息。

【问题讨论】:

    标签: matlab components labeling


    【解决方案1】:

    您只需要以下内容:

    a = imread('my_epicly_awesome_picture.jpg');
    

    编辑

    为了澄清,你可以这样调用你的函数:

    a = imread('tiger.jpg');
    %If your input image is RGB and you want grayscale:
    %a = rgb2gray(a);
    [m, n] = size(a);
    [component_num, c] = i4mat_components(m, n, a);
    

    【讨论】:

    • ???输入参数“m”未定义。 ==> i4mat_components 中的错误 4 c = zeros ( m, n );
    • 亲爱的朋友,我不知道你是否看过给定的链接,因为Islam Alkan删除了它(可能是不允许的)
    • 我试过这个:i4mat_components=(411,776,'norooz.jpg');没用
    • @RmanEdv:答案已编辑。
    【解决方案2】:

    虽然这很奇怪,但该函数似乎需要图像及其大小作为输入。

    所以假设你的图像被称为myimage,那么函数调用将是:

    [component_num,c] = i4mat_components (size(myimage,1), size(myimage,2),myimage ) 
    

    【讨论】:

      猜你喜欢
      • 2011-02-01
      • 2021-01-22
      • 1970-01-01
      • 1970-01-01
      • 2014-08-17
      • 1970-01-01
      • 2013-09-15
      • 2016-01-26
      • 2018-03-16
      相关资源
      最近更新 更多