How can I do the histogram equalization?

Hello
I think that the histogram equalization on the 3 components of a color image has the effect of increasing the contrast in order to facilitate the detection of the region of interest that is darker than the other part of the image. How can I do this using matlab? thanks

Respuestas (2)

Aneesh Balaji
Aneesh Balaji el 14 de Nov. de 2012

0 votos

Hey For a color image split into 3 components and perform histeq on each of them and then recombine them.

1 comentario

Tomas
Tomas el 14 de Nov. de 2012
Editada: Tomas el 14 de Nov. de 2012
I used these lines but i got this result
r=im(:,:,1);
v=im(:,:,2);
b=im(:,:,3);
r1 = histeq(r);
v1 = histeq(v);
b1 = histeq(b);
img = cat(3,r1,v1,b1);

Iniciar sesión para comentar.

Image Analyst
Image Analyst el 14 de Nov. de 2012

0 votos

Using histeq() on individual color channels is not a good method. You will introduce color artifacts which may be severe. You're best off converting to hsv color space, then using histeq() or adapthisteq() on only the v channel, then recombine and transform back to rgb color space.

4 comentarios

I tried this but I got also a bad result
im=rgb2hsv(im);
h=im(:,:,1);
s=im(:,:,2);
v=im(:,:,3);
v1 = histeq(v);
img = cat(3,h,s,v1);
img2=hsv2rgb(img);
Image Analyst
Image Analyst el 15 de Nov. de 2012
Looks like it should be right. Maybe it's some kind of uint8/double conflict. Can you post your image somewhere?
Tomas
Tomas el 16 de Nov. de 2012
I'm working on a large number of images. I just need to equalize the histogram to facilitate detection of the dark object. this is an example http://s13.postimage.org/99yr0g2p3/image.jpg
Image Analyst
Image Analyst el 16 de Nov. de 2012
Histogram equalization is not necessary for that purpose. In fact, it's rarely necessary for anything. And it looks like you'd do best with a texture filter, like entropyfilt() or stdfilt(), at least for the one image you posted.

Iniciar sesión para comentar.

Etiquetas

Preguntada:

el 10 de Nov. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by