Is there a way to use lidar camera to detect surface slope?
Lidar
Hope I understand your question.
If so, you could use liar to measure distance (sceneDepth) of different points of the surface and compute slope from it.
The picture illustrates how in case you are facing the slope (means you want the slope in front of you):
Equations are:
- (1) l cos(α) + d2 cos(β) = d1
- (2) l sin(α) = d2 sin(β) => l = d2 sin(b) / sin(α)
Which gives form (1)
- cos(a) = (d1 - d2 cos(β)) / l = (d1 - d2 cos(β)) sin(α) / d2 sin(β)
And finally the angle we look for
- tan(α) = sin(α) / cos(α) = d2 sin(β) / (d1 - d2 cos(β))
You know d1 and d2 from lidar sceneDepth, you can get β by finding iPhone orientation.
That may also provide additional information:
I did some more computation, in case you are side facing the slope:
.
From top where we look at the slope by the side:
There is a relationship in a Triangle between sides and angles:
So, P1 and P2 being points selected on the surface along max slope direction:
- D D = d1 d1 + d2 d2 - 2 d1 d2 cos(δ)
- D = sqrt( d1 d1 + d2 d2 - 2 d1 d2 cos(δ))
We can know d1, d2 and δ, which is how much we rotate the phone from P1 target to P2 target .
Looking from a section perspective (bottom images)
- h = h1 + d1 sin(α) = h2 + d2 sin(β)
Hence
- (h1 - h2) = d2 sin(β) - d1 sin(α)
we can get iPhone orientation, hence α and β, as well as d1 and d2, hence h1 - h2 from above formula
slope is given by
- tan(slope) = (h1 - h2) / D = (d2 sin(β) - d1 sin(α)) / sqrt( d1 d1 + d2 d2 - 2 d1 d2 cos(δ))
The slope of an object surface can be calculated as below:
- Plane fitting to the LiDAR measurement points of the surface
- The slope is the ratio of horizontal/vertical of the plane normal.
The slope sign as shown in the attached picture is rendered based on:
- A gazing point on the object surface
- The surface normal at the gazing point.
The source codes for detecting and measuring the geometric primitives of planes, spheres, cylinders, cones, tori from LiDAR points are available.
The slope sign as shown in the previous answer is rendered based on:
- A gazing point on the object surface
- The surface normal at the gazing point
- The vertical (gravitational) direction.
Once, the shape, size, position, orientation of an object surface is known, there are a variety of applications.
YouTube CurvSurf, GitHub CurvSurf, FindSurface Web Demo.
The source code for AR overlaying/rendering virtual image/video around/on the real geometric object primitives extracted from the LiDAR point cloud is available.
#spatialcomputing #realtime #automation #robotics #ar #computervision #surface #fitting #pointcloud #curvature #differentialgeometry #linearalgebra #leastsquares #odf #orthogonaldistancefitting
How to accurately estimate in real-time the shape, size, position, rotation of an object surface from point cloud (measurement points) has been the Holy Grail of computer vision.
The run-time library is now available as a middleware of a file size of about 300 KB.
Locally differentiable surfaces can be classified as one of the 4 surface types:
- planar
- parabolic
- elliptic
- hyperbolic.
Most man-made object surfaces are composed of planes, spheres, cylinders, cones, and tori:
- Plane is planar
- Sphere is elliptic
- Cylinder is parabolic
- Cone is parabolic
- Torus is locally elliptic, hyperbolic, or parabolic (seldom).
Then, through the local curvature analysis of the point cloud measured, we can assume the local shape of the measurement object:
- Planar --> plane
- Parabolic --> cylinder or cone
- Elliptic --> sphere or torus
- Hyperbolic --> torus.
By investigating the shape parameters of cone (vertex angle) and torus (mean and tube radius) fitted to the point cloud measured, we can refine the object shape type between sphere, cylinder, cone, and torus.
After a successful cone fitting, we can recognize between cylinder and cone by investigating the vertex angle of the cone fitted.
After a successful torus fitting, we can recognize between sphere, cylinder and torus by investigating the tube radius and the mean radius of the torus fitted.