Gray image quantization
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to quantize an image into 12 bit intensity using the below code:
R2D = mat2gray(R2D); % intensity between [0,1] Double
R2D = double(uencode(R2D,12)); % intensity between [0,2^12] integer
PIC = mat2gray(R2D); % intensity between [0,1] Double
imshow(pic);
the problem is in 'uencode' function , the input must be in the range of [-1,1], is there a way to do that quantization for input values between [0,1]? may be some changes to the 'uencode' will do job :)
Many thanks
댓글 수: 0
채택된 답변
추가 답변 (1개)
Image Analyst
2012년 2월 10일
How about using code like:
actualMin = double(min(min(imgOriginal)));
actualMax = double(max(max(imgOriginal)));
slope = (desiredMax - desiredMin) / (double(actualMax) - double(actualMin));
scaledImage = slope * (double(imgOriginal) - actualMin) + desiredMin;
댓글 수: 2
Image Analyst
2012년 2월 10일
I didn't think that was your intention because at the end you called mat2gray() which forces it into a 0-1 range, which pretty much wipes out quantization - not quite but for most intents and purposes it does. And the quantized intermediate images, you didn't do anything with.
참고 항목
카테고리
Help Center 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!