Connecting Two Nearby Edges

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

Connecting Two Nearby Edges

Jmale
Hello,

I am trying to measure two different particles of a very similar brightness
and have been attempting to do so by subtracting a canny edge detection
image from the original image in order to create a white barrier between
the two particles. However, the edge detected by the canny edge detector
does not completely split the two regions. Is there any program I can run
which will automatically connect nearby lines? For my purposes I cannot use
manual tools such as the pencil.

I have attached an image of the region I am talking about (circled in red)
and an image of what I want the image to look like (drawn in blue).

Thank you,
James

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

help region.png (2K) Download Attachment
help connected.png (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Connecting Two Nearby Edges

ctrueden
Hi James,

> Is there any program I can run which will automatically connect nearby
lines?

Morphological operations seem like your friends here. I'm no expert, but as
a first stab, you could Make Binary, Dilate a couple of times, then
Skeletonize. Here is the result on your sample:

[image: Inline image 1]

Note that in this case, it also skeletonized your red circle. ;-)

Regards,
Curtis


On Wed, Jun 11, 2014 at 12:35 PM, James Male <[hidden email]> wrote:

> Hello,
>
> I am trying to measure two different particles of a very similar brightness
> and have been attempting to do so by subtracting a canny edge detection
> image from the original image in order to create a white barrier between
> the two particles. However, the edge detected by the canny edge detector
> does not completely split the two regions. Is there any program I can run
> which will automatically connect nearby lines? For my purposes I cannot use
> manual tools such as the pencil.
>
> I have attached an image of the region I am talking about (circled in red)
> and an image of what I want the image to look like (drawn in blue).
>
> Thank you,
> James
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

help region-skeletonized.png (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Connecting Two Nearby Edges

Kenneth Sloan-2
In reply to this post by Jmale
In my opinion, this problem is just on the other side of
the classic dividing line between “image processing” and
“scene analysis”.  Almost always, “scene analysis” tends
to be very domain dependent and requires significantly different
data structures and processing than what is usually found
in ImageJ stuff.

When I need to do things like this, I make extensive use of
custom plugins which create a symbolic representation of the
features found by the image processing level…and then implement
custom algorithms which hardly ever go back to look at the
raw image (sometimes there is a “verification vision” step - but
less often than you might think).

So…I think the short answer is that you have gotten as far as you
can with vanilla ImageJ - and now you need to write some custom
programs, probably in Java.  These can still run as ImageJ plugins,
but they won’t look much like all the plugins you see in
the typical ImageJ tutorial.

Looking at your sample images, and your intended “correct answer”, I think
you need to define WHY the blue segments are added, but not similar-looking
(to my eye) extensions of other linear features in the image - say, for example,
the short line at 4 o’clock from the small circular figure.  These are the
kinds of decisions which usually depend crucially on domain-specific knowledge,
which makes it difficult to write a “general purpose” version of what you want.

If you are lucky, someone will now pipe up and embarrass me by pointing out
some existing ImageJ plugin that does precisely what you want.  For your
sake, I hope so.

--
Kenneth Sloan
[hidden email]


On Jun 11, 2014, at 12:35 , James Male <[hidden email]> wrote:

> Hello,
>
> I am trying to measure two different particles of a very similar brightness
> and have been attempting to do so by subtracting a canny edge detection
> image from the original image in order to create a white barrier between
> the two particles. However, the edge detected by the canny edge detector
> does not completely split the two regions. Is there any program I can run
> which will automatically connect nearby lines? For my purposes I cannot use
> manual tools such as the pencil.
>
> I have attached an image of the region I am talking about (circled in red)
> and an image of what I want the image to look like (drawn in blue).
>
> Thank you,
> James
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> <help region.png><help connected.png>

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

Re: Connecting Two Nearby Edges

Jmale
The blue lines are added to extend the actual boundary between two copper
grains of a similar orientation. I had to preform a rough edge detection
with a low threshold in order to get the edge to show up, and in the
process other small impurities around the boundary were detected as
"edges". It is my hope that, if I am able to actually separate these two
grains, I will be able to "include holes" in a particle analysis and ignore
the extra lines.

Kenneth, I think you may be right. I have yet to find any plugins that are
adequate for my purposes. I most likely will have to write something myself
or approach my problem in a different way. Unfortunately I have little
programming experience.

Thank you for the responses so far, Kenneth and Curtis!
James


On Wed, Jun 11, 2014 at 5:45 PM, Kenneth Sloan <[hidden email]>
wrote:

> In my opinion, this problem is just on the other side of
> the classic dividing line between “image processing” and
> “scene analysis”.  Almost always, “scene analysis” tends
> to be very domain dependent and requires significantly different
> data structures and processing than what is usually found
> in ImageJ stuff.
>
> When I need to do things like this, I make extensive use of
> custom plugins which create a symbolic representation of the
> features found by the image processing level…and then implement
> custom algorithms which hardly ever go back to look at the
> raw image (sometimes there is a “verification vision” step - but
> less often than you might think).
>
> So…I think the short answer is that you have gotten as far as you
> can with vanilla ImageJ - and now you need to write some custom
> programs, probably in Java.  These can still run as ImageJ plugins,
> but they won’t look much like all the plugins you see in
> the typical ImageJ tutorial.
>
> Looking at your sample images, and your intended “correct answer”, I think
> you need to define WHY the blue segments are added, but not similar-looking
> (to my eye) extensions of other linear features in the image - say, for
> example,
> the short line at 4 o’clock from the small circular figure.  These are the
> kinds of decisions which usually depend crucially on domain-specific
> knowledge,
> which makes it difficult to write a “general purpose” version of what you
> want.
>
> If you are lucky, someone will now pipe up and embarrass me by pointing out
> some existing ImageJ plugin that does precisely what you want.  For your
> sake, I hope so.
>
> --
> Kenneth Sloan
> [hidden email]
>
>
> On Jun 11, 2014, at 12:35 , James Male <[hidden email]> wrote:
>
> > Hello,
> >
> > I am trying to measure two different particles of a very similar
> brightness
> > and have been attempting to do so by subtracting a canny edge detection
> > image from the original image in order to create a white barrier between
> > the two particles. However, the edge detected by the canny edge detector
> > does not completely split the two regions. Is there any program I can run
> > which will automatically connect nearby lines? For my purposes I cannot
> use
> > manual tools such as the pencil.
> >
> > I have attached an image of the region I am talking about (circled in
> red)
> > and an image of what I want the image to look like (drawn in blue).
> >
> > Thank you,
> > James
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > <help region.png><help connected.png>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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