Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Epipolar geometry (compute fundamental matrix and show epipolar lines)
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Epipolar geometry demo: computing fundamental matrix with OpenCV"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'3.4.2'"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import cv2\n",
"cv2.__version__ # tested with version 3.4.2\n",
"# need to install opencv-contrib-python for sift to work"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [],
"source": [
"import cv2\n",
"import numpy as np\n",
"import io\n",
"import requests\n",
"from PIL import Image\n",
"from matplotlib import pyplot as plt\n",
"\n",
"\n",
"IMG_URL1='https://raw.githubusercontent.com/phsamuel/test-images/master/IMAG4627.jpg'\n",
"IMG_URL2='https://raw.githubusercontent.com/phsamuel/test-images/master/IMAG4628.jpg'\n",
"\n",
"# get images from the web\n",
"response = requests.get(IMG_URL1)\n",
"img_pil1 = Image.open(io.BytesIO(response.content))\n",
"\n",
"response = requests.get(IMG_URL2)\n",
"img_pil2 = Image.open(io.BytesIO(response.content))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### show images"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.