8 visualizaciones (últimos 30 días)
sweta arya el 27 de Jun. de 2015
Respondida: Ashish Uthama el 29 de Jun. de 2015
i am trying to do uniform quantization on a gray scale image. i have to generate different images matrix for different K levels using imquantize() function and display all images. please let me know how to do that in MATLAB
2 comentariosMostrar NingunoOcultar Ninguno
Geoff Hayes el 27 de Jun. de 2015
sweta - have you looked at the examples from imquantize?
sweta arya el 28 de Jun. de 2015
yes,they only display images like one image for 256 level,then one for 16 levels.but i want images for all 16 levels,if my image is quantizing to 16 levels.

Iniciar sesión para comentar.

Image Analyst el 28 de Jun. de 2015
Put it in a for loop
% Split the image into eight levels by obtaining seven thresholds from multithresh.
for numLevels = 1 : 16
thresh = multithresh(grayImage, numLevels);
% Construct the valuesMax vector such that the maximum value
% in each quantization interval is assigned to the eight levels of the output image.
valuesMax = [thresh max(grayImage(:))]
[quant8_I_max, index] = imquantize(grayImage,thresh,valuesMax);
valuesMin = [min(grayImage(:)) thresh]
quant8_I_min = valuesMin(index);
% Display both eight-level output images side by side.
figure;
imshowpair(quant8_I_min,quant8_I_max,'montage')
title('Minimum Interval Value Maximum Interval Value')
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
end
0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Más respuestas (1)

Ashish Uthama el 29 de Jun. de 2015
"i want images for all 16 levels"
I interpreted it as - quantize to 16 levels and give me a mask for each of those levels. (Though, now I think IA's answer above might be what you were looking for).
im = magic(5);
lvls = multithresh(im,3);
qm = imquantize(im,lvls)
qm =
3 4 1 2 3
4 1 1 3 3
1 1 2 4 4
2 2 4 4 1
2 3 4 1 2
imlvl1 = false(size(im));
% Replace 1 with any of the resulting 4 levels
imlvl1(qm==1)= true
imlvl1 =
0 0 1 0 0
0 1 1 0 0
1 1 0 0 0
0 0 0 0 1
0 0 0 1 0
0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Categorías

Más información sobre Image Arithmetic en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by