Repository: opencv
Issue: recoverPose default arguments
Labels: category: calib3d

##### System information (version)

- OpenCV => 4.1.2
- Operating System / Platform => Ubuntu 18.04
- Python interpretor (3.6.9)
##### Detailed description

I am trying to perform ego-motion estimation. Once I have obtained my correspondence points, I use ```cv2.findEssentialMat``` followed by ```cv2.recoverPose```.

It is the arguments of ```cv2.recoverPose``` that I have a doubt it. When I just give ```cv2.recoverPose(E, kp1, kp2)```, without specifying the camera intrinsics, the code does not give any error, and runs.
However, looking at the function declaration of ```cv2.recoverPose```, it has the camera intrinsics as optional parameters. What is the use of this. In case I do not give camera intrinsics, what default values are chosen?

There were two things I noticed, upon running experiments with and without passing the cam intrinsics for ```cv2.recoverPose```. 
Details of the setup of the experiment: A camera mounted on a car (similar to KITTI dataset, if you are familiar with it). A video sequence of 1000 frames are obtained, I obtain feature correspondences for the sequential images. 

1. In the first case (no camera intrinsics passed), quite a lot of translation signs were reversed. Since my camera is mounted on a vehicle and there is always forward motion, I simply multiplied my translation by ```-1``` in case the forward motion is negative. While this is not a good way, for a start, it works.
2. The second bizarre thing that I noticed was that, when I passed my camera intrinsics, a lot less translation values were negative, so this must be a good thing, however, the trajectory is fairly incorrect, meaning it performs poorly compared to not passing the camera intrinsics values. Upon further inspection, I notice that the number of points that pass the cheirality check is zero or nearly zero, I wonder why that is happening. (In the first case where I did not pass the camera intrinsics, the number of points returned are a lot, and comparable to the number of inliers found in the previous step of finding Essential matrix i.e. in the order of 100s) 

Why is this happening? Any explanation would be appreciated. Should I pass the camera intrinsics to recover pose? In that case, why am I getting incorrect values?




##### Steps to reproduce

In the zip file, I've attached a minimal example, for 4 frames. 
[opencv_issue.zip](https://github.com/opencv/opencv/files/4844499/opencv_issue.zip)
My camera intrinsics:
```
            focal=349.9,
            pp=(335.3375, 199.2915),
```
For each pair of frames, ```pos_a``` is the ```i_i+1_left.npy``` while ```pos_b``` is the ```i_i+1_right.npy``` where ```pos_a``` and ```pos_b``` are the correspondence points.

For the first case, I obtain the essential matrix using 

` E, inliers = cv2.findEssentialMat( pos_b, pos_a, focal=349.9, pp=(335.3375, 199.2915), method=cv2.RANSAC,prob=0.99,threshold=0.5)`
followed by :
`points, R, t, _ = cv2.recoverPose(E, pos_b, pos_a,focal=349.9, pp=(335.3375, 199.2915), mask = inliers)`

The number of inliers after essential matrix, and no of points that pass cheirality check for each ```E``` are: (I have attached 3 sets of correspondences for 4 frames)
```
1994 38
2261 0
2010 46
```

In the second case, essential matrix formulation is the same:
` E, inliers = cv2.findEssentialMat( pos_b, pos_a, focal=349.9, pp=(335.3375, 199.2915), method=cv2.RANSAC,prob=0.99,threshold=0.5)`
but I do not pass any camera arguments arguments for recoverpose.

`points, R, t, _ = cv2.recoverPose(E, pos_b, pos_a, mask = inliers1)`

In this case, the number of inliers after essential matrix, and no of points that pass cheirality check for each ```E``` are:
```
1994 1992 
2261 2178 
2010 1495 
```
As you can see, the number of points that pass the cheirality check is quite large. When testing it over 3000 frames, the overall trajectory of the second case is much more accurate compared to the first one (after correcting for reverse translation). In the second case, I understand why I would get negative translation since ```decomposeMat``` gives 4 outputs, one for +ve translation and one for -ve translation (apologies for the abuse of terminology, but in my case, this fits)

Quite simply, what is the issue?


##### Issue submission checklist

 - [x] I report the issue, it's not a question
   <!--
   OpenCV team works with answers.opencv.org, Stack Overflow and other communities
   to discuss problems. Tickets with question without real issue statement will be
   closed.
   -->
 - [x] I checked the problem with documentation, FAQ, open issues,
       answers.opencv.org, Stack Overflow, etc and have not found solution
   <!--
   Places to check:
   * OpenCV documentation: https://docs.opencv.org
   * FAQ page: https://github.com/opencv/opencv/wiki/FAQ
   * OpenCV forum: https://answers.opencv.org
   * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
   * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
   -->
 - [x] I updated to latest OpenCV version and the issue is still there
   <!--
   master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
   OpenCV team supports only latest release for each branch.
   The ticket is closed, if the problem is not reproduced with modern version.
   -->
 - [x] There is reproducer code and related data files: videos, images, onnx, etc
   <!--
   The best reproducer -- test case for OpenCV that we can add to the library.
   Recommendations for media files and binary files:
   * Try to reproduce the issue with images and videos in opencv_extra repository
     to reduce attachment size
   * Use PNG for images, if you report some CV related bug, but not image reader
     issue
   * Attach the image as archite to the ticket, if you report some reader issue.
     Image hosting services compress images and it breaks the repro code.
   * Provide ONNX file for some public model or ONNX file with with random weights,
     if you report ONNX parsing or handling issue. Architecture details diagram
     from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
   -->