how to convert 0-60 scale to 0-255 scale in image
Mostra commenti meno recenti
I am new in imaging. I want to ask that when we convert certain data to image then a scale is always set to 0-60. How can I rescale it to 0-255 so that better contrast is observed.

Risposte (3)
Image Analyst
il 17 Dic 2016
Use mat2gray() to get it to the range 0-1, then multiply by 255 and cast to unsigned integer:
grayImage = uint8(255 * mat2gray(originalImage));
2 Commenti
akash tondon
il 18 Dic 2016
Image Analyst
il 18 Dic 2016
It WON'T be 0-60. It WILL be 0-255. You did something wrong, so show me what you did. However if you want 0-250 instead of 0-255, do this:
grayImage = uint8(250 * mat2gray(originalImage));
michio
il 17 Dic 2016
0 voti
imadjust function from Image Processing Toolbox could help you.
Jan
il 17 Dic 2016
Another cheap approach:
result = uint8((double(originalImage) / 60) * 255);
mat2gray of Image Analysts answer is smarter and safer. Prefer the functions of the Image Processing Toolbox, if you have it.
Categorie
Scopri di più su Convert Image Type in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
