<commit_before>---
layout: post
title: "HomographyNet: Deep Image Homography Estimation"
description: "A deep convolutional neural network for estimating the relative homography between a pair of images."
category: 
comments: true
update_date: 2017-02-22
tags: [Deep Learning, Homography, Computer Vision]
---

## Introduction

Today we are going to talk about a paper I read a month ago titled [Deep Image Homography Estimation](https://arxiv.org/abs/1606.03798). It is a paper that presents a deep convolutional neural network for estimating the relative homography between a pair of images.

### _What is a Homography?_

> In projective geometry, a homography is an isomorphism of projective spaces, induced by an isomorphism of the vector spaces from which the projective spaces derive. - [Wikipedia](https://en.wikipedia.org/wiki/Homography)

If you understood that, go ahead and skip directly to the deep learning model discussion. For the rest of us, let's go ahead and learn some terminology. If you can forget about that definition from Wikipedia for a second, let's use some anologies to at least get a high-level idea.

### Isomorphism?
If you decide to bake a cake; the process of taking the ingredients and following the recipe to create the cake could be seen as morphing. The recipe allowed you to morph/transition from ingredients to a cake. If you're thinking wtf, just stick with me a bit longer. Now, imagine the same recipe could allow you to take a cake and morph/transition back to the ingredients if you follow it in reverse! In a nutshell, that is the definition of an isomorphism. A recipe that can allow you to transition between the two, loosely speaking. 

> Isomorphism in mathematics is morphism or a mapping (recipe) that can also give you the inverse, again loosely speaking.

### Projective geometry?
I don't have a clever analogy here, but I'll give you a simple example to tie it all together. Imagine you're driving and your dash cam snapped a picture of the road in front of you (let's call this pic `A`); at the same time, imagine there was a drone right above you and it also took a picture of the road in front of you (let's call this pic `B`). You can see that pic `A` and `B` are related, but how? They're both pictures of the road in front you, only difference is the perspective! The big question....

**_Is there a recipe/isomorphism that can take you from `A` to `B` and vice versa?_**

There you go, the question you just asked is what a Homography tries to answer. Homography is an isomorphism of perspectives. A 2D homography between `A` and `B` would give you the projection transformation between the two images! It is a 3x3 matrix that descibes the affine transformation. Entire books are written on these concepts, but hopefully we now have the general idea to continue.

### _NOTE_
There are some constraints about a homography I have not mention such as:

1. Usually both images are taken from the same camera.
2. Both images should be viewing the same plane. 

## Motivation

### _Where is homography used?_

To name a few, the homography is an essential part of the following

* Creating panoramas
* Monocular SLAM
* 3D image reconstruction
* Camera calibration 
* Augmented Reality
* Autonomous Cars

### _How do you get the homography?_

In traditional computer vision, the homography estimation process is done in two stages.

1. Corner estimation<commit_msg>fixed some typos<commit_after>---
layout: post
title: "HomographyNet: Deep Image Homography Estimation"
description: "A deep convolutional neural network for estimating the relative homography between a pair of images."
category: 
comments: true
update_date: 2017-02-22
tags: [Deep Learning, Homography, Computer Vision]
---

## Introduction

Today we are going to talk about a paper I read a month ago titled [Deep Image Homography Estimation](https://arxiv.org/abs/1606.03798). It is a paper that presents a deep convolutional neural network for estimating the relative homography between a pair of images.

### _What is a Homography?_

> In projective geometry, a homography is an isomorphism of projective spaces, induced by an isomorphism of the vector spaces from which the projective spaces derive. - [Wikipedia](https://en.wikipedia.org/wiki/Homography)

If you understood that, go ahead and skip directly to the deep learning model discussion. For the rest of us, let's go ahead and learn some terminology. If you can forget about that definition from Wikipedia for a second, let's use some anologies to at least get a high-level idea.

### Isomorphism?
If you decide to bake a cake; the process of taking the ingredients and following the recipe to create the cake could be seen as morphing. The recipe allowed you to morph/transition from ingredients to a cake. If you're thinking wtf, just stick with me a bit longer. Now, imagine the same recipe could allow you to take a cake and morph/transition back to the ingredients if you follow it in reverse! In a nutshell, that is the definition of an isomorphism. A recipe that can allow you to transition between the two, loosely speaking. 

> Isomorphism in mathematics is morphism or a mapping (recipe) that can also give you the inverse, again loosely speaking.

### Projective geometry?
I don't have a clever analogy here, but I'll give you a simple example to tie it all together. Imagine you're driving and your dash cam snapped a picture of the road in front of you (let's call this pic `A`); at the same time, imagine there was a drone right above you and it also took a picture of the road in front of you (let's call this pic `B`). You can see that pic `A` and `B` are related, but how? They're both pictures of the road in front you, only difference is the perspective! The big question....

**_Is there a recipe/isomorphism that can take you from `A` to `B` and vice versa?_**

There you go, the question you just asked is what a Homography tries to answer. Homography is an isomorphism of perspectives. A 2D homography between `A` and `B` would give you the projection transformation between the two images! It is a 3x3 matrix that descibes the affine transformation. Entire books are written on these concepts, but hopefully we now have the general idea to continue.

### _NOTE_
There are some constraints about a homography I have not mentioned such as:

1. Usually both images are taken from the same camera.
2. Both images should be viewing the same plane. 

## Motivation

### _Where is homography used?_

To name a few, the homography is an essential part of the following

* Creating panoramas
* Monocular SLAM
* 3D image reconstruction
* Camera calibration 
* Augmented Reality
* Autonomous Cars

### _How do you get the homography?_

In traditional computer vision, the homography estimation process is done in two stages.

1. Corner estimation
{'fraction_non_alphanumeric': 0.0523162355691948, 'fraction_numerical': 0.0070144673388864535, 'mean_word_length': 4.384736428009441, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4441783', 'n_tokens_mistral': 1768, 'n_tokens_neox': 1641, 'n_words': 1081}