Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Commit

Permalink
Regorganized
Browse files Browse the repository at this point in the history
  • Loading branch information
kcparashar committed Mar 20, 2016
0 parents commit 967b5b6
Show file tree
Hide file tree
Showing 163 changed files with 25,556 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Directories
documentation
*.tif
*.jpg

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/
30 changes: 30 additions & 0 deletions autopanaroma/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Author
Krishna Parashar

## Project
CS194-26 Computational Photography Project 7


## Contents of This Folder

- README.txt
This file.

- manual.py
All the code needed for Part A

- automatic.py
All the code needed to run the additional Part B stuff.

- main.py
This files hosts all the calls to the different function stored in the other files for each part. All configurable are in this file.


- /data
All images used in for this project are sourced from this directory. Configurable in main.py.

- /results
All resulting images from all parts of this project are put in this directory. Configurable in main.py,


## Notes
6 changes: 6 additions & 0 deletions autopanaroma/data/campanile/1_2_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
3.120000000000000000e+02 5.750000000000000000e+02
1.130000000000000000e+02 5.730000000000000000e+02
3.410000000000000000e+02 4.800000000000000000e+02
3.720000000000000000e+02 4.820000000000000000e+02
4.430000000000000000e+02 3.670000000000000000e+02
4.670000000000000000e+02 3.670000000000000000e+02
6 changes: 6 additions & 0 deletions autopanaroma/data/campanile/1_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
5.300000000000000000e+02 5.730000000000000000e+02
3.530000000000000000e+02 5.350000000000000000e+02
5.590000000000000000e+02 4.800000000000000000e+02
5.960000000000000000e+02 4.830000000000000000e+02
6.800000000000000000e+02 3.560000000000000000e+02
7.140000000000000000e+02 3.560000000000000000e+02
8 changes: 8 additions & 0 deletions autopanaroma/data/london/1_2_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
8.800000000000000000e+01 4.100000000000000000e+02
1.120000000000000000e+02 4.140000000000000000e+02
6.600000000000000000e+01 3.370000000000000000e+02
8.600000000000000000e+01 3.390000000000000000e+02
1.970000000000000000e+02 2.910000000000000000e+02
3.220000000000000000e+02 3.230000000000000000e+02
4.210000000000000000e+02 3.250000000000000000e+02
3.720000000000000000e+02 1.980000000000000000e+02
8 changes: 8 additions & 0 deletions autopanaroma/data/london/1_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
5.720000000000000000e+02 4.200000000000000000e+02
5.920000000000000000e+02 4.220000000000000000e+02
5.500000000000000000e+02 3.510000000000000000e+02
5.680000000000000000e+02 3.470000000000000000e+02
6.750000000000000000e+02 2.990000000000000000e+02
8.020000000000000000e+02 3.310000000000000000e+02
9.030000000000000000e+02 3.290000000000000000e+02
8.480000000000000000e+02 2.020000000000000000e+02
4 changes: 4 additions & 0 deletions autopanaroma/data/rectify/graph_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
8.800000000000000000e+01 2.080000000000000000e+02
3.360000000000000000e+02 1.200000000000000000e+01
2.950000000000000000e+02 3.560000000000000000e+02
5.250000000000000000e+02 9.300000000000000000e+01
4 changes: 4 additions & 0 deletions autopanaroma/data/rectify/graph_rectified_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1.560000000000000000e+02 3.300000000000000000e+02
1.520000000000000000e+02 5.300000000000000000e+01
3.970000000000000000e+02 3.240000000000000000e+02
3.850000000000000000e+02 4.700000000000000000e+01
4 changes: 4 additions & 0 deletions autopanaroma/data/rectify/holstee_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
7.700000000000000000e+01 6.070000000000000000e+02
1.710000000000000000e+02 3.500000000000000000e+01
5.030000000000000000e+02 7.520000000000000000e+02
4.640000000000000000e+02 2.640000000000000000e+02
4 changes: 4 additions & 0 deletions autopanaroma/data/rectify/holstee_rectified_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1.170000000000000000e+02 7.680000000000000000e+02
1.030000000000000000e+02 2.100000000000000000e+02
4.870000000000000000e+02 7.800000000000000000e+02
4.660000000000000000e+02 2.150000000000000000e+02
14 changes: 14 additions & 0 deletions autopanaroma/data/sunset/1_2_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
2.640000000000000000e+02 4.860000000000000000e+02
2.940000000000000000e+02 5.530000000000000000e+02
3.340000000000000000e+02 5.290000000000000000e+02
3.340000000000000000e+02 5.870000000000000000e+02
1.790000000000000000e+02 2.890000000000000000e+02
3.160000000000000000e+02 3.210000000000000000e+02
4.270000000000000000e+02 3.610000000000000000e+02
4.930000000000000000e+02 3.630000000000000000e+02
4.410000000000000000e+02 3.910000000000000000e+02
4.950000000000000000e+02 4.080000000000000000e+02
5.340000000000000000e+02 4.080000000000000000e+02
5.660000000000000000e+02 4.120000000000000000e+02
5.920000000000000000e+02 4.120000000000000000e+02
4.550000000000000000e+02 4.020000000000000000e+02
14 changes: 14 additions & 0 deletions autopanaroma/data/sunset/1_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
6.100000000000000000e+02 5.250000000000000000e+02
6.510000000000000000e+02 5.590000000000000000e+02
6.890000000000000000e+02 5.370000000000000000e+02
6.890000000000000000e+02 5.950000000000000000e+02
5.360000000000000000e+02 2.990000000000000000e+02
6.690000000000000000e+02 3.270000000000000000e+02
7.820000000000000000e+02 3.690000000000000000e+02
8.750000000000000000e+02 3.750000000000000000e+02
7.960000000000000000e+02 4.000000000000000000e+02
8.680000000000000000e+02 4.180000000000000000e+02
9.090000000000000000e+02 4.220000000000000000e+02
9.590000000000000000e+02 4.280000000000000000e+02
9.870000000000000000e+02 4.280000000000000000e+02
8.080000000000000000e+02 4.120000000000000000e+02
55 changes: 55 additions & 0 deletions autopanaroma/harris.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import numpy as np
from skimage.feature import corner_harris, peak_local_max


