Morphological Segmentation of Distinct Parts of Corn Kernels

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

Morphological Segmentation of Distinct Parts of Corn Kernels

Cmhulbert
Hi all,

I have been playing around with ImageJ for a few weeks now, and have tried various segmentation methods, with the goal in mind of eventually measuring color values from kernels of corn. I have the kernels scanned in on a regular house scanner, at 300dpi. I can easily segment the from each other, and the background, with Weka Segmentation training, but I'm having difficulty when I try to separate parts of the kernels themselves (the Embryo, the tip, and the rest of the kernel) from each other. It seems like the Weka Segmentation gives too much weight to the color diferences/similarities, rather than the morphological differences  (such as the grainy tips, or the raised "crater-like" appeareance around the embryo). Does anyone have suggestions as to what settings in Weka I should use to train for this? Or whether there is a better way to do this?

Thanks,
Caleb
Reply | Threaded
Open this post in threaded view
|

Re: Morphological Segmentation of Distinct Parts of Corn Kernels

ctrueden
Hi Caleb,

> I'm having difficulty when I try to separate parts of the kernels
> themselves (the Embryo, the tip, and the rest of the kernel) from each
> other.

Did you enable the additional training features in the TWS's Settings
dialog?

If so, and that still didn't help: you could post an example image
somewhere for others to try their hand.

Note also that in the future, TWS will support custom features (as a type
of ImageJ2 plugin), but this work is not yet complete. That sort of thing
will eventually help solve use cases like yours though.

Regards,
Curtis

On Fri, Jun 26, 2015 at 10:50 AM, Cmhulbert <[hidden email]> wrote:

> Hi all,
>
> I have been playing around with ImageJ for a few weeks now, and have tried
> various segmentation methods, with the goal in mind of eventually measuring
> color values from kernels of corn. I have the kernels scanned in on a
> regular house scanner, at 300dpi. I can easily segment the from each other,
> and the background, with Weka Segmentation training, but I'm having
> difficulty when I try to separate parts of the kernels themselves (the
> Embryo, the tip, and the rest of the kernel) from each other. It seems like
> the Weka Segmentation gives too much weight to the color
> diferences/similarities, rather than the morphological differences  (such
> as
> the grainy tips, or the raised "crater-like" appeareance around the
> embryo).
> Does anyone have suggestions as to what settings in Weka I should use to
> train for this? Or whether there is a better way to do this?
>
> Thanks,
> Caleb
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Morphological-Segmentation-of-Distinct-Parts-of-Corn-Kernels-tp5013319.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Morphological Segmentation of Distinct Parts of Corn Kernels

Cmhulbert
Thanks for the response, Curtis.

I did enable quite a few of the extra training features. I notice that it does help, but not as well as I would have liked. That being said, however, I also do not have a great grasp of the mathematical transformation that each feature applies to the picture. I read the Weka page on them, and used the ones I thought would be the most helpful, but again, I may have misunderstood some of the ones I opted out of.

Custom features seems like it would be helpful. Is there any timeline for when that will be implemented?

Best,
Caleb
Reply | Threaded
Open this post in threaded view
|

Re: Morphological Segmentation of Distinct Parts of Corn Kernels

Ignacio Arganda-Carreras-2
In reply to this post by ctrueden
Hello Caleb,

In general, the default features of Trainable Weka Segmentation are mostly
border detectors. You might want to try (as Curtis suggested) other
features that act like texture descriptors (minimum, maximum, median,
variance, etc). In principle, the default classifier (a random forest)
should be able to use the best (most informative) of all the features you
create.

Best,

ignacio

On Fri, Jun 26, 2015 at 6:53 PM, Curtis Rueden <[hidden email]> wrote:

