Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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 ) 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top