How it works

We generate random points in the 3D space and project them into two test views. Then, we add noise to those observations and reconstruct points back in 3D using the OpenCV function cv2.triangulatePoints. As input, the function takes observations from two cameras and camera projection matrices (projective mapping from the world coordinate frame to a view coordinate frame) for each view. It returns the reconstructed points in the world coordinate frame.

The following are the possible results:

Original points [[ 0.48245686 -2.05779004 1.3458606 ] [-0.18333936 -1.00662899 -0.46047512] [-0.51193094 -0.54561883 0.20674749] [ 1.05258393 -1.55241323 0.60368073] [ 1.80103588 -0.83367926 -0.59293056]] Reconstructed points [[ 0.47777811 ...

Get OpenCV 3 Computer Vision with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.