> Hi Caleb,
>
> > I'm having difficulty when I try to separate parts of the kernels
> > themselves (the Embryo, the tip, and the rest of the kernel) from each
> > other.
>
> Did you enable the additional training features in the TWS's Settings
> dialog?
>
> If so, and that still didn't help: you could post an example image
> somewhere for others to try their hand.
>
> Note also that in the future, TWS will support custom features (as a type
> of ImageJ2 plugin), but this work is not yet complete. That sort of thing
> will eventually help solve use cases like yours though.
>
> Regards,
> Curtis
>
> On Fri, Jun 26, 2015 at 10:50 AM, Cmhulbert <[hidden email]> wrote:
>
> > Hi all,
> >
> > I have been playing around with ImageJ for a few weeks now, and have
> tried
> > various segmentation methods, with the goal in mind of eventually
> measuring
> > color values from kernels of corn. I have the kernels scanned in on a
> > regular house scanner, at 300dpi. I can easily segment the from each
> other,
> > and the background, with Weka Segmentation training, but I'm having
> > difficulty when I try to separate parts of the kernels themselves (the
> > Embryo, the tip, and the rest of the kernel) from each other. It seems
> like
> > the Weka Segmentation gives too much weight to the color
> > diferences/similarities, rather than the morphological differences  (such
> > as
> > the grainy tips, or the raised "crater-like" appeareance around the
> > embryo).
> > Does anyone have suggestions as to what settings in Weka I should use to
> > train for this? Or whether there is a better way to do this?
> >
> > Thanks,
> > Caleb
> >
> >
> >
> > --
> > View this message in context:
> >
> http://imagej.1557.x6.nabble.com/Morphological-Segmentation-of-Distinct-Parts-of-Corn-Kernels-tp5013319.html
> > Sent from the ImageJ mailing list archive at Nabble.com.
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
Ignacio Arganda-Carreras, Ph.D.
Institut Jean-Pierre Bourgin, UMR1318 INRA-AgroParisTech
Bâtiment 2
INRA Centre de Versailles-Grignon
Route de St-Cyr (RD10)
78026 Versailles Cedex France

Tel : +33 (0)1 30 83 30 00 - fax : +33 (0)1 30 83 33 19
Website: http://sites.google.com/site/iargandacarreras/
<http://biocomp.cnb.csic.es/~iarganda/index_EN.html>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Morphological Segmentation of Distinct Parts of Corn Kernels

Cmhulbert
Thanks Ignacio,

I did not realize that the random forest classifier worked that way, thanks for the explanation! Do you know if there would be any way for me to find out which training feature is the most informative? I only ask because the training and classifying takes quite a while between each iteration for me, and I was hoping to shorten the time it took by being a bit more picky with my feature selection.

Best,
Caleb
Reply | Threaded
Open this post in threaded view
|

Re: Morphological Segmentation of Distinct Parts of Corn Kernels

Cmhulbert
Also, to Curtis's suggestion, I'll upload a photo if anyone would like to try their hand at it. Ideally, it would be able to separate the Embryo, tip, and rest of the kernel for a kernel in any orientation, and of any color.

Each class being defined as:
Tip: the white pointed end of the kernel
Embryo: "Crater-like" oval(usually), only on one side of the kernel
Rest of the kernel: everything else.

Currently I have tried with four classes: each of the ones listed above, and a separate class for the background.

TestKernelImage.tif

Thanks in advance, if you give it a shot!

Best,
Caleb
Reply | Threaded
Open this post in threaded view
|

Re: Morphological Segmentation of Distinct Parts of Corn Kernels

Ignacio Arganda-Carreras-2
In reply to this post by Cmhulbert
Hello again, Caleb,

