From: Kenneth Galea on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <5087fb31-67df-4dc6-aee9-2c37024794dd(a)a13g2000vbf.googlegroups.com>...
> Kenneth
> I'm not exactly sure how to respond. With objects in the image and a
> blank background you can use a threshold on monochrome images, or use
> color classification on color images. With color images, simple color
> classification can sometimes be done with thresholding the three color
> bands, which will essentially select out a rectangular chunk out of
> the 3D rgb color space. You pick a threshold such that it will select
> the objects and not select the background. If you can do this with an
> auto threshold, such as the Otsu method used by graythresh, then
> fine. However a simple auto method (like gray thresh) will force a
> threshold to be picked that divides the image into foreground and
> background. If you're looking at a picture that has no foreground
> because it's all background then it will basically split the
> background into two classes (light background and dark background),
> which is not what you want. That's why I said to use a fixed
> threshold. It will always pick out the proper things regardless of
> how large or small the foreground objects are. With an autothreshold
> method, the threshold that is picked depends on the area fraction of
> the objects in the foreground. If they are of substantial size with
> respect to the background it may pick a good threshold value but if
> the foreground is too small or nonexistent then it will try to pick a
> threshold based on just the background which will of course be
> unacceptable.
>
> In your latest case you had no foreground and so the subtraction is
> essentially all just noise. Then the autothreshold picked some gray
> level right in the midst of that noise and so it picks out the
> strongest noise as foreground objects. Obviously you don't want
> that. If you're going to have images that range anywhere from big
> objects to small objects to no objects, then you're going to have to
> have a threshold selection method that will give you the correct
> threshold. I've had cases like this and I can tell you that I use a
> fixed threshold. You pick a threshold and if there's something above
> it, it's an objects. If there's nothing above it there's o objects.
> It works for any and all object sizes, from an object that is 100% of
> the pixels all the way down to 0% of the pixels. It ALWAYS works,
> unlike an autothreshold method which only works well if the foreground
> and background can be split into two histogram humps (unless of course
> the auto method is smart enough to revert to a fixed threshold when it
> recognized that the test image histogram is essentially no different
> than the background histogram, but then we're back to the fixed
> threshold again.)
>
> So if you want to be completely general I'd stick with a fixed
> threshold. But if you're always going to have objects that take up a
> substantial portion of the image (like your scissors and pen image)
> AND you're going to correct for shading in the background
> illumination, then an auto threshold can work. But like I said, it
> won't work for the "no objects" case.

Hi.
Thanks for your reply. Today I'll decide where to put the camera (in terms of height). My final aim since I haven't told you yet is to move a robotic arm towards any object and then grab them according to the image using what is called a "blind grasp" since no feedback will be given about positions but I just give a position to the arm and it must go exactly to the object (if calibrations are made right). So if I decide to use a fixed threshold let's say 0.9 (since that is what I used if I remember well), my white background will not be detected as object in NO CASE thats right?? But on the other hand, with this fixed threshold, I will be limited to having only dark coloured objects which contrast well from the background.....So from what you said and if what I'm saying above is correct, I think I'll prefer to use a FIXED THRESHOLD with only dark coloured objects to ENSURE that
background is ALWAYS ELIMINATED!! Please correct me if I'm wrong

Thanks
Kenneth

Regards
Kenneth
From: ImageAnalyst on
Kenneth:
If you have a camera on the end of the arm and moving around to
different parts of your scene (work environment), then the
illumination will not be constant. The lighting will be different,
there will be shadows from parts and equipment, etc. One problem with
your other image was that your objects had intensities that were
darker, brighter, and the same as the background making it difficult
to segment out what you want with simple thresholding. If you can
make all your parts darker and make your background always lighter (or
vice versa) then of course that would be best. But in the real world
there are some things you can control and somethings that are given
and beyond your control. for example in a parts picking operation you
are probably stuck with the parts but may have some control over their
illumination, their placement/orientation on a background, the color
of light used, etc. You may have control over the background, for
example the parts are always placed on a flat conveyor belt, or you
may not have control, for example the parts are to be picked from a
big bin full of parts all touching and randomly oriented. I don't
know your situation but if you're going to be designing a robust
industrial parts robot then you probably can't simply specify that all
your parts are dark, but maybe you can make sure that they're placed
on a really white background. Then you should just use a fixed
threshold. If not, for example it must be on some kind of gray
webbing and the parts are both brighter and darker than the background
then I suggest you look into edge segmentation where you do an edge
detection and then fill in the objects and use that as the mask. You
might have to twiddle with the edge filter parameters to try to get
boundaries as closed and connected as possible.
-ImageAnalyst