how make x and y -axis labels(titles) for histogram of an image?
32 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
somasekar jalari
el 2 de Mayo de 2015
Comentada: somasekar jalari
el 4 de Mayo de 2015
i execute the following matlab code to display histogram of gray scale image with x-axis and y-axis names but i didnot get names in x-axis and y-axis labels.
k=imhist(image)
xlabel('grayscale range')
ylabel('intensity values range');
0 comentarios
Respuesta aceptada
Image Analyst
el 2 de Mayo de 2015
Your code should have worked. Try my boilerplate code snippet:
% Let's compute and display the histogram.
[pixelCount, grayLevels] = imhist(grayImage);
bar(grayLevels, pixelCount); % Plot it as a bar chart.
grid on;
title('Histogram of original image', 'FontSize', fontSize);
xlabel('Gray Level', 'FontSize', fontSize);
ylabel('Pixel Count', 'FontSize', fontSize);
xlim([0 grayLevels(end)]); % Scale x axis manually.
Más respuestas (1)
Ahmet Cecen
el 2 de Mayo de 2015
Editada: Ahmet Cecen
el 2 de Mayo de 2015
This sometimes happens to me too. The problem is xlabel sometimes get stuck BEHIND the imhist colorbar at the bottom. To fix it you can use this instead (may need to play around with the values for your liking):
xlabel('grayscale range')
xl = get(gca,'XLabel');
set(xl,'Position',get(xl,'Position') - [0 60000 0])
And Image Analyst's solution would also work because it gets rid of the default bar at the bottom. Take your pick.
0 comentarios
Ver también
Categorías
Más información sobre Histograms en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!