Not enough input arguments for read an immage

2 Ansichten (letzte 30 Tage)
elena rondina
elena rondina am 23 Jan. 2016
Bearbeitet: jgg am 23 Jan. 2016
Hi, I'm new to MATLAB and am having some trouble. I want read an immage form a function. this is my code:
function [j]=readimmage(img_gray);
p=im2bw(img_gray);
imshow(p);
The error is:
Not enough input arguments.
Error in readimmage (line 2) p=im2bw(img_gray);
i know that i can use imread function but... how can I read an image file using a function unless imread ?

Akzeptierte Antwort

jgg
jgg am 23 Jan. 2016
Bearbeitet: jgg am 23 Jan. 2016
Check out the documentation. The function im2bw needs two arguments:
BW = im2bw(I, level)
Where level is a number between 0 and 1, and is the cutoff for a pixel being classified as white or black. So this should work:
function [j]=readimmage(img_gray)
p=im2bw(img_gray,0.5);
imshow(p);
end

Weitere Antworten (0)

Kategorien

Mehr zu Downloads finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by