Modifying Image Histograms

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Modifying Image Histograms

Rotella, Anthony M. (GRC)[]
Hello,

        I need to threshold a large number of images that are similar,
but not quite the same. The vast majority threshold satisfactorily
within the same range, but some are far enough off to throw the
calculations and the accuracy out the window. Basically, I was wondering
if there is a way to change the images so that the important features of
the histograms of the slices in the stack fit into the same range, but
so that the pixels still maintain their relative values between each
other, so the same features of the image still threshold out correctly.
Unfortunately the Autothreshold is way off. I tried Enhance Contrast,
but makes the images very messy and doesn't work well. Another fix to my
problem is if someone knows how to increase the difference in pixel
intensities between objects in the foreground and background. I can
clearly see the difference , but of course, ImageJ can't just do what I
want, and some of the objects that I want to have thresholded out have
the same intensities as something in the background, maybe somewhere
else in the image. Unfortunately, I am hesitant to post the images on a
hosting service, but I can e-mail them to anyone that wants to see them.
Thanks, and sorry for the vague question!

Tony Rotella
Reply | Threaded
Open this post in threaded view
|

Re: Modifying Image Histograms

Michael Schmid
Hi Anthony,

it is a vague question, indeed.

Grayscale? Color? What kind of object? Extended? Small particles?


"Enhance Contrast" without equalizing the histogram, only
saturating a small percentage of pixels, should not mess up
anything (except for astronomical images and the like, where
the maximum intensity of bright stars will be clipped).

If it does not work at all and you have noise in your image,
use despeckle; if you have hot pixels or salt/pepper noise,
use process/noise/remove outliers (needs version 1.38v).

If the contrast between object and background is too weak
because it has blurred edges, unsharp mask will help.

If the object has a different texture than the background, the
variance filter (usually plus some smoothing thereafter) may work.

If you can't threshold the object because of a sloping
background, use "subtract background" or some other background
subtraction plugin, e.g.,
http://www.cs.unc.edu/~cquammen/imagej/ 
nonuniform_background_removal.html
or
http://www.optinav.com/Polynomial_Fit.htm

Of course, the human eye+brains have the advantage of a few million
years development time over any image processing algorithm, so
don't expect that any algorithm will be as good or even better
than what you can see.

Michael
________________________________________________________________

On 21 Jun 2007, at 17:27, Rotella, Anthony M. (GRC) wrote:

> Hello,
>
> I need to threshold a large number of images that are similar,
> but not quite the same. The vast majority threshold satisfactorily
> within the same range, but some are far enough off to throw the
> calculations and the accuracy out the window. Basically, I was  
> wondering
> if there is a way to change the images so that the important  
> features of
> the histograms of the slices in the stack fit into the same range, but
> so that the pixels still maintain their relative values between each
> other, so the same features of the image still threshold out  
> correctly.
> Unfortunately the Autothreshold is way off. I tried Enhance Contrast,
> but makes the images very messy and doesn't work well. Another fix  
> to my
> problem is if someone knows how to increase the difference in pixel
> intensities between objects in the foreground and background. I can
> clearly see the difference , but of course, ImageJ can't just do  
> what I
> want, and some of the objects that I want to have thresholded out have
> the same intensities as something in the background, maybe somewhere
> else in the image. Unfortunately, I am hesitant to post the images  
> on a
> hosting service, but I can e-mail them to anyone that wants to see  
> them.
> Thanks, and sorry for the vague question!
>
> Tony Rotella
Reply | Threaded
Open this post in threaded view
|

Re: Modifying Image Histograms

Giancarlo Mascetti
In reply to this post by Rotella, Anthony M. (GRC)[]
Hello Tony,
         A method called "histogram matching" probably could solve your
problem (the use the same threshold for a large number of "similar"
images)... but unfortunately it is not yet available in ImageJ (or as a plugin)
Some years ago I have written a matlab routine to perform such task but was
very slow...

Giancarlo

At 10.27 21/06/07 -0500, you wrote:

>Hello,
>
>         I need to threshold a large number of images that are similar,
>but not quite the same. The vast majority threshold satisfactorily
>within the same range, but some are far enough off to throw the
>calculations and the accuracy out the window. Basically, I was wondering
>if there is a way to change the images so that the important features of
>the histograms of the slices in the stack fit into the same range, but
>so that the pixels still maintain their relative values between each
>other, so the same features of the image still threshold out correctly.
>Unfortunately the Autothreshold is way off. I tried Enhance Contrast,
>but makes the images very messy and doesn't work well. Another fix to my
>problem is if someone knows how to increase the difference in pixel
>intensities between objects in the foreground and background. I can
>clearly see the difference , but of course, ImageJ can't just do what I
>want, and some of the objects that I want to have thresholded out have
>the same intensities as something in the background, maybe somewhere
>else in the image. Unfortunately, I am hesitant to post the images on a
>hosting service, but I can e-mail them to anyone that wants to see them.
>Thanks, and sorry for the vague question!
>
>Tony Rotella

