示例#1
0
 def save_mesh(self, opt):
     with torch.no_grad():
         var = self.graph_forward(opt)
     util.save_mesh(opt, self, var.vertices)
示例#2
0
    assert max(heights) - height <= data.stereo_downscale_factor

if depth is not None:
    depth = depth[:height, :width]
if alpha is not None:
    alpha = alpha[:height, :width]
if normals is not None:
    normals = normals[:height, :width, :]

print('Initialized data in {0} seconds'.format(toc - tic))

tic = time.time()
A, b = form_poisson_equation(height, width, alpha, normals, depth_weight,
                             depth)
toc = time.time()

print('Set up linear system in {0} seconds'.format(toc - tic))

tic = time.time()
print('Solving...')
solution = lsqr(A, b)
x = solution[0]
depth = x.reshape(height, width)
toc = time.time()
print('Solve complete in {0} seconds'.format(toc - tic))

print('Save mesh to {0}'.format(data.mesh_ply.format(mode)))
save_mesh(K_right, width, height, albedo, normals, depth, alpha,
          data.mesh_ply.format(mode))
print('done :)')
示例#3
0
文件: combine.py 项目: rjc362/pa4
assert max(heights) - height <= data.stereo_downscale_factor

if depth is not None:
    depth = depth[:height, :width]
if alpha is not None:
    alpha = alpha[:height, :width]
if normals is not None:
    normals = normals[:height, :width, :]

print 'Initialized data in {0} seconds'.format(toc - tic)

tic = time.time()
A, b = form_poisson_equation(
    height, width, alpha, normals, depth_weight, depth)
toc = time.time()

print 'Set up linear system in {0} seconds'.format(toc - tic)

tic = time.time()
print 'Solving...'
solution = lsqr(A, b)
x = solution[0]
depth = x.reshape(height, width)
toc = time.time()
print 'Solve complete in {0} seconds'.format(toc - tic)

print 'Save mesh to {0}'.format(data.mesh_ply.format(mode))
save_mesh(K_right, width, height, albedo, normals,
          depth, alpha, data.mesh_ply.format(mode))
print 'done :)'