Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andijakl/9c5fec59b33073125dd8d5fb5d0aebd7 to your computer and use it in GitHub Desktop.
Save andijakl/9c5fec59b33073125dd8d5fb5d0aebd7 to your computer and use it in GitHub Desktop.
Perspective transformations applied to the source images. Full article for context and remaining code: https://www.andreasjakl.com/understand-and-apply-stereo-rectification-for-depth-maps-part-2/
# Undistort (rectify) the images and save them
# Adapted from: https://stackoverflow.com/a/62607343
img1_rectified = cv.warpPerspective(img1, H1, (w1, h1))
img2_rectified = cv.warpPerspective(img2, H2, (w2, h2))
cv.imwrite("rectified_1.png", img1_rectified)
cv.imwrite("rectified_2.png", img2_rectified)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment