First image pair is greatly affect the result of structure from motion pipeline. First image pair should have as many matching feature keypoints as possible and the repartition of the corresponding features in each image. But at the same time, the baseline or angle between cameras should also be large enough to provide reliable geometric information. In my experience, we can choose first image pair manually and put it on the first position of dataset. As the images below, we have 5 type of image pairs:
Two cameras have same location and same direction but different field of view. This view pair position is not able to be used for reconstructing 3d points but it's able to be used for estimates the intrinsic params. this view pair is also called "pure rotation".
Two cameras have same location and same field of view but different direction. This view pair position is able to be used for reconstructing 3d points but the 3d points have very low quality.
Two cameras have same direction and same field of view but different location. This view pair position is good to be used for reconstructing 3d points. It's the most popular position when the cameras move in the straight direction
Two cameras have different location, different direction and same field of view. This view pair position is the best to be used for reconstructing 3d points. It has large baseline between cameras, the cameras also have enough feature points for reconstruct reliable 3d point cloud.
To run code we have to change the img_dir = '../vkist2/' to your image direction and run the sfm.py file
python sfm.py