필터 지우기
필터 지우기

Quantizing a grayscale image into 256 levels

조회 수: 7 (최근 30일)
Muzammil Behzad
Muzammil Behzad 2016년 7월 18일
댓글: Muzammil Behzad 2016년 7월 18일
Hi community,
I have a very simple question and I searched for it too but I am not getting the correct way of doing it. I have a grayscle image [0 255]. I performed some operation on the image and the image intensity values become something like [2.3 33.4 233.88 and so on] instead of integers. Now, I want to bring the values back to the integers. One way is to quantize the image into 256 levels (even though it's already in 256 levels but it'll make the pixel values into integers). My question is how to quantize this image into 256 levels (I am not getting how imquantize works)? Also, how is quantizing in this case different from simply rounding?
Many thanks!

답변 (1개)

Adam
Adam 2016년 7월 18일
편집: Adam 2016년 7월 18일
In your case, assuming the values are still in the desired [0 255] range then just rounding and/or casting to integers is the best approach.
Image quantization would generally be used if you wanted to use something like e.g. 10 colours to represent your image rather than the full 256 or if you are wanting non-regular quantization levels rather than all just being 256 regular levels of 1s
  댓글 수: 3
Adam
Adam 2016년 7월 18일
It's not really my area of expertise. Image Analyst would be a far better person to give an answer on that if he happens to drop in here.
But from my understanding you would use some intelligent method to work out what you want the levels to be and they don't need to be equal in size so e.g.
1-10, 11-30, 31-67, 68-70, 71-100, 101-135, 136-190, 191-200, 201-224, 225-255
Then your image would be quantized into those levels. How you get those levels depends on what you are aiming to do. They may come from some histogram analysis of the densities of points in different parts of the grayscale spectrum.
The documentation uses examples that use the
doc multithresh
function to determine these thresholds for an image using Otsu's method (I am not familiar with this, but it has a help page)
Muzammil Behzad
Muzammil Behzad 2016년 7월 18일
Yeah I went through the help page and they are using this function to find the thresholds for imquantize. Anyways, thanks a lot for your help.

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

Community Treasure Hunt

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

Start Hunting!

Translated by