How to close contours once edges have been detected

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to close contours once edges have been detected

goombainator
Hi,

I am working on images that contain a rod-like shape (horizontal, over the width of the image). The intent is to extract the rod from the background and generate a binary image for morphology study of the rod. The rods are never the same, i.e. their horizontal position, angle and even outline can vary.


The background is extracted using an edge detection method (the background is far and out of focus). We use edge detection techniques for this. The image generated contains the major edges of the rod (white), including the outline and other details of the rod. Some areas of low energy on the rod stay black, i.e. the rod appears as if it had holes in it. This is the issue.


The rod needs to be fully identified (all pixels belonging to the rod are white). To fix this issue, we have done several erode/dilate step, which fill most holes, but this tends to remove important details on the outline of the rod.
If we increase the sensitivity of the edge detection algorithm, we get less holes on the rod, though we start picking up details of the background.


Could anyone suggest improvements to this method?


Most often the rod also has different intensities than the background (some exceptions though). We have tried a method that consists of using a mask generated from the edge detection to identify the intensities of the rod. The intensity method allows filling the holes in the rod (logical or with the edge method), though it also tends to add background details close to the outline of the rod...

Do you see a better way to extract a rod shape-like object from the background?

Thank you in advance,
Goomba



Reply | Threaded
Open this post in threaded view
|

Re: How to close contours once edges have been detected

goombainator
Hi,

Anybody willing to help with this issue?

Thanks,
Goomba


--- In [hidden email], "goombainator" <goombainatorman@...> wrote:

>
> Hi,
>
> I am working on images that contain a rod-like shape (horizontal, over the width of the image). The intent is to extract the rod from the background and generate a binary image for morphology study of the rod. The rods are never the same, i.e. their horizontal position, angle and even outline can vary.
>
>
> The background is extracted using an edge detection method (the background is far and out of focus). We use edge detection techniques for this. The image generated contains the major edges of the rod (white), including the outline and other details of the rod. Some areas of low energy on the rod stay black, i.e. the rod appears as if it had holes in it. This is the issue.
>
>
> The rod needs to be fully identified (all pixels belonging to the rod are white). To fix this issue, we have done several erode/dilate step, which fill most holes, but this tends to remove important details on the outline of the rod.
> If we increase the sensitivity of the edge detection algorithm, we get less holes on the rod, though we start picking up details of the background.
>
>
> Could anyone suggest improvements to this method?
>
>
> Most often the rod also has different intensities than the background (some exceptions though). We have tried a method that consists of using a mask generated from the edge detection to identify the intensities of the rod. The intensity method allows filling the holes in the rod (logical or with the edge method), though it also tends to add background details close to the outline of the rod...
>
> Do you see a better way to extract a rod shape-like object from the background?
>
> Thank you in advance,
> Goomba
>


Reply | Threaded
Open this post in threaded view
|

Re: How to close contours once edges have been detected

Jean-Pierre Landry
Well it's difficult to assess your situation without seeing the actual
images...  Are your rod mostly rectangular ???  You might try to detect
their contours using cvHoughLines2 to get the outer contours excluding
some small 'holes' in them ?

Good luck!

goombainator wrote:

