I want to change the gray scale from [0 1] to [0 500]
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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)
0 Commenti
Risposte (2)
Walter Roberson
il 12 Mar 2016
"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 Commenti
Walter Roberson
il 12 Mar 2016
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
il 12 Mar 2016
Modificato: Image Analyst
il 13 Mar 2016
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 Commenti
Image Analyst
il 13 Mar 2016
"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.
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!