Exemple #1
0
def plot_zpq(mesh_z_):
    mesh_p_, mesh_q_ = shape.z_to_pq(mesh_z_)
    mesh_nx, mesh_ny, _ = shape.pq_to_n(mesh_p_, mesh_q_)
    plt.clf()
    plt.quiver(array_mesh_x_, array_mesh_y_, mesh_nx, mesh_ny)
    plt.axis('equal')
    plt.pause(0.001)
def plot_pq(mesh_p_, mesh_q_):
    global iteration_times
    iteration_times = iteration_times + 1
    mesh_nx_, mesh_ny_, _ = shape.pq_to_n(mesh_p_, mesh_q_)
    plt.clf()
    plt.subplot(131)
    plt.quiver(mesh_x[::4, ::4], mesh_y[::4, ::4], mesh_nx[::4, ::4],
               mesh_ny[::4, ::4])
    plt.axis('equal')
    plt.suptitle('Surface normal')
    plt.subplot(132)
    plt.quiver(mesh_x[::4, ::4], mesh_y[::4, ::4], ps_mesh_nx[::4, ::4],
               ps_mesh_ny[::4, ::4])
    plt.axis('equal')
    plt.suptitle('With integrability deviation')
    plt.subplot(133)
    plt.quiver(mesh_x[::4, ::4], mesh_y[::4, ::4], mesh_nx_[::4, ::4],
               mesh_ny_[::4, ::4])
    plt.axis('equal')
    plt.suptitle(str(iteration_times) + ' times iteration')
    plt.pause(0.001)
Exemple #3
0
fig = plt.figure()
plt.subplot(121)
plt.imshow(image1,cmap='gray')
plt.axis('off')
plt.subplot(122)
plt.imshow(image2,cmap='gray')
plt.axis('off')
plt.show()

### photomatric stereo
phy = 60* np.pi/180
thetas = np.array([90, -90])* np.pi/180
light_xyz_1  = np.array([np.cos(phy)*np.cos(thetas[0]), np.cos(phy)*np.sin(thetas[0]), np.sin(phy)])
light_xyz_2  = np.array([np.cos(phy)*np.cos(thetas[1]), np.cos(phy)*np.sin(thetas[1]), np.sin(phy)])
ps_mesh_p,ps_mesh_q = algrithom.photometric_symlight(image1,image2,phy)
ps_mesh_nx,ps_mesh_ny,ps_mesh_nz=shape.pq_to_n(ps_mesh_p,ps_mesh_q)
### plot photomatric stereo results
fig = plt.figure()
# ax = fig.gca()
# ax.set_aspect('equal')
ax = plt.subplot(121)
# quiver1 = ax.quiver(array_mesh_x[::2,::2], array_mesh_y[::2,::2], array_mesh_nx[::2,::2],array_mesh_ny[::2,::2])
quiver1 = ax.quiver(array_mesh_x, array_mesh_y, array_mesh_nx,array_mesh_ny)
plt.xlim(0.0,16.0)
plt.ylim(0.0,16.0)
plt.axis('equal')
ax = plt.subplot(122)
# quiver2 = ax.quiver(array_mesh_x[::2,::2], array_mesh_y[::2,::2], ps_mesh_nx[::2,::2],ps_mesh_ny[::2,::2])
quiver2 = ax.quiver(array_mesh_x, array_mesh_y, ps_mesh_nx,ps_mesh_ny)
plt.xlim(0.0,16.0)
plt.ylim(0.0,16.0)