Curvature estimation from image
Asked Answered
B

1

6

I have images like this ones:

enter image description here enter image description here enter image description here enter image description here

In this images the red line is what I want to get from the image. Original images do not have that red lines, but only that green road.

What I want is to estimate the curve from image in form of a coeffitients of equation: A x^2 + B x + C = 0. In images there can be noise (black holes on edges as you see above).

I have tried to solve this by using least squares method (LSM), but there are two problems with this approach:

  1. The method is too slow even on PC, because the points amount is high.

  2. The road is too wide in the following case:

The curve on the left image is correctly recognized, but on the right side incorrectly. The reason is that the road is too wide and too short, I suppose. enter image

As a solution for both cases I want to make the road narrow. In ideal case it is a red line in images above. Or I want to use LSM for line detection (A x + B = 0) for optimization of processing time.

I have tried eroding image - it is wrong approach. Skeleton also not the right solution.

Any ideas about how to achieve the desired result (make the road narrow)? Or any ideas of another approach for this problem?

Bagpipes answered 4/9, 2012 at 8:12 Comment(1)
Did you tried thinning ? At least as first step. Second could be LSM on thinned line (or on sampled points if there's too many of them). Or you may try to detect arcs and/or parabolas by using Hough transform.Lacasse
B
1

If you can rely on always having one axis as the dependent variable in your fit (looks like it should be the x axis in the above "correct" examples, although your bottom right failure seems to be using y), then you could do something like this:

  • for each scanline y, pick the median x of the non-black pixels
  • if there are no non-black pixels (or fewer than some chosen noise threshold), skip the line

You now have a list of (x,y) pairs, at most as many as there are scan lines. These represent guesses as to the midpoint of the road at each level. Fit a low order polynomial x=f(y) (I'd go for linear or cubic, but you could do quadratic if you prefer) to these points by least squares.

For the sorts of images you've shown, the detail is very coarse, so you might be able to manage with just a subset of points. But even without that the processing cost should be reasonable unless you're using very constrained hardware.

If left-right paths occur often then you could fit both ways and then apply some kind of goodness of fit criterion. If paths loop back on themselves often, then this sort of midpoint approach won't give you a good answer, but then you're onto a loser with the fitting anyway.

Burck answered 4/9, 2012 at 9:41 Comment(2)
Thanks. It is working quite fast, except sometimes it makes false lines, depending on how the road is oriented to the camera. It is because the calculation is done always line by line horizontally. And false calculations appear if the line does not start from the bottom of image, but partially starts from one side of it.Bagpipes
@Bagpipes Well, it's a hack. You might improve matters by being more selective about the points used for the fit - e.g., excluding rows that aren't bounded on both sides - but beyond that (or as an adjunct to it) I suspect you'll need to take a more model-based approach that introduces some prior knowledge about what the images represent.Burck

© 2022 - 2024 — McMap. All rights reserved.