how to Scale the pixel values of the image so that the minimum value be- comes 0 and the maximum value becomes 255
28 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
how to do it with loops or what function can i use
0 comentarios
Respuestas (2)
DGM
el 24 de Mzo. de 2023
Editada: DGM
el 25 de Mzo. de 2023
You can do this with imadjust().
outpict = imadjust(inpict,stretchlim(inpict,0));
That will work for gray or RGB images of any standard image class. The output class will be inherited from the input. If the input is RGB, each channel will be scaled independently.
There are also less convenient ways to do it
outpict = im2uint8(mat2gray(inpict));
That will work for gray or RGB images of any class, but the output will always be uint8, regardless of the input class. If the input is RGB, the entire array will be scaled as a whole.
0 comentarios
Image Analyst
el 25 de Mzo. de 2023
Try rescale
output = uint8(rescale(inputImage, 0, 255));
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!