Giancarlo Mascetti, Ph.D.
X-Istituto di Calcolo Scientifico

c/o Paramed Health Services Ltd.
c.so F. M. Perrone, 73r - 16152 Genova, Italy
tel. 010-6489265 - mob. 335-7787927 - fax. 010-7404530
E-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Modifying Image Histograms

Gabriel Landini
On Thursday 21 June 2007 18:01:20 Giancarlo Mascetti wrote:
>          A method called "histogram matching" probably could solve your
> problem (the use the same threshold for a large number of "similar"
> images)... but unfortunately it is not yet available in ImageJ (or as a
> plugin) Some years ago I have written a matlab routine to perform such task
> but was very slow...

Here is a description of one algorithm in IDL. This seems straightforward to
implement as a macro.

http://www.dfanning.com/ip_tips/histomatch.html

Cheers,

G.
Reply | Threaded
Open this post in threaded view
|

Re: Modifying Image Histograms

Burger Wilhelm
In reply to this post by Rotella, Anthony M. (GRC)[]
Hello,

histogram matching (or specification) IS available for ImageJ in the source code section of our book's support site at www.imagingbook.com . While the English edition is scheduled to appear in September, you could for now download the source code for the German edition from

   http://www.imagingbook.com/fileadmin/de/java2/ch05.zip

which contains English comments anyway. Hope this helps.

WB

--
Dr. Wilhelm BURGER
| upper austria univ. of applied sciences
| digital media
| A4232 Hagenberg, Austria
| www.fh-hagenberg.at/staff/burger
| www.imagingbook.com



> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On
> Behalf Of Giancarlo Mascetti
> Sent: Thursday, June 21, 2007 7:01 PM
> To: [hidden email]
> Subject: Re: Modifying Image Histograms
>
> Hello Tony,
>          A method called "histogram matching" probably could
> solve your
> problem (the use the same threshold for a large number of "similar"
> images)... but unfortunately it is not yet available in
> ImageJ (or as a plugin)
> Some years ago I have written a matlab routine to perform
> such task but was
> very slow...
>
> Giancarlo
>
> At 10.27 21/06/07 -0500, you wrote:
> >Hello,
> >
> >         I need to threshold a large number of images that
> are similar,
> >but not quite the same. The vast majority threshold satisfactorily
> >within the same range, but some are far enough off to throw the
> >calculations and the accuracy out the window. Basically, I
> was wondering
> >if there is a way to change the images so that the important
> features of
> >the histograms of the slices in the stack fit into the same
> range, but
> >so that the pixels still maintain their relative values between each
> >other, so the same features of the image still threshold out
> correctly.
> >Unfortunately the Autothreshold is way off. I tried Enhance Contrast,
> >but makes the images very messy and doesn't work well.
> Another fix to my
> >problem is if someone knows how to increase the difference in pixel
> >intensities between objects in the foreground and background. I can
> >clearly see the difference , but of course, ImageJ can't
> just do what I
> >want, and some of the objects that I want to have
> thresholded out have
> >the same intensities as something in the background, maybe somewhere
> >else in the image. Unfortunately, I am hesitant to post the
> images on a
> >hosting service, but I can e-mail them to anyone that wants
> to see them.
> >Thanks, and sorry for the vague question!
> >
> >Tony Rotella
>
> Giancarlo Mascetti, Ph.D.
> X-Istituto di Calcolo Scientifico
>
> c/o Paramed Health Services Ltd.
> c.so F. M. Perrone, 73r - 16152 Genova, Italy
> tel. 010-6489265 - mob. 335-7787927 - fax. 010-7404530
> E-mail: [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Re: Modifying Image Histograms

Gabriel Landini
On Friday 22 June 2007 09:40:50 Burger Wilhelm wrote:
> histogram matching (or specification) IS available for ImageJ in the source
> code section of our book's support site at www.imagingbook.com .
> While the English edition is scheduled to appear in September, you could for
> now  download the source code for the German edition from
>
>    http://www.imagingbook.com/fileadmin/de/java2/ch05.zip
>
> which contains English comments anyway. Hope this helps.

Wilhelm,

I think that the histogram matching code is missing from the zip file.
I see:
AlphaBlend
Equalize
GammaCorrection
RaiseConstrast

I look forward to the English version!

Regards,

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: Modifying Image Histograms

Burger Wilhelm
In reply to this post by Rotella, Anthony M. (GRC)[]
Oups, you are right! Apparently this file is not current - I will upload the latest version and post again. Thanks and sorry for the inconvenience.

Wilhelm


 

> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On
> Behalf Of Gabriel Landini
> Sent: Friday, June 22, 2007 11:22 AM
> To: [hidden email]
> Subject: Re: Modifying Image Histograms
>
> On Friday 22 June 2007 09:40:50 Burger Wilhelm wrote:
> > histogram matching (or specification) IS available for
> ImageJ in the source
> > code section of our book's support site at www.imagingbook.com .
> > While the English edition is scheduled to appear in
> September, you could for
> > now  download the source code for the German edition from
> >
> >    http://www.imagingbook.com/fileadmin/de/java2/ch05.zip
> >
> > which contains English comments anyway. Hope this helps.
>
> Wilhelm,
>
> I think that the histogram matching code is missing from the zip file.
> I see:
> AlphaBlend
> Equalize
> GammaCorrection
> RaiseConstrast
>
> I look forward to the English version!
>
> Regards,
>
> Gabriel
>
Reply | Threaded
Open this post in threaded view
|

Re: Modifying Image Histograms

Burger Wilhelm
The file http://www.imagingbook.com/fileadmin/de/java2/ch05.zip <http://www.imagingbook.com/fileadmin/de/java2/ch05.zip>  has been updated and now contains the previously missing classes for histogram matching and histogram specification.
 
Enjoy -
Wilhelm
 
[hidden email]
www.imagingbook.com
 

________________________________

Von: ImageJ Interest Group im Auftrag von Burger Wilhelm
Gesendet: Fr 22.06.2007 12:35
An: [hidden email]
Betreff: Re: Modifying Image Histograms



Oups, you are right! Apparently this file is not current - I will upload the latest version and post again. Thanks and sorry for the inconvenience.

Wilhelm




> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On
> Behalf Of Gabriel Landini
> Sent: Friday, June 22, 2007 11:22 AM
> To: [hidden email]
> Subject: Re: Modifying Image Histograms
>
> On Friday 22 June 2007 09:40:50 Burger Wilhelm wrote:
> > histogram matching (or specification) IS available for
> ImageJ in the source
> > code section of our book's support site at www.imagingbook.com .
> > While the English edition is scheduled to appear in
> September, you could for
> > now  download the source code for the German edition from
> >
> >    http://www.imagingbook.com/fileadmin/de/java2/ch05.zip
> >
> > which contains English comments anyway. Hope this helps.
>
> Wilhelm,
>
> I think that the histogram matching code is missing from the zip file.
> I see:
> AlphaBlend
> Equalize
> GammaCorrection
> RaiseConstrast
>
> I look forward to the English version!
>
> Regards,
>
> Gabriel
>
Reply | Threaded
Open this post in threaded view
|

Re: Modifying Image Histograms

Noel BONNET
In reply to this post by Rotella, Anthony M. (GRC)[]
Hello,

Could I suggest another way to "solve" (???) the problem. Instead of
modifying the histogram (in fact, the image) in order to be able to use
always the same threshold, it is sometimes more appealing to avoid
thresholding...
This is basically the philosophy of our approach published in (Bonnet N.,
Cutrona J. and Herbin M. "No-threshold" histogram-based image segmentation.
Pattern Recognition 2002, 35, 2319-2322).
A plugin for ImageJ (called Segmentation_fuzzy_514) is available at:
http://www.univ-reims.fr/INSERM514/ImageJ
A more extended description of the method is also available.

Since no threshold has to be defined, the approach is (in principle!) able
to work on series of images without modifying anything.

I hope it helps.

Noel Bonnet




On Thu, 21 Jun 2007 10:27:37 -0500, Rotella, Anthony M. (GRC)[]
<[hidden email]> wrote:

>Hello,
>
> I need to threshold a large number of images that are similar,
>but not quite the same. The vast majority threshold satisfactorily
>within the same range, but some are far enough off to throw the
>calculations and the accuracy out the window. Basically, I was wondering
>if there is a way to change the images so that the important features of
>the histograms of the slices in the stack fit into the same range, but
>so that the pixels still maintain their relative values between each
>other, so the same features of the image still threshold out correctly.
>Unfortunately the Autothreshold is way off. I tried Enhance Contrast,
>but makes the images very messy and doesn't work well. Another fix to my
>problem is if someone knows how to increase the difference in pixel
>intensities between objects in the foreground and background. I can
>clearly see the difference , but of course, ImageJ can't just do what I
>want, and some of the objects that I want to have thresholded out have
>the same intensities as something in the background, maybe somewhere
>else in the image. Unfortunately, I am hesitant to post the images on a
>hosting service, but I can e-mail them to anyone that wants to see them.
>Thanks, and sorry for the vague question!
>
>Tony Rotella
>========================================================================