location of pixel from minimum and maximum value is in histogram
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
can you help me, please? I want to know where the location of pixel from minimum and maximum value is in histogram ?
0 comentarios
Respuestas (2)
Image Analyst
el 9 de Abr. de 2020
See if this is what you want:
% Read in image.
grayImage = imread('pout.tif');
subplot(2, 1, 1);
imshow(grayImage);
% Get histogram.
[counts, grayLevels] = imhist(grayImage);
subplot(2, 1, 2);
bar(grayLevels, counts, 1);
grid on;
title('Histogram of image', 'FontSize', 20);
% Get the min and max gray levels directly from the image.
minGLImage = min(grayImage(:))
maxGLImage = max(grayImage(:))
% Get the min and max gray levels from the histogram (instead of directly from the image).
minGL = grayLevels(find(counts, 1, 'first'))
maxGL = grayLevels(find(counts, 1, 'last'))
% Should be the same as from the image.
% Get the rows and columns where these occur in the image.
[minRows, minColumns] = find(grayImage == minGL);
[maxRows, maxColumns] = find(grayImage == maxGL);
% Plot these locations over the image in the graphical overlay.
subplot(2, 1, 1);
hold on; % Don't blow away image.
plot(minColumns, minRows, 'b.', 'MarkerSize', 25);
plot(maxColumns, maxRows, 'r.', 'MarkerSize', 25);
title('Red = max. Blue = min.', 'FontSize', 20);
0 comentarios
Yudawan Hidayat
el 13 de Abr. de 2020
5 comentarios
Image Analyst
el 16 de Abr. de 2020
I really don't know what this means. I've given you several guesses. Please define what a "max histogram" is because I don't know. All I know is that an image has one histogram, not several - no min histogram, no max histogram, no "any-kind-of-other" histogram, just one simple gray level histogram. And do you want the number of counts in the histogram bin? Or the values of pixels in the bins? Or the edges (min gray level and max gray level) that define one of the bins (like the one with the most counts in it)? Please give an example.
Ver también
Categorías
Más información sobre MATLAB Support Package for USB Webcams 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!