Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jianwu21 committed Jun 6, 2020
1 parent 53bd859 commit 8e17c1b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
11 changes: 6 additions & 5 deletions Beethoven.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# coding: utf-8
from numpy import *
from processing import *
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt

# read the .mat file
I,mask,S = read_data_file("Data/Beethoven.mat")
I, mask, S = read_data_file("Data/Beethoven.mat")

for i in range(I.shape[2]):
plt.subplot(1,3,i+1)
plt.imshow(I[:,:,i],cmap = plt.cm.gray)
plt.subplot(1, 3, i+1)
plt.imshow(I[:, :, i], cmap = plt.cm.gray)
plt.axis('off')

I_all = vstack((I[:,:,0].flatten(),I[:,:,1].flatten(),I[:,:,2].flatten()))
I_all = vstack(
(I[:,:,0].flatten(), I[:,:,1].flatten(), I[:,:,2].flatten()))

M = linalg.inv(S).dot(I_all)
M_1 = M[0]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ camera angle but with varying light angles. According to Lambert’s law, for a

<img src='/src/1.png' width='400'>

Where I is the vector of k observed intensities, S is the known 3 x k matrix of normalized light directions, and M is the surface normal that we need. The
Where I is the vector of k observed intensities, S is the known k x 3 matrix of normalized light directions, and M is the surface normal that we need. The
algorithms is then for each (valid) pixel [u, v] in image domain, solve m(u, v)
via Moore-Penrose pseudoinverse or equation selection. Then we get the albedo and normal with the following equation:

Expand Down
9 changes: 7 additions & 2 deletions processing/ps_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
from scipy.io import loadmat
from matplotlib import pyplot as plt

try:
xrange
except NameError:
xrange = range

def cdx(f):
"""
central differences for f-
Expand Down Expand Up @@ -196,8 +201,8 @@ def unbiased_integrate(n1, n2, n3, mask, order=2):
pbar = p.copy()
qbar = q.copy()
elif order == 2:
pbar = 0.5*(p + p[range(1,m) + [m-1], :])
qbar = 0.5*(q + q[:, range(1,n) + [n-1]])
pbar = 0.5*(p + p[list(range(1,m)) + [m-1], :])
qbar = 0.5*(q + q[:, list(range(1,n)) + [n-1]])

# System
I = []
Expand Down

0 comments on commit 8e17c1b

Please sign in to comment.