You need to apply matcher (e.g. cv FlannMatcher) to determine which key points in both images correspond to the same point.
Then with pair matches, you should apply cv :: findHomography () . This algorithm will use 4 pairs of pairs to extract the homography matrix.
The last step ( some code here ) is to convert from a homography matrix to a matrix pose (external parameter matrix). The pose matrix consists of rotation and translation.
source share