def get_harris_corners(im, edge_discard=20):
"""
This function takes a b&w image and an optional amount to discard
on the edge (default is 5 pixels), and finds all harris corners
in the image. Harris corners near the edge are discarded and the
coordinates of the remaining corners are returned. A 2d array (h)
containing the h value of every pixel is also returned.
h is the same shape as the original image, im.
coords is 2 x n (ys, xs).
"""

assert edge_discard >= 20

# find harris corners
h = corner_harris(im, method='eps', sigma=1)
coords = peak_local_max(h, min_distance=1, indices=True)

# discard points on edge
edge = edge_discard # pixels
mask = (coords[:, 0] > edge) & \
(coords[:, 0] < im.shape[0] - edge) & \
(coords[:, 1] > edge) & \
(coords[:, 1] < im.shape[1] - edge)
coords = coords[mask].T
return h, coords


def dist2(x, c):
"""
dist2 Calculates squared distance between two sets of points.
Description
D = DIST2(X, C) takes two matrices of vectors and calculates the
squared Euclidean distance between them. Both matrices must be of
the same column dimension. If X has M rows and N columns, and C has
L rows and N columns, then the result has M rows and L columns. The
I, Jth entry is the squared distance from the Ith row of X to the
Jth row of C.
Adapted from code by Christopher M Bishop and Ian T Nabney.
"""

ndata, dimx = x.shape
ncenters, dimc = c.shape
assert(dimx == dimc, 'Data dimension does not match dimension of centers')

return (np.ones((ncenters, 1)) * np.sum((x**2).T, axis=0)).T + \
np.ones(( ndata, 1)) * np.sum((c**2).T, axis=0) - \
2 * np.inner(x, c)

Loading

0 comments on commit 967b5b6

Please sign in to comment.