Re: Automate thresholding on various grayscale images



On Jun 12, 2:10 pm, ImageAnalyst <imageanal...@xxxxxxxxxxxxxx> wrote:
---------------------------------------------------------------------------------------------------------------
Nathan:
The image you posted isn't bad as far as non-uniform background goes.
Yeah, I've seen worse, but each of mine vary which makes this process
(seem) harder for me.

It could maybe be improved (like maybe dividing the image by the
morphological closing of the image).  I see this shape of histogram a
lot.  Basically it's a Gaussian with a little tail on one side.
I'm somewhat new to matlab, and even newer to image processing. What's
this "Gaussian with a little tail"?

Usually the best threshold is right where the tail seems to stick into
the Gaussian.  I find the best method for auto thresholding that is
the triangle method.  Here's a reference (ImageJ source code):http://rsb.info.nih.gov/ij/plugins/download/AutoThresholder.java
Actually, ImageJ is the program I've most recently used to try to find
a nice, clean threshold (or some other means of finding these soot
particles). Does ImageJ have this Triangle method readily available?
If so, how do I use it (or find it)? If not, how do I get it?
(I've read something about being able to incorporate ImageJ code with
Matlab code, but have yet to figure it out)

Look near the end of the page for "triangle"
It works like this:  Draw a line from the highest peak of the Gaussian
to last bin in the side you want to threshold, for example a line
going from about bin 190 to bin 100 or so.  Now, take lines
perpendicular to that line that point to your histogram (the pair of
these lines now form a "T" shape).  The selected threshold will be the
bin that has the longest perpendicular line (around 174 for your
image).  Basically it finds the "corner" of your histogram on the tail
side of it.
I think I'm still lost with that Gaussian term. I've heard it many
times, but it just confuses me. How would I go about doing these
instructions? (And is this the same as ImageJ's "Maximum Entropy"
threshold under "MultiThresholder"? This gives about the same
threshold value.)


Check out section 8.3 here for more methods:http://www.visionbib.com/bibliography/contentssegment.html#2-D%20Regi...
I'll continue to look through this for more help as well, thanks for
the link.


There are other ways to find the particles that are robust to slowly
changing background levels.  For example, you could use a variance
filter.  High variance areas will be where your soot is and low
variance will be where you background is.  You could take the variance
of the image (in a sliding window sort of fashion) and then threshold
that.  Or maybe filter it with something like a morphological closing
or a median filter and subtract that from the image (background will
vanish even if it varies locally), and threshold the result.
How would I do this programatically, rather than manually?


Bottom line, it will take a little bit of experimentation to come up
with the best method.
Yeah, I've noticed this even with manually doing the thresholding.
I've yet to find one method that works best for me. However, although
I can do this all manually, what I really want to know is how could I
do it through Matlab code? Currently, my image analysis process is
extremely slow because I have to manually find each aggregate's area
before any calculations can be done.

Good luck,
ImageAnalyst

Thanks for you help. Reading through your posts, you obviously know
what you are doing and have plenty of experience.

There's another thing I'm trying to figure out that somewhat coincides
with this thresholding problem.
After thresholding (if I ever find the way that suits me best), I need
to be able to locate these regions through my program, which searches
for enclosed areas (being rectangles or ellipses).
(My program takes in three images: the original TEM image, a black and
white "PERIMETER" image, which is the thresholded image, and a black
and white "BOXED" image, which consists of boxes surrounding the areas
where the aggregates should be. The boxes are white-bordered, with
everything else being black.)
So, I also need some way to do this programatically, rather than
manually.
This is probably too much in one thread, but again, any help is
appreciated.
-Nathan
.



Relevant Pages

  • Re: Automate thresholding on various grayscale images
    ... I'm sure you can do a web search for Gaussian and find lots of ... Sometimes with an image there just plain isn't any global threshold ... In fact it's way more common than a Gaussian distribution. ... I think that he said that the distributions were Cauchy-Lorentz ...
    (comp.soft-sys.matlab)
  • Law of the ponctual process induced by a thesholded gaussian stochastic process
    ... Let Xt be a,gaussian, zero mean, band limited, stochastic ... process of constant power spectral density over B. ... Let set a threshold T and consider the two induced ponctual process ...
    (sci.stat.math)
  • Re: Automate thresholding on various grayscale images
    ... I am doing some soot particle analysis based off of TEM images ... None of my images seem to share the same threshold levels required to ... separate the background/noise from the particles/aggregates. ... High variance areas will be where your soot is and low ...
    (comp.soft-sys.matlab)

Loading