OpenCV  3.4.4
Open Source Computer Vision
samples/cpp/tutorial_code/features2D/Homography/homography_from_camera_displacement.cpp

An example program about homography from the camera displacement

Check the corresponding tutorial for more details