I have this matlab function which is supposed to label connected components in an image. Here is the question: How can I give input to this function?

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

If you are confused, you can easily open the given link and read more information there.

有帮助吗?

解决方案

You simply need something along the lines of:

a = imread('my_epicly_awesome_picture.jpg');

EDIT

To clarify, you can call your function like so:

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);

其他提示

Though this would be quite strange, it appears that the function requires both the image and its size as inputs.

So suppose your image is called myimage, then the functioncall would be:

[component_num,c] = i4mat_components (size(myimage,1), size(myimage,2),myimage ) 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top