Why is the horizontal axis 0 to 1 in a histogram for a rgb image?

3 visualizaciones (últimos 30 días)
for my code I am trying to determine intensitiy of the connect components and plot histograms:
for k = 1:numZones
...
zoneMask = zoneMask .* im2double(edgesClean) .* DD;
% Calculate connected components in this zone
cc = bwconncomp(zoneMask);
% Calculate region properties for each connected component in this zone
statscc = regionprops(cc, 'Area', 'Centroid', 'Eccentricity', 'Perimeter', 'MajorAxisLength', 'MinorAxisLength', 'Circularity', 'MaxFeretProperties', 'MinFeretProperties');
% Calculate features for this zone
numObjects = cc.NumObjects;
if numObjects > 0
profileCounts(k) = numObjects;
end
% Create a histogram of the intensities
figure;
imhist(intensities);
grid on;
But sometimes the values on x axis are strange (i.e. not 0 to 256 for a rgb image I have) why is this? is my code errousnous? please help me to fix so that i have accurately determined histogram of connected components intensity.

Respuesta aceptada

Image Analyst
Image Analyst el 25 de Mayo de 2023
Please attach one of your images and code to read it in. Evidently your image got converted to floating point. And there is no reason that your image should span the full dynamic range unless you forced it to or it was naturally like that for some reason. Usually images don't span the full dynamic range.
  6 comentarios
Chanille
Chanille el 25 de Mayo de 2023
You answered my question, @Image Analyst its just because of the conditions of my code its not obvious how to set up MeanIntensity hence why i made the complicated cellfun equation as a substitute. If I may I would like to ask if despite it being complicated does the cellfun work for the purposes intended?
Also from what you're saying it sounds like imhist() is better but since my cellfun is a floating point the horizontal axis will reflect this 0 to 1 not 0 to 256.
Image Analyst
Image Analyst el 25 de Mayo de 2023
I don't know. I just always use regionprops because it's so much easier and it lets you get lots of other measurements at the same time. You can compare your two intensity arrays just as well as I can.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Histograms 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