Image Curvature Rating

I have images like these:

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

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

I want to evaluate the curve from the image as the equation coefficients: A x ^ 2 + B x + C = 0. There may be noise in the images (black holes at the edges, as you see above).

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

  • The method is too slow even on a PC, because the number of points is large.

  • The road is too wide in the following case:

The curve in the left image is correctly recognized, but wrong on the right side. 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. Ideally, this is the red line in the images above. Or I want to use LSM to determine the line (A x + B = 0) to optimize processing time.

I tried to blur the image - this is the wrong approach. The skeleton is also not the right solution.

Any ideas on how to achieve the desired result (make the road narrow)? Or any ideas for a different approach to this problem?

+6
source share
1 answer

If you can rely on always having one axis as the dependent variable in your fit (it looks like it should be the x axis in the above β€œright” examples, although your right right failure seems to use y ), then you can do that something like this:

  • for each scan line y select the median x non-black pixels
  • if there are no non-black pixels (or less than a certain selected noise threshold), skip the line

Now you have a list of pairs (x,y) , no more than the scan lines. They represent speculations about the middle of the road at each level. Set the low-order polynomial x=f(y) (I would go for linear or cubic, but you could make a quadratic if you want) to these points by least squares.

For the types of images that you showed, the detail is very rough, so you can only control a subset of the points. But even without this, the cost of processing should be reasonable if you are not using very limited equipment.

If paths are often found from left to right, you can fit in both directions, and then apply some quality factor. If the paths often return to themselves often, then a similar approach at the midpoint will not give you a good answer, but then you will still be a loser.

+1
source

Source: https://habr.com/ru/post/924511/


All Articles