Skip to content

Instantly share code, notes, and snippets.

@andijakl
Created November 23, 2020 12:15
Show Gist options
  • Save andijakl/27c68a3a48c9ad4675df829dc81834fe to your computer and use it in GitHub Desktop.
Save andijakl/27c68a3a48c9ad4675df829dc81834fe to your computer and use it in GitHub Desktop.
Part 1: load and draw the original images for stereo rectification
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
# Read both images and convert to grayscale
img1 = cv.imread('left_img.png', cv.IMREAD_GRAYSCALE)
img2 = cv.imread('right_img.png', cv.IMREAD_GRAYSCALE)
# ------------------------------------------------------------
# PREPROCESSING
# Compare unprocessed images
fig, axes = plt.subplots(1, 2, figsize=(15, 10))
axes[0].imshow(img1, cmap="gray")
axes[1].imshow(img2, cmap="gray")
axes[0].axhline(250)
axes[1].axhline(250)
axes[0].axhline(450)
axes[1].axhline(450)
plt.suptitle("Original images")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment