Hi, I get error when I call the function for another function, the error like this 'Not enough input arguments'.

1 view (last 30 days)
I have 2 function in my program
1. green_channel.m %%in bellow the code
function green = green_channel(im)
imGreen = im(:,:,2);
medGreen = medfilt2(imGreen, [3 3]);
medGreensize = imresize(medGreen,[583 947]);
green=imcomplement(medGreensize);
end
2.saturation_channel.m
function imgsat = saturation_channel(im)
imhsv=rgb2hsv(im);
imsaturation=imhsv(:,:,2);
medsat=medfilt2(imsaturation,[3 3]);
imre = imresize(medsat,[583 947]);
imgsat = uint8(imre); end
3. And the last name is hasil_kali.m
function imgkali = hasil_kali(green, imgsat)
imgkali = green.*imgsat;
end
I make that code in file hasil_kali.m to calling function from green_channel.m and saturation_channe.m, but I get error 'not enough input arguments'. Do I wrong call the function or how? please help me, I new learning, may more explain can help me. thanks

Answers (1)

Image Analyst
Image Analyst on 21 Sep 2018
I assume hasil_kali() is the main function. And it needs to have green and imgsat already defined. How did you define green and imgsat prior to calling hasil_kali()? And how did you call hasil_kali()? You didn't just push the green run triangle, did you? Because that won't work. You need to call it from the command line or a script or another function because you must pass two input arguments (green and imgsat) to it.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!