Image Segmentation using Histograms

5 visualizaciones (últimos 30 días)
Sander
Sander el 8 de Mzo. de 2012
Comentada: ROHIT GUPTA el 16 de Oct. de 2022
Dear All,
I am a student of Masters First Year....I am working on how to segment a part of Image using histograms. I am at initial stage of this part.
I need help in this regard, as i am converting an image in histogram i.e. f=imread('any image.jpg'); g=rgb2gray(f); h=imhist(g) figure, imshow(h) as i m executing this code i am not getting any histogram of the image...can anybody tell me why?
  1 comentario
ROHIT GUPTA
ROHIT GUPTA el 16 de Oct. de 2022
I = imread('any image.jpg')
imshow(I)
figure;
imhist(I);

Iniciar sesión para comentar.

Respuesta aceptada

Guillaume
Guillaume el 29 de Jul. de 2015
Editada: Guillaume el 29 de Jul. de 2015
To see the histogram, use imhist without any return argument.
In
h = imhist(g);
h is not an image, nor a handle to a plot, it is a vector of the counts of the bins. h would be better named as count or anything else more meaningful. As per the documention of imhist, the way to plot the histogram if you want to acquire the bin count is with:
[counts, binlocations] = imhist(g); %and again use meaningful variable name for your image
figure, stem(binlocations, counts);

Más respuestas (1)

Vahid Amin Nili
Vahid Amin Nili el 29 de Jul. de 2015
try "hist(Y,x)" function

Categorías

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