0

I am doing a project which is hole detection in road. I am using a laser to emit beam on the road and using a camera to take a image of the road. the image may be like this enter image description here

Now i want to process this image and give a result that is it straight or not. if it curve then how big the curve is. I dont understand how to do this. i have search a lot but cant find a appropriate result .Can any one help me for that?

hippietrail
  • 15,848
  • 18
  • 99
  • 158

4 Answers4

1

This is rather complicated and your question is very broad, but lets have a try:

  1. Perhaps you have to identify the dots in the pixel image. There are several options to do this, but I'd smoothen the image by a blur filter and then find the most red pixels (which are believed to be the centers of the dots). Store these coordinates in a vector array (array of x times y).

  2. I'd use a spline interpolation between the dots. This way one can simply get the local derivation of a curve touching each point.

  3. If the maximum of the first derivation is small, the dots are in a line. If you believe, the dots belong to a single curve, the second derivation is your curvature.

For 1. you may also rely on some libraries specialized in image processing (this is the image processing part of your challenge). One such a library is opencv.

For 2. I'd use some math toolkit, either octave or a math library for a native language.

urzeit
  • 2,863
  • 20
  • 36
1

There are several different ways of measuring the straightness of a line. Since your question is rather vague, it's impossible to say what will work best for you.

But here's my suggestion:

Use linear regression to calculate the best-fit straight line through your points, then calculate the mean-squared distance of each point from this line (straighter lines will give smaller results).

illustration showing distances of points from best-fit straight line

r3mainer
  • 23,981
  • 3
  • 51
  • 88
  • Note: The picture shows total linear regression, not "ordinary" linear regression. Disadvantage of this is that it doesn't take the "length" of the points along the line or the number of points into account properly, the way a sound statistical estimator like standard deviation or correlation does. – Niki Feb 20 '14 at 10:14
  • @nikie True, but the asker hasn't provided any concrete information about what these points actually represent, so we can only guess what approach will work best. – r3mainer Feb 20 '14 at 17:14
  • Exactly my point. We don't know much. So an unbiased estimator should be the default choice. A biased estimator *can* make sense, but it wouldn't be my first choice without any knowledge to justify it. – Niki Feb 20 '14 at 18:30
  • @nikie OK, point taken :-) – r3mainer Feb 20 '14 at 19:19
0

You may need to read this paper, it is so interesting one to solve your problem

Y.AL
  • 1,808
  • 13
  • 27
0

As @urzeit suggested, you should first find the points as accurately as possible. There's really no way to give good advice on that without seeing real pictures, except maybe: try to make the task as easy as possible for yourself. For example, if you can set the camera to a very short shutter time (microseconds, if possible) and concentrate the laser energy in the same time, the "background" will contribute less energy to the image brightness, and the laser spots will simply be bright spots on a dark background.

Measuring the linearity should be straightforward, though: "Linearity" is just a different word for "linear correlation". So you can simply calculate the correlation between X and Y values. As the pictures on linked wikipedia page show, correlation=1 means all points are on a line.

If you want the actual line, you can simply use Total Least Squares.

Niki
  • 15,662
  • 5
  • 48
  • 74