Open chrisoffner opened 2 months ago
Hi there and thanks for writing.
The effect that you are seeing is not directly related to the rectification per se, but it's due to the affine transformation calculated by https://github.com/decadenza/DirectStereoRectification/blob/cdef75a7702705de5b96f7a84c88ae8073ccf989/rectification.py#L320
according to the scaling parameter.
The same couple of rectified images could be presented in different scales. The alpha
parameter is present also in cv2.stereoRectify()
but I think I am using a different default...
You may change the scaling parameter alpha
to obtain different scales. Try to run with alpha=0
or some other value between 0 and 1. Let me know.
Please note that this repository is a minimal reproducible example of the direct rectification algorithm presented in the paper (https://arxiv.org/pdf/2203.00123.pdf). For a more comprehensive stereo vision library (that includes the rectification), see https://github.com/decadenza/SimpleStereo
Contributions and maintainers are welcome.
Since the scaling function is different from OpenCV, you will always find differences between the two.
The getFittingMatrix
function may be improved...
For example, instead of taking only the 4 corners of each image like I am doing here https://github.com/decadenza/DirectStereoRectification/blob/cdef75a7702705de5b96f7a84c88ae8073ccf989/rectification.py#L408 one may consider all the image border and verify that fits inside the image frame.
When I run the
example.py
on my synthetic data using ground-truth extrinsics, I get rectified results that look stretched out horizontally.On this image you can see
cv2.stereoRectify
results in the second row,I'm mostly confused about why the DirectStereoRectification results look horizontally stretched compared to those by
stereoRectify
, as the latter seem to match the scene geometry more closely. Am I using something wrong here, or is this expected?