convert image and linear stretch

If i have an array of type double, how can i convert it to uint8 and linearly stretch all the values such that min = 0 and max = 255 ? do I have too write my own code for this ? Would this be the correct code ?
K = (depth - min(depth(:)))/(max(depth(:)) - min(depth(:)))*255;

답변 (2개)

KSSV
KSSV 2017년 2월 27일

1 개 추천

doc uint8 inbuilt function which converts double to uint8.

댓글 수: 1

RuiQi
RuiQi 2017년 2월 27일
thanks ! but i think it truncates the values that are above the limit. Id like to perform a scaling operation as well.

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

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2017년 2월 27일

답변:

2017년 2월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by