4

I am trying to find edges in an image that have a certain curvature: the lighter side of the edge should be the convex side.

The edges itself are no problem with sobel or canny, but I do not know how to check the curvature.

some examples: I want to find the green border, not the red one

enter image description here -----> enter image description here

enter image description here -----> enter image description here

HugoRune
  • 13,157
  • 7
  • 69
  • 144

2 Answers2

4

If I understand your requirement correctly you want to find edges which are curved and which, on their convex side, 'enclose' a light region of the diagram ?

I translate your requirement into:

A curve is accepted if any straight line drawn between two points on the curve lies entirely within a light region of the diagram.

That should be fairly straightforward to implement. If the curves comprise many points checking every straight line between each pair of points will be extremely tedious, but you might be satisfied with checking enough straight lines.

But you'll have to define what enough is for yourself.

If, as OP has commented, a curve may include segments which meet the requirement and segments which don't and they are to be separated into a compliant curve and a non-compliant curve, this approach should be adaptable though I can see the processing becoming quite onerous as the number of lines used to check for convexity becomes large.

High Performance Mark
  • 77,191
  • 7
  • 105
  • 161
2

If you extract the geometry of the edge as an ordered sequence of points you can identify which sections of the sequence you want by considering 3 successive points A-B-C. If C lies on the same side of the line A-B as the lighter region, then A-B-C are part of the desired curve, and you can go on to consider B-C-D, and so on until you either find that C is on the wrong side of A-B or you arrive back at the start of the sequence.

This will avoid the false-negative problem with High Performance Mark's solution where the test line segments encounter a dark region not connected with the current curve.

Community
  • 1
  • 1
ryanm
  • 2,979
  • 18
  • 22