Simulating stereo vision using VTK


Suppose I want to use VTK to simulate a stereo vision system composed of a
line laser and a camera. The laser is capable of projecting a uniform line
beam onto some 3D geometry, which I have in the form of an STL file. The
camera is located somewhere next to the laser and captures the light that is
reflected from the surface. The result is a 2D image where the intersection
between the laser beam and the 3d geometry is highlighted. Based on this
image I would like to test various algorithms.

My question is: Does VTK have tools that are suitable for this task?

Best regards,

I wouldnt know how to realize this with vtk, but if there is a way I would also be very interested

You can use the slice filter with the plane defined by the laser beam:

Is this what you are looking for?

1 Like

Awesome. Can you post a code snippet?

I have generated this with ParaView but in VTK, you have to use vtkCutter using a vtkPlane as implicit function. The output is a polydata containing the contour (a polyline) of the initial surface. Create two actors for both the initial surface and the contour (set color to red and line width to 3) and that’s basically it.
The plane equation can be computed based on the vtkCamera parameters.

@Michael, looks exactly like the solution I was searching for.

Thank you for the help.

/ abaldur