Ejemplo n.º 1
0
def helper(image_path):
    image = imread(image_path)
    result, crop = p2v.reconstruct(image)

    cropped_path = 'temp/cropped.jpg'
    imwrite(cropped_path, crop)

    landmarks = recognize_image(cropped_path, show_image=False)

    return result['Z_surface'], landmarks, crop
 def test_reconstruct(self):
     image = imread('examples/sample.jpg')
     results = p2v.reconstruct(image)
     self.assertEqual(len(results), 2)
Ejemplo n.º 3
0
import pix2vertex as p2v
from imageio import imread

image_path = 'tommy-images/middle.jpg'
image = imread(image_path)
result, crop = p2v.reconstruct(image)

# Interactive visualization in a notebook
p2v.vis_depth_interactive(result['Z_surface'])

# Static visualization using matplotlib
p2v.vis_depth_matplotlib(crop, result['Z_surface'])

# Export to STL
p2v.save2stl(result['Z_surface'], 'res.stl')
Ejemplo n.º 4
0
        'coords':
        np.vstack([
            grid.records().coords[:, 0],
            grid.records().coords[:, 1],
            nd_arr.ravel()
        ]).T
    })
    rec = GeoRecords(grid.proj, rec)
    return rec


front = imread("front.jpeg")
left = imread("left.jpeg")
right = imread("right.jpeg")

result_front, crop_front = p2v.reconstruct(front)
result_left, crop_left = p2v.reconstruct(left)
result_right, crop_right = p2v.reconstruct(right)

front = result_front['Z_surface']
left = result_left['Z_surface']
right = result_right['Z_surface']

# Put NAN as 0
# front = front.copy()
# front[np.isnan(front)] = front[~np.isnan(front)].min()
# left = left.copy()
# left[np.isnan(left)] = left[~np.isnan(left)].min()
# right = right.copy()
# right[np.isnan(right)] = right[~np.isnan(right)].min()