Ask Your Question
0

Merge Two Closely Overlapping Contours

asked 2018-06-17 05:10:17 -0600

abeltan13 gravatar image

Hi,

Say I have these two shapes,

image description

They can be represented by contours. I have identified the contour points that are close together. I want to merge them if their edges are close together.

How do I create another contour path that represents the merged shape?

image description

I have tried convex_hull on the concatenation of the two paths, but that only works on convex shapes!

Is there any algorithm that works on concave shapes?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2018-06-17 05:49:31 -0600

LBerger gravatar image

updated 2018-06-17 15:24:49 -0600

Try :

  1. Fill contours
  2. dilate image (may be N=10 iterations)
  3. erode image (N iterations)
  4. findContours

I hope that you will get only one contour

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-06-17 05:10:17 -0600

Seen: 8,572 times

Last updated: Jun 17 '18