Epipolar geometry demo: computing fundamental matrix with OpenCV

In [38]:
import cv2
cv2.__version__  # tested with version 3.4.2
# need to install opencv-contrib-python for sift to work
Out[38]:
'3.4.2'
In [39]:
import cv2
import numpy as np
import io
import requests
from PIL import Image
from matplotlib import pyplot as plt


IMG_URL1='https://raw.githubusercontent.com/phsamuel/test-images/master/IMAG4627.jpg'
IMG_URL2='https://raw.githubusercontent.com/phsamuel/test-images/master/IMAG4628.jpg'

# get images from the web
response = requests.get(IMG_URL1)
img_pil1 = Image.open(io.BytesIO(response.content))

response = requests.get(IMG_URL2)
img_pil2 = Image.open(io.BytesIO(response.content))

show images

In [40]:
img_pil1
Out[40]: