Quantizing a grayscale image into 256 levels
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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!
0 Commenti
Risposte (1)
Adam
il 18 Lug 2016
Modificato: Adam
il 18 Lug 2016
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 Commenti
Adam
il 18 Lug 2016
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)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!