필터 지우기
필터 지우기

I want to change the gray scale from [0 1] to [0 500]

조회 수: 6 (최근 30일)
Anvinder  Singh
Anvinder Singh 2016년 3월 12일
댓글: Image Analyst 2016년 3월 13일
I want to change the gray scale from [0 1] to [0 500] and have used the following functions
b= imadjust(a,[0; 1],[0; 500])
and
%j = imadjust(a,stretchlim(a),[0 500]);
but they don't seem to work. There are errors when i plot them.
CODE:
a = ones(256, 256, 3);
a(10:110,40:100,:)=0;
a(120:200,120:200,:)=0;
%colormap('gray');
image(a)
figure();
b= imadjust(a,[0; 1],[0; 500])
%j = imadjust(a,stretchlim(a),[0 500]);
image(b)

답변 (2개)

Walter Roberson
Walter Roberson 2016년 3월 12일
"By default, the CDataMapping property for the image is set to 'direct' so image interprets values in C as indices into the colormap. For example, the bottom right pixel corresponding to the last element in C, 22, uses the 22nd color of the colormap."
Do you have 500 colors or more in your colormap?
  댓글 수: 4
Anvinder  Singh
Anvinder Singh 2016년 3월 12일
Walter, the imagesc doesnt work. The error i get is "Error in imadjust (line 99) validateLowHigh(lowIn,highIn,lowOut,highOut);"
Walter Roberson
Walter Roberson 2016년 3월 12일
Then that was not errors when you plot them, that was errors when you did the adjustment. And you did not post the complete error message.

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


Image Analyst
Image Analyst 2016년 3월 12일
편집: Image Analyst 2016년 3월 13일
How about using mat2gray():
b = 500 * mat2gray(a);
It scales min to max, whereas imadjust() scales based on percentage of counts in the histogram tails. Just depends on what you want to do.
  댓글 수: 16
Anvinder  Singh
Anvinder Singh 2016년 3월 13일
Oh, Thanks Image analyst. Just forgot it will have no poisson noise for '0' value. It seems to be good. One last thing, if i need the background to be white i am trying to change "grayimage = ones(256, 256);" and grayscale value but it doesnt seem to show up ?
Image Analyst
Image Analyst 2016년 3월 13일
"White" is going to be the brightest value in your image, which is 500, not 1. Assign areas you want to be white to 500, not 1.

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by