필터 지우기
필터 지우기

change Red level in RGB

조회 수: 1 (최근 30일)
jarvan
jarvan 2014년 10월 26일
댓글: jarvan 2014년 10월 27일
I got these code but it keeps saying that im have not enough input arguments. or,it said undefined function or variable while i put the picture name and format
function S=newRGB(fname, fformat, Rlevel, Glevel, Blevel) X=imread(fname, fformat); X=double(X); X=X/255; S=size(X); X(:,:,1)=X(:,:,1)* (Rlevel/100); X(:,:,2)=X(:,:,2)* (Glevel/100); X(:,:,3)=X(:,:,3)* (Blevel/100); figure; image(X); axis off end
  댓글 수: 2
Michael Haderlein
Michael Haderlein 2014년 10월 26일
Can you please format your question in a readable manner (there is a code button top of the text box you're writing your question in) and also tell us how you run this function (what you type into the command window)? Also, you write that you get two different error messages - when do you get which?
jarvan
jarvan 2014년 10월 26일
function S=newRGB(fname, fformat, Rlevel, Glevel, Blevel)
X=imread(fname, fformat);
X=double(X);
X=X/255;
S=size(X);
X(:,:,1)=X(:,:,1)* (Rlevel/100);
X(:,:,2)=X(:,:,2)* (Glevel/100);
X(:,:,3)=X(:,:,3)* (Blevel/100);
figure;
image(X);
axis off
end
for example i have flower.jpg
i hit newRGB(flower,jpg,50,100,100)
it said Undefined function or variable 'flower'.

댓글을 달려면 로그인하십시오.

채택된 답변

Geoff Hayes
Geoff Hayes 2014년 10월 26일
jarvan - you are passing flower and jpg into your function as if they are variables rather than strings. Since you have not defined a variable as flower then the error message makes sense. If you use the signature that you have defined for newRGB then execute the following in the Command Window instead
newRGB('flower','jpg',50,100,100);
Note how strings are now being passed into this function.
Or, you could just simplify your function and pass the file name and extension together. Change the first two lines of newRGB to
function S=newRGB(fname, Rlevel, Glevel, Blevel)
X=imread(fname);
In the above, we have removed the format (extension) string. Now you can just execute the following
newRGB('flower.jpg',50,100,100);
  댓글 수: 1
jarvan
jarvan 2014년 10월 27일
thank you for you response. it works for me now

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dynamic System Models에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by