To see how informative each feature is, what you can do is to save your
traces (hopefully you have quite a few of each class) as an ARFF file
("Save Data" button) and load them into regular Weka. There you have
several options for feature selection (here you are a tutorial:
https://youtu.be/x5wa1w-BpRE).

This should tell you which features are more effective for your traning
samples so you can manually set them later in the Settings dialog.

One more thing, remember to check the "homogenize classes" options, it
always helps!

ignacio

On Fri, Jun 26, 2015 at 7:18 PM, Cmhulbert <[hidden email]> wrote:

> Thanks Ignacio,
>
> I did not realize that the random forest classifier worked that way, thanks
> for the explanation! Do you know if there would be any way for me to find
> out which training feature is the most informative? I only ask because the
> training and classifying takes quite a while between each iteration for me,
> and I was hoping to shorten the time it took by being a bit more picky with
> my feature selection.
>
> Best,
> Caleb
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Morphological-Segmentation-of-Distinct-Parts-of-Corn-Kernels-tp5013319p5013324.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
Ignacio Arganda-Carreras, Ph.D.
Institut Jean-Pierre Bourgin, UMR1318 INRA-AgroParisTech
Bâtiment 2
INRA Centre de Versailles-Grignon
Route de St-Cyr (RD10)
78026 Versailles Cedex France

Tel : +33 (0)1 30 83 30 00 - fax : +33 (0)1 30 83 33 19
Website: http://sites.google.com/site/iargandacarreras/
<http://biocomp.cnb.csic.es/~iarganda/index_EN.html>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Morphological Segmentation of Distinct Parts of Corn Kernels

Gabriel Landini
In reply to this post by Cmhulbert
On Friday 26 Jun 2015 10:18:17 Cmhulbert wrote:

> Also, to Curtis's suggestion, I'll upload a photo if anyone would like to
> try their hand at it. Ideally, it would be able to separate the Embryo,
> tip, and rest of the kernel for a kernel in any orientation, and of any
> color.
>
> Each class being defined as:
> Tip: the white pointed end of the kernel
> Embryo: "Crater-like" oval(usually), only on one side of the kernel
> Rest of the kernel: everything else.
>
> Currently I have tried with four classes: each of the ones listed above, and
> a separate class for the background.

Hi,
I just had a brief look at your image.The weka training is very interesting
and powerful in situations where it is not clear how to go about extracting
data. We are very lucky to be able to use it for images too, but in your case
you might also be able to extract the kernels with some other simpler method
by exploiting the characteristics of your image.
For example, it may be possible to extract the kernels relatively easily based
on colour, if the background were different.

Some of the kernels have a very similar grey colour as the background and will
be always difficult to extract because there is little contrast between a part
of the kernel and the background. I would suggest to try other background
colours, such as black rather than grey, or another dark colour that never
appears in the kernels (dark blue, dark green?).

Also your image seems to be jpeg compressed and then saved as tiff. If you
want to use colour information, the hue will be heavily quantised (you can see
that using the threshold color and change the hue dials, lots of blocky
artifacts appear).

Hope it helps

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Morphological Segmentation of Distinct Parts of Corn Kernels

Dimiter Prodanov (imec)
In reply to this post by Cmhulbert
Hello Caleb,

this is a quick try of anisotropic diffusion filtering on the red channel.
I don't know if this is an acceptable result because I am not familiar with your technical area.

best regards,

Dimiter Prodanov
________________________________________
From: Cmhulbert [[hidden email]]
Sent: 26 June 2015 17:50
Subject: Morphological Segmentation of Distinct Parts of Corn Kernels

Hi all,

I have been playing around with ImageJ for a few weeks now, and have tried
various segmentation methods, with the goal in mind of eventually measuring
color values from kernels of corn. I have the kernels scanned in on a
regular house scanner, at 300dpi. I can easily segment the from each other,
and the background, with Weka Segmentation training, but I'm having
difficulty when I try to separate parts of the kernels themselves (the
Embryo, the tip, and the rest of the kernel) from each other. It seems like
the Weka Segmentation gives too much weight to the color
diferences/similarities, rather than the morphological differences  (such as
the grainy tips, or the raised "crater-like" appeareance around the embryo).
Does anyone have suggestions as to what settings in Weka I should use to
train for this? Or whether there is a better way to do this?

Thanks,
Caleb



--
View this message in context: http://imagej.1557.x6.nabble.com/Morphological-Segmentation-of-Distinct-Parts-of-Corn-Kernels-tp5013319.html
Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

segmented1.tif (3M) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Morphological Segmentation of Distinct Parts of Corn Kernels

Cmhulbert
Hey Dimiter Prodanov,

That Actually does look really good for the Kernel segmentation from the background. My only issue from that point is how to correctly segment the Embryo from the rest of the Kernel. I'm trying to do color analysis, and the embryo is pretty much always a different color, and throws off the mean values. Do you think a better way to control for the embryo would be to look at an RGB histogram, and take out the more white areas? Also, do you know whats causing the noise in the background of the segmentation you ran?

Best,
Caleb
Reply | Threaded
Open this post in threaded view
|

Re: Morphological Segmentation of Distinct Parts of Corn Kernels

Dimiter Prodanov (imec)
In reply to this post by Cmhulbert
Hello Caleb,

May be you can look at the HSV color space if you noticed that brightness is a good separation criterion.

The noise in the edge detection comes from the image texture.

Best regards,

Dimiter

-----Original Message-----
From: Cmhulbert [mailto:[hidden email]]
Sent: Monday, June 29, 2015 6:59 PM
Subject: Re: Morphological Segmentation of Distinct Parts of Corn Kernels

Hey Dimiter Prodanov,

That Actually does look really good for the Kernel segmentation from the background. My only issue from that point is how to correctly segment the Embryo from the rest of the Kernel. I'm trying to do color analysis, and the embryo is pretty much always a different color, and throws off the mean values. Do you think a better way to control for the embryo would be to look at an RGB histogram, and take out the more white areas? Also, do you know whats causing the noise in the background of the segmentation you ran?

Best,
Caleb



--
View this message in context: http://imagej.1557.x6.nabble.com/Morphological-Segmentation-of-Distinct-Parts-of-Corn-Kernels-tp5013319p5013345.html
Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Morphological Segmentation of Distinct Parts of Corn Kernels

Cmhulbert
Interesting. Usually I don't get much by way of noise in the background when I segment. I can almost perfectly segment the kernels from the background, but the color is still skewed by the embryo. I'll look into the HSV color space. Thanks!

Best,
Caleb