how to Scale the pixel values of the image so that the minimum value be- comes 0 and the maximum value becomes 255
조회 수: 28 (최근 30일)
이전 댓글 표시
how to do it with loops or what function can i use
댓글 수: 0
답변 (2개)
DGM
2023년 3월 24일
편집: DGM
2023년 3월 25일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!