From: Margarida Pereira on
Hi! I'm trying to enhance a grayscale image. However, some images have local brightness, which means that in some spots I have a white area that, in fact, should be gray, or I can also have black areas that should be also gray. What I trying to do is to uniformize the images and change the pixels of those areas to an average grayscale level. Any idea how I can perform this automatically?

Thanks for the help!
From: us on
"Margarida Pereira" <pereira.m321(a)gmail.com> wrote in message <hvam1q$pj7$1(a)fred.mathworks.com>...
> Hi! I'm trying to enhance a grayscale image. However, some images have local brightness, which means that in some spots I have a white area that, in fact, should be gray, or I can also have black areas that should be also gray. What I trying to do is to uniformize the images and change the pixels of those areas to an average grayscale level. Any idea how I can perform this automatically?
>
> Thanks for the help!

a hint:
- a very(!) simple approach could be to FIND (with two output args) the
offending locations in your image mat and set them to whatever you'd
like them to look like...

help find;

us
From: Margarida Pereira on
"us " <us(a)neurol.unizh.ch> wrote in message <hvaorp$6i4$1(a)fred.mathworks.com>...
> "Margarida Pereira" <pereira.m321(a)gmail.com> wrote in message <hvam1q$pj7$1(a)fred.mathworks.com>...
> > Hi! I'm trying to enhance a grayscale image. However, some images have local brightness, which means that in some spots I have a white area that, in fact, should be gray, or I can also have black areas that should be also gray. What I trying to do is to uniformize the images and change the pixels of those areas to an average grayscale level. Any idea how I can perform this automatically?
> >
> > Thanks for the help!
>
> a hint:
> - a very(!) simple approach could be to FIND (with two output args) the
> offending locations in your image mat and set them to whatever you'd
> like them to look like...
>
> help find;
>
> us



Hi!
yes, but some pixels are actually set to zero or one and they're supposed to stay that way (for example, special features in the image)...
Thanks for the tip anyway!
From: ImageAnalyst on
"Margarida Pereira" <pereira.m...(a)gmail.com> :
Take a look at adapthisteq() in the Image Processing Toolbox:

adapthisteq

Contrast-limited adaptive histogram equalization (CLAHE)
Syntax

J = adapthisteq(I)
J = adapthisteq(I,param1,val1,param2,val2...)
Description

J = adapthisteq(I) enhances the contrast of the grayscale image I by
transforming the values using contrast-limited adaptive histogram
equalization (CLAHE).

CLAHE operates on small regions in the image, called tiles, rather
than the entire image. Each tile's contrast is enhanced, so that the
histogram of the output region approximately matches the histogram
specified by the 'Distribution' parameter. The neighboring tiles are
then combined using bilinear interpolation to eliminate artificially
induced boundaries. The contrast, especially in homogeneous areas, can
be limited to avoid amplifying any noise that might be present in the
image.
From: Margarida Pereira on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <68adaada-7338-409c-a424-938e7028d701(a)k39g2000yqb.googlegroups.com>...
> "Margarida Pereira" <pereira.m...(a)gmail.com> :
> Take a look at adapthisteq() in the Image Processing Toolbox:
>
> adapthisteq
>
> Contrast-limited adaptive histogram equalization (CLAHE)
> Syntax
>
> J = adapthisteq(I)
> J = adapthisteq(I,param1,val1,param2,val2...)
> Description
>
> J = adapthisteq(I) enhances the contrast of the grayscale image I by
> transforming the values using contrast-limited adaptive histogram
> equalization (CLAHE).
>
> CLAHE operates on small regions in the image, called tiles, rather
> than the entire image. Each tile's contrast is enhanced, so that the
> histogram of the output region approximately matches the histogram
> specified by the 'Distribution' parameter. The neighboring tiles are
> then combined using bilinear interpolation to eliminate artificially
> induced boundaries. The contrast, especially in homogeneous areas, can
> be limited to avoid amplifying any noise that might be present in the
> image.


Hi!
I tried that approach (and the example of the tire ilustrates what I want to do), but I think that perhaps in some cases the extension of the bright (or dark) spots is too large, or maybe I'm doing something wrong, because I still can't modify those areas, even trying different parameters and distributions.
Thanks for the help!