> Hi,
>
> Anybody willing to help with this issue?
>
> Thanks,
> Goomba
>
>
> --- In [hidden email], "goombainator" <goombainatorman@...> wrote:
>> Hi,
>>
>> I am working on images that contain a rod-like shape (horizontal, over the width of the image). The intent is to extract the rod from the background and generate a binary image for morphology study of the rod. The rods are never the same, i.e. their horizontal position, angle and even outline can vary.
>>
>>
>> The background is extracted using an edge detection method (the background is far and out of focus). We use edge detection techniques for this. The image generated contains the major edges of the rod (white), including the outline and other details of the rod. Some areas of low energy on the rod stay black, i.e. the rod appears as if it had holes in it. This is the issue.
>>
>>
>> The rod needs to be fully identified (all pixels belonging to the rod are white). To fix this issue, we have done several erode/dilate step, which fill most holes, but this tends to remove important details on the outline of the rod.
>> If we increase the sensitivity of the edge detection algorithm, we get less holes on the rod, though we start picking up details of the background.
>>
>>
>> Could anyone suggest improvements to this method?
>>
>>
>> Most often the rod also has different intensities than the background (some exceptions though). We have tried a method that consists of using a mask generated from the edge detection to identify the intensities of the rod. The intensity method allows filling the holes in the rod (logical or with the edge method), though it also tends to add background details close to the outline of the rod...
>>
>> Do you see a better way to extract a rod shape-like object from the background?
>>
>> Thank you in advance,
>> Goomba
>>
>
>
>
>
> ------------------------------------
>
> Change settings: http://www.yahoogroups.com/mygroups, select
>    Get Emails (get all posts)
>    Daily Digest (one summary email per day)
>    Read on the web (read posts on the web only)Or Unsubscribe by mailing [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to close contours once edges have been detected

sateesh-4
You can try using snakes/gradient vector flow algo to get the outer contour and the inner holes as well. Then based on the position of the contour, if iniside fill it with black color.

sateesh.

--- In [hidden email], Jean-Pierre Landry <jplandry@...> wrote:

>
> Well it's difficult to assess your situation without seeing the actual
> images...  Are your rod mostly rectangular ???  You might try to detect
> their contours using cvHoughLines2 to get the outer contours excluding
> some small 'holes' in them ?
>
> Good luck!
>
> goombainator wrote:
> > Hi,
> >
> > Anybody willing to help with this issue?
> >
> > Thanks,
> > Goomba
> >
> >
> > --- In [hidden email], "goombainator" <goombainatorman@> wrote:
> >> Hi,
> >>
> >> I am working on images that contain a rod-like shape (horizontal, over the width of the image). The intent is to extract the rod from the background and generate a binary image for morphology study of the rod. The rods are never the same, i.e. their horizontal position, angle and even outline can vary.
> >>
> >>
> >> The background is extracted using an edge detection method (the background is far and out of focus). We use edge detection techniques for this. The image generated contains the major edges of the rod (white), including the outline and other details of the rod. Some areas of low energy on the rod stay black, i.e. the rod appears as if it had holes in it. This is the issue.
> >>
> >>
> >> The rod needs to be fully identified (all pixels belonging to the rod are white). To fix this issue, we have done several erode/dilate step, which fill most holes, but this tends to remove important details on the outline of the rod.
> >> If we increase the sensitivity of the edge detection algorithm, we get less holes on the rod, though we start picking up details of the background.
> >>
> >>
> >> Could anyone suggest improvements to this method?
> >>
> >>
> >> Most often the rod also has different intensities than the background (some exceptions though). We have tried a method that consists of using a mask generated from the edge detection to identify the intensities of the rod. The intensity method allows filling the holes in the rod (logical or with the edge method), though it also tends to add background details close to the outline of the rod...
> >>
> >> Do you see a better way to extract a rod shape-like object from the background?
> >>
> >> Thank you in advance,
> >> Goomba
> >>
> >
> >
> >
> >
> > ------------------------------------
> >
> > Change settings: http://www.yahoogroups.com/mygroups, select
> >    Get Emails (get all posts)
> >    Daily Digest (one summary email per day)
> >    Read on the web (read posts on the web only)Or Unsubscribe by mailing [hidden email]
>


Reply | Threaded
Open this post in threaded view
|

Re: How to close contours once edges have been detected

goombainator
In reply to this post by Jean-Pierre Landry
Hi Jean-Pierre,

Thank you for the advice. The rods are mostly rectangular, however they can appear to have big dents on them. this is what we are looking for. The contours then appears similar to a mountain landscape, that is with valleys and summits, with contours of high curvature.

I took a look at cvHoughLines2 which would help retrieving the contour of typical rods, though it would not work when the rods have non uniform edges. Unless the method can be used to retreive the contour by approximating every edge change as a line... I guess the method would then lose its purpose.

Please let me know if I am missing anything.

Goomba


--- In [hidden email], Jean-Pierre Landry <jplandry@...> wrote:

>
> Well it's difficult to assess your situation without seeing the actual
> images...  Are your rod mostly rectangular ???  You might try to detect
> their contours using cvHoughLines2 to get the outer contours excluding
> some small 'holes' in them ?
>
> Good luck!
>
> goombainator wrote:
> > Hi,
> >
> > Anybody willing to help with this issue?
> >
> > Thanks,
> > Goomba
> >
> >
> > --- In [hidden email], "goombainator" <goombainatorman@> wrote:
> >> Hi,
> >>
> >> I am working on images that contain a rod-like shape (horizontal, over the width of the image). The intent is to extract the rod from the background and generate a binary image for morphology study of the rod. The rods are never the same, i.e. their horizontal position, angle and even outline can vary.
> >>
> >>
> >> The background is extracted using an edge detection method (the background is far and out of focus). We use edge detection techniques for this. The image generated contains the major edges of the rod (white), including the outline and other details of the rod. Some areas of low energy on the rod stay black, i.e. the rod appears as if it had holes in it. This is the issue.
> >>
> >>
> >> The rod needs to be fully identified (all pixels belonging to the rod are white). To fix this issue, we have done several erode/dilate step, which fill most holes, but this tends to remove important details on the outline of the rod.
> >> If we increase the sensitivity of the edge detection algorithm, we get less holes on the rod, though we start picking up details of the background.
> >>
> >>
> >> Could anyone suggest improvements to this method?
> >>
> >>
> >> Most often the rod also has different intensities than the background (some exceptions though). We have tried a method that consists of using a mask generated from the edge detection to identify the intensities of the rod. The intensity method allows filling the holes in the rod (logical or with the edge method), though it also tends to add background details close to the outline of the rod...
> >>
> >> Do you see a better way to extract a rod shape-like object from the background?
> >>
> >> Thank you in advance,
> >> Goomba
> >>
> >
> >
> >
> >
> > ------------------------------------
> >
> > Change settings: http://www.yahoogroups.com/mygroups, select
> >    Get Emails (get all posts)
> >    Daily Digest (one summary email per day)
> >    Read on the web (read posts on the web only)Or Unsubscribe by mailing [hidden email]
>


Reply | Threaded
Open this post in threaded view
|

Re: How to close contours once edges have been detected

Jean-Pierre Landry
It's always a bit difficult to try to come up with proper algorithms
without seeing the actual images... :-)

