필터 지우기
필터 지우기

how to pass a variable into imadjust?

조회 수: 3 (최근 30일)
Manoj Kumar
Manoj Kumar 2014년 12월 18일
답변: Geoff Hayes 2014년 12월 18일
Hi,
I wish to pass the contrast limits in the imadjust using a variable.
I tried in this way but it didn't work. I'll get a value for lower contrast limit using a input dialog box.
lowerContrast=str2num(answer{1});
lowContLimit=sprintf('%d',lowerContrast);
imgadj=imadjust(imgreen,[lowContLimit,1],[]);
but i am getting an error as
Function imadjust expected its second input argument, [LOW_IN; HIGH_IN] to be a two-element vector.
Can anyone help me.
  댓글 수: 2
Deepak M D
Deepak M D 2014년 12월 18일
편집: Deepak M D 2014년 12월 18일
lowerContrast=str2num(answer{1});
lowContLimit=sprintf('%d',lowerContrast);
imgadj=imadjust(imgreen,[val1 val2]);
such that 0<= val1 <=1 and 0<=val2 <=1
and val1 < val2
Manoj Kumar
Manoj Kumar 2014년 12월 18일
yes, the val1, val 2 lies between 0 and 1 and val1 is less than val2. Even then it is showing error?

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

채택된 답변

Geoff Hayes
Geoff Hayes 2014년 12월 18일
Manoj - why are you creating a string as
lowContLimit=sprintf('%d',lowerContrast);
and trying to pass that into the imadjust function? Try instead
imgadj=imadjust(imgreen,[lowerContrast 1],[]);
where you are passing in the lower contrast as a number (with 1 as the upper bound on the interval).

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by