floodFill for dotted lines

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

floodFill for dotted lines

Dora Szasz
Hello,

I want to segment a section surrounded by dotted lines. The dotted lines are close to each other, but the usual floodFill function is not able to think at this region as an enclosed region.

Have you done this before?

Thank you a lot,

Dora

Reply | Threaded
Open this post in threaded view
|

Re: floodFill for dotted lines

Francisco Ares
On Fri, Jan 6, 2012 at 6:24 AM, Dora <[hidden email]> wrote:

> **
>
>
> Hello,
>
> I want to segment a section surrounded by dotted lines. The dotted lines
> are close to each other, but the usual floodFill function is not able to
> think at this region as an enclosed region.
>
> Have you done this before?
>
> Thank you a lot,
>
> Dora
>

As a suggestion to try, you may copy the original image to a temporary one,
dilate it as many iterations as needed to close the dotted lines, then
erode it that many iterations, locate the contours, choose the one you
need, then draw the contour on the original image.

All of those functions are documented here:

http://opencv.itseez.com/modules/imgproc/doc/imgproc.html

Hope this helps
Francisco
---
"If you have an apple and I have an apple and we exchange apples then you
and I will still each have one apple. But if you have an idea and I have
one idea and we exchange these ideas, then each of us will have two ideas."
- George Bernard Shaw
Reply | Threaded
Open this post in threaded view
|

Re: floodFill for dotted lines

Francisco Ares
On Sat, Jan 7, 2012 at 9:48 AM, Francisco Ares <[hidden email]> wrote:

> On Fri, Jan 6, 2012 at 6:24 AM, Dora <[hidden email]> wrote:
>
>> **
>>
>>
>> Hello,
>>
>> I want to segment a section surrounded by dotted lines. The dotted lines
>> are close to each other, but the usual floodFill function is not able to
>> think at this region as an enclosed region.
>>
>> Have you done this before?
>>
>> Thank you a lot,
>>
>> Dora
>>
>
> As a suggestion to try, you may copy the original image to a temporary
> one, dilate it as many iterations as needed to close the dotted lines, then
> erode it that many iterations, locate the contours, choose the one you
> need, then draw the contour on the original image.
>
> All of those functions are documented here:
>
> http://opencv.itseez.com/modules/imgproc/doc/imgproc.html
>
> Hope this helps
> Francisco
>


Or you may find all contours on the original image, filter the contours of
the dots by their geometry (area, convexity, hull, ...), then create a new
contour based on the centroids of those contours, and then draw this
contour. All of those functions still on the same documentation page.

Francisco
--
"If you have an apple and I have an apple and we exchange apples then you
and I will still each have one apple. But if you have an idea and I have
one idea and we exchange these ideas, then each of us will have two ideas."
- George Bernard Shaw