I would guess that HoughLines would be successfull if you had few dents
limited to a small portion of the rectangular contour of your rods...

Maybe you could try with cvFindCountours followed by cvApproxPoly to get
the actual rectangular approximation ???  Maybe cvConvexHull2 might be
useful in this case ???

Again I'm not sure what your dented rods look like, so I'm just
guessing/throwing ideas for you to check...  :-)


goombainator wrote:

> Hi Jean-Pierre,
>
> Thank you for the advice. The rods are mostly rectangular, however they can appear to have big dents on them. this is what we are looking for. The contours then appears similar to a mountain landscape, that is with valleys and summits, with contours of high curvature.
>
> I took a look at cvHoughLines2 which would help retrieving the contour of typical rods, though it would not work when the rods have non uniform edges. Unless the method can be used to retreive the contour by approximating every edge change as a line... I guess the method would then lose its purpose.
>
> Please let me know if I am missing anything.
>
> Goomba
>
>
> --- In [hidden email], Jean-Pierre Landry <jplandry@...> wrote:
>> Well it's difficult to assess your situation without seeing the actual
>> images...  Are your rod mostly rectangular ???  You might try to detect
>> their contours using cvHoughLines2 to get the outer contours excluding
>> some small 'holes' in them ?
>>
>> Good luck!
>>
>> goombainator wrote:
>>> Hi,
>>>
>>> Anybody willing to help with this issue?
>>>
>>> Thanks,
>>> Goomba
>>>
>>>
>>> --- In [hidden email], "goombainator" <goombainatorman@> wrote:
>>>> Hi,
>>>>
>>>> I am working on images that contain a rod-like shape (horizontal, over the width of the image). The intent is to extract the rod from the background and generate a binary image for morphology study of the rod. The rods are never the same, i.e. their horizontal position, angle and even outline can vary.
>>>>
>>>>
>>>> The background is extracted using an edge detection method (the background is far and out of focus). We use edge detection techniques for this. The image generated contains the major edges of the rod (white), including the outline and other details of the rod. Some areas of low energy on the rod stay black, i.e. the rod appears as if it had holes in it. This is the issue.
>>>>
>>>>
>>>> The rod needs to be fully identified (all pixels belonging to the rod are white). To fix this issue, we have done several erode/dilate step, which fill most holes, but this tends to remove important details on the outline of the rod.
>>>> If we increase the sensitivity of the edge detection algorithm, we get less holes on the rod, though we start picking up details of the background.
>>>>
>>>>
>>>> Could anyone suggest improvements to this method?
>>>>
>>>>
>>>> Most often the rod also has different intensities than the background (some exceptions though). We have tried a method that consists of using a mask generated from the edge detection to identify the intensities of the rod. The intensity method allows filling the holes in the rod (logical or with the edge method), though it also tends to add background details close to the outline of the rod...
>>>>
>>>> Do you see a better way to extract a rod shape-like object from the background?
>>>>
>>>> Thank you in advance,
>>>> Goomba
>>>>
>>>
>>>
>>>
>>> ------------------------------------
>>>
>>> Change settings: http://www.yahoogroups.com/mygroups, select
>>>    Get Emails (get all posts)
>>>    Daily Digest (one summary email per day)
>>>    Read on the web (read posts on the web only)Or Unsubscribe by mailing [hidden email]
>
>
>
>
> ------------------------------------
>
> Change settings: http://www.yahoogroups.com/mygroups, select
>    Get Emails (get all posts)
>    Daily Digest (one summary email per day)
>    Read on the web (read posts on the web only)Or Unsubscribe by mailing [hidden email]