In [18]:
fix_L = np.array([[10, 10, 100.]])
fix_R = np.array([[7, 12, 100.]])
loc_L = np.array([[-3., 0, 0]])
loc_R = np.array([[3., 0, 0]])
In [2]:
import numpy as np
In [4]:
whos
In [6]:
whos
In [7]:
fix_L = fix_L - loc_L # translate fix_L into coordinate system with loc_L at origin
fix_L = fix_L / np.linalg.norm(fix_L) # make unit length
fix_L = fix_L + loc_L # translate back in to cyclopean coordinates
fix_R = fix_R - loc_R # translate fix_R into coordinate system with loc_R at origin
fix_R = fix_R / np.linalg.norm(fix_R) # make unit length
fix_R = fix_R + loc_R # translate back in to cyclopean coordinates
In [8]:
fix_L
Out[8]:
In [9]:
fix_R
Out[9]:
In [10]:
y = np.matrix([[loc_L[1,0], fix_L[1,0], loc_R[1,0], fix_R[1,0]]]).T
In [11]:
loc_L.shape
Out[11]:
In [12]:
loc_L[1]
In [13]:
tmp = fix_L.squeeze()
In [14]:
tmp.shape
Out[14]:
In [15]:
tmp[0]
Out[15]:
In [17]:
tmp[2]
Out[17]:
In [19]:
whos
In [20]:
fix_L
Out[20]:
In [21]:
fix_L = fix_L.squeeze()
fix_R = fix_R.squeeze()
loc_L = loc_L.squeeze()
loc_R = loc_R.squeeze()
In [22]:
whos
In [23]:
fix_L = fix_L - loc_L # translate fix_L into coordinate system with loc_L at origin
fix_L = fix_L / np.linalg.norm(fix_L) # make unit length
fix_L = fix_L + loc_L # translate back in to cyclopean coordinates
fix_R = fix_R - loc_R # translate fix_R into coordinate system with loc_R at origin
fix_R = fix_R / np.linalg.norm(fix_R) # make unit length
fix_R = fix_R + loc_R # translate back in to cyclopean coordinates
In [24]:
fix_L
Out[24]:
In [25]:
fix_R
Out[25]:
In [26]:
y = np.matrix([[loc_L[1], fix_L[1], loc_R[1], fix_R[1]]]).T # y vector
In [27]:
y
Out[27]:
In [28]:
Z = np.matrix([[loc_L[2], fix_L[2], loc_R[2], fix_R[2]]]).T # Z vector
In [29]:
Z
Out[29]:
In [30]:
b = np.linalg.inv(Z.T * Z) * Z.T * y
In [31]:
b
Out[31]:
In [32]:
loc_L_new = np.array([[loc_L[0], b*loc_L[2], loc_L[2]]]) # project (x and z are the same, y = bz)
loc_R_new = np.array([[loc_R[0], b*loc_R[2], loc_R[2]]]) # project
In [33]:
loc_L_new
Out[33]:
In [34]:
fix_L_new = np.array([[fix_L[0], b*fix_L[2], fix_L[2]]]) # project (x and z are the same, y = bz)
fix_R_new = np.array([[fix_R[0], b*fix_R[2], fix_R[2]]]) # project
In [35]:
fix_L_new
Out[35]:
In [36]:
fix_R_new
Out[36]:
In [37]:
P = np.array([[u[0,0], -1, u[0,1]]]) # vector normal to the epipolar plane
P = P / np.linalg.norm(P) # normalize
In [38]:
P = np.array([0, -1, b])
In [39]:
P
Out[39]:
In [40]:
P = P / np.linalg.norm(P)
In [41]:
P
Out[41]:
In [42]:
th_L = np.degrees(np.arcsin(np.dot( P, (fix_L - loc_L) / np.linalg.norm(fix_L - loc_L))))
In [43]:
th_L
Out[43]:
In [44]:
th_L = np.degrees(np.arcsin(np.dot( P, (fix_L - loc_L) / np.linalg.norm(fix_L - loc_L))))
th_R = np.degrees(np.arcsin(np.dot( P, (fix_R - loc_R) / np.linalg.norm(fix_R - loc_R))))
th_L_new = np.degrees(np.arcsin(np.dot( P, (fix_L_new - loc_L) / np.linalg.norm(fix_L_new - loc_L))))
th_R_new = np.degrees(np.arcsin(np.dot( P, (fix_R_new - loc_R) / np.linalg.norm(fix_R_new - loc_R))))
In [45]:
whos
In [48]:
fix_L_new[0,].shape
Out[48]:
In [47]:
fix_L
Out[47]:
In [49]:
fix_L = np.array([[10, 10, 100.]]).T
fix_R = np.array([[7, 12, 100.]]).T
loc_L = np.array([[-3., 0, 0]]).T
loc_R = np.array([[3., 0, 0]]).T
In [50]:
whos
In [51]:
y = np.matrix([[loc_L[1,0], fix_L[1,0], loc_R[1,0], fix_R[1,0]]]).T # y vector
Z = np.matrix([[loc_L[2,0], fix_L[2,0], loc_R[2,0], fix_R[2,0]]]).T # Z vector
b = np.linalg.inv(Z.T * Z) * Z.T * y # least squares solution for b
# PROJECT VECTORS ONTO PLANE to get new point coordinates
fix_L_new = np.array([[fix_L[0,0], b*fix_L[2,0], fix_L[2,0]]]) # project (x and z are the same, y = bz)
fix_R_new = np.array([[fix_R[0,0], b*fix_R[2,0], fix_R[2,0]]]) # project
In [52]:
fix_L_new
Out[52]:
In [53]:
fix_L = fix_L - loc_L # translate fix_L into coordinate system with loc_L at origin
fix_L = fix_L / np.linalg.norm(fix_L) # make unit length
fix_L = fix_L + loc_L # translate back in to cyclopean coordinates
fix_R = fix_R - loc_R # translate fix_R into coordinate system with loc_R at origin
fix_R = fix_R / np.linalg.norm(fix_R) # make unit length
fix_R = fix_R + loc_R # translate back in to cyclopean coordinates
# SOLVE FOR PLANE THROUGH loc_L AND loc_R, WHILE MINIMIZING DISTANCE TO fix_L AND fix_R:
# CONSTRAINED LEAST-SQUARES (solve: y = bz)
# the only degree of freedom is the rotation of the plane around the x axis that runs between loc_L and loc_R
# so we find the linear least squares solution for y = bz
# http://en.wikipedia.org/wiki/Linear_least_squares_(mathematics)
y = np.matrix([[loc_L[1,0], fix_L[1,0], loc_R[1,0], fix_R[1,0]]]).T # y vector
Z = np.matrix([[loc_L[2,0], fix_L[2,0], loc_R[2,0], fix_R[2,0]]]).T # Z vector
b = np.linalg.inv(Z.T * Z) * Z.T * y # least squares solution for b
# PROJECT VECTORS ONTO PLANE to get new point coordinates
fix_L_new = np.array([[fix_L[0,0], b*fix_L[2,0], fix_L[2,0]]]) # project (x and z are the same, y = bz)
fix_R_new = np.array([[fix_R[0,0], b*fix_R[2,0], fix_R[2,0]]]) # project
In [54]:
fix_L_new
Out[54]:
In [55]:
fix_R_new
Out[55]:
In [56]:
# check that elevation angles are the same
P = np.array([0, -1, b]) # vector normal to the epipolar plane
P = P / np.linalg.norm(P) # normalize
# angle between original vectors and epipolar plane
th_L = np.degrees(np.arcsin(np.dot( P, (fix_L.T - loc_L.T) / np.linalg.norm(fix_L - loc_L))))
th_R = np.degrees(np.arcsin(np.dot( P, (fix_R.T - loc_R.T) / np.linalg.norm(fix_R - loc_R))))
th_L_new = np.degrees(np.arcsin(np.dot( P, (fix_L_new.T - loc_L.T) / np.linalg.norm(fix_L_new - loc_L))))
th_R_new = np.degrees(np.arcsin(np.dot( P, (fix_R_new.T - loc_R.T) / np.linalg.norm(fix_R_new - loc_R))))
In [57]:
P
Out[57]:
In [58]:
# angle between original vectors and epipolar plane
th_L = np.degrees(np.arcsin(np.dot( P, (fix_L - loc_L) / np.linalg.norm(fix_L - loc_L))))
th_R = np.degrees(np.arcsin(np.dot( P, (fix_R - loc_R) / np.linalg.norm(fix_R - loc_R))))
th_L_new = np.degrees(np.arcsin(np.dot( P, (fix_L_new - loc_L) / np.linalg.norm(fix_L_new - loc_L))))
th_R_new = np.degrees(np.arcsin(np.dot( P, (fix_R_new - loc_R) / np.linalg.norm(fix_R_new - loc_R))))
In [59]:
th_L
th_R
th_L_new
th_R_new
Out[59]:
In [60]:
th_L
Out[60]:
In [61]:
th_R
Out[61]:
In [62]:
th_L_new
Out[62]:
In [63]:
fix_L_new = np.array([[fix_L[0,0], b*fix_L[2,0], fix_L[2,0]]]).T # project (x and z are the same, y = bz)
fix_R_new = np.array([[fix_R[0,0], b*fix_R[2,0], fix_R[2,0]]]).T # project
In [64]:
th_L_new = np.degrees(np.arcsin(np.dot( P, (fix_L_new - loc_L) / np.linalg.norm(fix_L_new - loc_L))))
th_R_new = np.degrees(np.arcsin(np.dot( P, (fix_R_new - loc_R) / np.linalg.norm(fix_R_new - loc_R))))
In [65]:
th_L_new
Out[65]:
In [66]:
th_R_new
Out[66]:
In [67]:
P = np.array([0, -1, b]) # vector normal to the epipolar plane
P = P / np.linalg.norm(P) # normalize
# angle between original vectors and epipolar plane
th_L = np.degrees(np.arcsin(np.dot( P, fix_L / np.linalg.norm(fix_L))))
th_R = np.degrees(np.arcsin(np.dot( P, fix_R / np.linalg.norm(fix_R ))))
th_L_new = np.degrees(np.arcsin(np.dot( P, (fix_L_new) / np.linalg.norm(fix_L_new))))
th_R_new = np.degrees(np.arcsin(np.dot( P, (fix_R_new) / np.linalg.norm(fix_R_new))))
In [68]:
P = np.array([0, -1, b]) # vector normal to the epipolar plane
P = P / np.linalg.norm(P) # normalize
# angle between original vectors and epipolar plane
th_L = np.degrees(np.arcsin(np.dot( P, fix_L / np.linalg.norm(fix_L))))
th_R = np.degrees(np.arcsin(np.dot( P, fix_R / np.linalg.norm(fix_R ))))
th_L_new = np.degrees(np.arcsin(np.dot( P, (fix_L_new) / np.linalg.norm(fix_L_new))))
th_R_new = np.degrees(np.arcsin(np.dot( P, (fix_R_new) / np.linalg.norm(fix_R_new))))
In [69]:
th_L_new
Out[69]:
In [70]:
th_L
Out[70]:
In [71]:
print "Align Eyes Adjustment (L/R in deg)", th_L, th_R
In [72]:
if np.absolute(th_L_new) > 1e-100 or np.absolute(th_R_new) > 1e-100:
print "Projection to epipolar plane failed"
end
In [73]:
if np.absolute(th_L_new) > 1e-100 or np.absolute(th_R_new) > 1e-100:
print "Projection to epipolar plane failed"
In [74]:
th_L_new = 1
In [75]:
if np.absolute(th_L_new) > 1e-100 or np.absolute(th_R_new) > 1e-100:
print "Projection to epipolar plane failed"
In [76]:
if np.absolute(th_L_new) > 1e-100 or np.absolute(th_R_new) > 1e-100:
raise ValueError("Projection to epipolar plane failed")
#print "Projection to epipolar plane failed"
In [76]:
In [77]:
import matplotlib.pyplot as plt
In [78]:
fig = plt.figure()
plt.plot3( 0, 0, 0, 'bo' );
In [79]:
fig = plt.figure()
plt.plot( 0, 0, 0, 'bo' );
In [80]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes.plot( 0, 0, 0, 'bo' );
In [81]:
%matplotlib inline
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes.plot( 0, 0, 0, 'bo' );
In [87]:
axes.plot( [loc_L[0],fix_L[0]], [loc_L[1],fix_L[1]], [loc_L[2],fix_L[2]],'k')
Out[87]:
In [86]:
[loc_L[0],fix_L[0]]
Out[86]:
In [88]:
show
In [89]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes.plot( 0, 0, 0, 'bo' );
axes.plot( [loc_L[0],fix_L[0]], [loc_L[1],fix_L[1]], [loc_L[2],fix_L[2]],'k')
In [90]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes.plot( 0, 0, 0, 'bo' );
axes.plot( [loc_L[0],fix_L[0]], [loc_L[1],fix_L[1]], [loc_L[2],fix_L[2]],'k')
Out[90]:
In [91]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes.plot( 0, 0, 0, 'ko' );
axes.plot( [loc_L[0],fix_L[0]], [loc_L[1],fix_L[1]], [loc_L[2],fix_L[2]],'bs')
axes.plot( [loc_R[0],fix_R[0]], [loc_R[1],fix_R[1]], [loc_R[2],fix_R[2]],'rs')
Out[91]:
In [92]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes.plot( 0, 0, 0, 'ko' );
axes.plot( [loc_L[0],fix_L[0]], [loc_L[1],fix_L[1]], [loc_L[2],fix_L[2]],'b')
axes.plot( [loc_R[0],fix_R[0]], [loc_R[1],fix_R[1]], [loc_R[2],fix_R[2]],'r')
Out[92]:
In [93]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes.plot( 0, 0, 0);
axes.plot( [loc_L[0],fix_L[0]], [loc_L[1],fix_L[1]], [loc_L[2],fix_L[2]])
axes.plot( [loc_R[0],fix_R[0]], [loc_R[1],fix_R[1]], [loc_R[2],fix_R[2]])
In [94]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes.plot( 0, 0, 0, 'k' );
axes.plot( [loc_L[0],fix_L[0]], [loc_L[1],fix_L[1]], [loc_L[2],fix_L[2]],'b')
axes.plot( [loc_R[0],fix_R[0]], [loc_R[1],fix_R[1]], [loc_R[2],fix_R[2]],'r')
Out[94]:
In [95]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
#axes.plot( 0, 0, 0, 'k' );
axes.plot( [loc_L[0],fix_L[0]], [loc_L[1],fix_L[1]], [loc_L[2],fix_L[2]],'b')
axes.plot( [loc_R[0],fix_R[0]], [loc_R[1],fix_R[1]], [loc_R[2],fix_R[2]],'r')
Out[95]:
In [96]:
fix_L
Out[96]:
In [97]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
#axes.plot( 0, 0, 0, 'k' );
axes.plot( [loc_L[0],fix_L[0]], [loc_L[1],fix_L[1]], [loc_L[2],fix_L[2]],'b')
axes.plot( [loc_R[0],fix_R[0]], [loc_R[1],fix_R[1]], [loc_R[2],fix_R[2]],'r')
In [98]:
from mpl_toolkits.mplot3d import Axes3D
In [99]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
#axes.plot( 0, 0, 0, 'k' );
axes.plot( [loc_L[0],fix_L[0]], [loc_L[1],fix_L[1]], [loc_L[2],fix_L[2]],'b')
axes.plot( [loc_R[0],fix_R[0]], [loc_R[1],fix_R[1]], [loc_R[2],fix_R[2]],'r')
Out[99]:
In [100]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
#axes.plot( 0, 0, 0, 'k' );
axes.plot( [loc_L[0],fix_L[0]], [loc_L[1],fix_L[1]], [loc_L[2],fix_L[2]],'b-')
axes.plot( [loc_R[0],fix_R[0]], [loc_R[1],fix_R[1]], [loc_R[2],fix_R[2]],'r-')
Out[100]:
In [102]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
#axes.plot( 0, 0, 0, 'k' );
axes.plot( loc_L, fix_L,'b')
axes.plot( loc_R,fix_R,'r')
Out[102]:
In [104]:
[xramp,zramp] = np.meshgrid( np.linspace(-1.5,1.5, 3), np.linspace(-1.5,1.5, 3) );
yramp = b*zramp;
In [ ]:
In [105]:
whos
In [106]:
yramp = zramp.copy()
In [108]:
yramp = b[0,0]*yramp
In [ ]:
In [109]:
yramp
Out[109]:
In [110]:
%matplotlib inline
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
# epipolar plane
axes.mesh( xramp, yramp, zramp, 'EdgeColor', [1 0 0] );
In [111]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
# epipolar plane
axes.mesh( xramp, yramp, zramp);
In [112]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
# epipolar plane
axes.plot_wireframe( xramp, yramp, zramp);
In [113]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
# epipolar plane
axes.plot_wireframe( xramp, yramp, zramp,'k');
In [114]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
# epipolar plane
axes.plot_wireframe( xramp, yramp, zramp);
#cyclopean eye
axes.plot( 0, 0, 0, 'k' );
In [126]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
# epipolar plane
axes.plot_wireframe( xramp, yramp, zramp);
#cyclopean eye
axes.plot( [0.], [0.], [0.],'ko')
axes.plot( [loc_L[0,0],fix_L[0,0]], [loc_L[1.0],fix_L[1,0]], [loc_L[2,0],fix_L[2,0]],'c')
Out[126]:
In [127]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
# epipolar plane
axes.plot_wireframe( xramp, yramp, zramp);
#cyclopean eye
axes.plot( [0.], [0.], [0.],'ko')
# original gaze vectors
axes.plot( [loc_L[0,0],fix_L[0,0]], [loc_L[1.0],fix_L[1,0]], [loc_L[2,0],fix_L[2,0]],'c')
axes.plot( [loc_R[0,0],fix_R[0,0]], [loc_R[1,0],fix_R[1,0]], [loc_R[2,0],fix_R[2,0]],'m')
# new gaze vectors
axes.plot( [loc_L[0,0],fix_L_new[0,0]], [loc_L[1,0],fix_L_new[1,0]], [loc_L[2],0,fix_L_new[2,0]],'g')
axes.plot( [loc_R[0,0],fix_R_new[0,0]], [loc_R[1,0],fix_R_new[1,0]], [loc_R[2,0],fix_R_new[2,0]],'r')
Out[127]:
In [128]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
# epipolar plane
axes.plot_wireframe( xramp, yramp, zramp);
#cyclopean eye
axes.plot( [0.], [0.], [0.],'ko')
# original gaze vectors
axes.plot( [loc_L[0,0],fix_L[0,0]], [loc_L[1.0],fix_L[1,0]], [loc_L[2,0],fix_L[2,0]],'c')
axes.plot( [loc_R[0,0],fix_R[0,0]], [loc_R[1,0],fix_R[1,0]], [loc_R[2,0],fix_R[2,0]],'m')
# new gaze vectors
axes.plot( [loc_L[0,0],fix_L_new[0,0]], [loc_L[1,0],fix_L_new[1,0]], [loc_L[2,0],fix_L_new[2,0]],'g')
axes.plot( [loc_R[0,0],fix_R_new[0,0]], [loc_R[1,0],fix_R_new[1,0]], [loc_R[2,0],fix_R_new[2,0]],'r')
Out[128]:
In [129]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
# epipolar plane
axes.plot_wireframe( xramp, yramp, zramp);
#cyclopean eye
axes.plot( [0.], [0.], [0.],'ko')
# original gaze vectors
axes.plot( [loc_L[0,0],fix_L[0,0]], [loc_L[1.0],fix_L[1,0]], [loc_L[2,0],fix_L[2,0]],'c')
axes.plot( [loc_R[0,0],fix_R[0,0]], [loc_R[1,0],fix_R[1,0]], [loc_R[2,0],fix_R[2,0]],'m')
# new gaze vectors
axes.plot( [loc_L[0,0],fix_L_new[0,0]], [loc_L[1,0],fix_L_new[1,0]], [loc_L[2,0],fix_L_new[2,0]],'g')
axes.plot( [loc_R[0,0],fix_R_new[0,0]], [loc_R[1,0],fix_R_new[1,0]], [loc_R[2,0],fix_R_new[2,0]],'r')
Out[129]:
In [130]:
#points for epipolar plane
[xramp,zramp] = np.meshgrid( np.linspace(-4,4, 3), np.linspace(-4,4, 3) );
yramp = zramp.copy()
yramp = b[0,0]*yramp
%matplotlib inline
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes = fig.gca(projection='3d')
# epipolar plane
axes.plot_wireframe( xramp, yramp, zramp);
#cyclopean eye
axes.plot( [0.], [0.], [0.],'ko')
# original gaze vectors
axes.plot( [loc_L[0,0],fix_L[0,0]], [loc_L[1.0],fix_L[1,0]], [loc_L[2,0],fix_L[2,0]],'c')
axes.plot( [loc_R[0,0],fix_R[0,0]], [loc_R[1,0],fix_R[1,0]], [loc_R[2,0],fix_R[2,0]],'m')
# new gaze vectors
axes.plot( [loc_L[0,0],fix_L_new[0,0]], [loc_L[1,0],fix_L_new[1,0]], [loc_L[2,0],fix_L_new[2,0]],'g')
axes.plot( [loc_R[0,0],fix_R_new[0,0]], [loc_R[1,0],fix_R_new[1,0]], [loc_R[2,0],fix_R_new[2,0]],'r')
Out[130]:
In [131]:
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
#axes = fig.gca(projection='3d')
# epipolar plane
axes.plot_wireframe( xramp, yramp, zramp);
#cyclopean eye
axes.plot( [0.], [0.], [0.],'ko')
# original gaze vectors
axes.plot( [loc_L[0,0],fix_L[0,0]], [loc_L[1.0],fix_L[1,0]], [loc_L[2,0],fix_L[2,0]],'c')
axes.plot( [loc_R[0,0],fix_R[0,0]], [loc_R[1,0],fix_R[1,0]], [loc_R[2,0],fix_R[2,0]],'m')
# new gaze vectors
axes.plot( [loc_L[0,0],fix_L_new[0,0]], [loc_L[1,0],fix_L_new[1,0]], [loc_L[2,0],fix_L_new[2,0]],'g')
axes.plot( [loc_R[0,0],fix_R_new[0,0]], [loc_R[1,0],fix_R_new[1,0]], [loc_R[2,0],fix_R_new[2,0]],'r')
In [132]:
import mpld3
In [133]:
%matplotlib inline
import mpld3
mpld3.enable_notebook()
In [ ]: