This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from keras.layers import Input, Dense | |
from keras.models import Model, Sequential | |
def dnn(n_inputs, n_outputs, n_hidden_layers=3, hlayer_size=128, probabilistic=True): | |
"""Defines simple DNN model | |
""" | |
x_input = Input(shape=[n_inputs]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def pdist(X1, X2): | |
"""Computes the matrix of pairwise distances between X1 and X2. | |
The implementation is based on the following observation for matrices: | |
(X1-X2)^2 = X1^2 - 2*X1*X2 + X2^2 | |
Parameters | |
---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
def show_img(img, figsize=(10, 10)): | |
''' | |
Show image using matplotlib | |
Parameters | |
---------- | |
img : array of shape [img_width, img_height, 3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def get_rotation_mat(theta=np.pi, axis=0): | |
# https://en.wikipedia.org/wiki/Rotation_matrix | |
sin = np.sin(theta) | |
cos = np.cos(theta) | |
if axis==0: | |
R = np.asarray([[1, 0, 0], | |
[0, cos, -sin], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_img_uv_coords(img): | |
""" | |
Get u,v coords for image pixels | |
""" | |
img_height, img_width = img.shape[0], img.shape[1] | |
uv_map = np.zeros([img_height, img_width, 2]) | |
u = np.arange(0, img_height) | |
v = np.arange(0, img_width) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def load_colmap_sparse_points(points3d_path): | |
'''Load COLMAP points3D.txt as numpy array | |
''' | |
with open(points3d_path, 'r') as f: | |
points_txt = f.readlines()[3:] | |
n_points = len(points_txt) | |
points_np = np.zeros([n_points, 6]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5.251361131668090820e-01 9.620525240898132324e-01 7.196764349937438965e-01 | |
5.226933956146240234e-01 9.544755220413208008e-01 7.539969086647033691e-01 | |
5.285560488700866699e-01 9.512906074523925781e-01 7.259945869445800781e-01 | |
5.315514206886291504e-01 9.564292430877685547e-01 6.891824007034301758e-01 | |
5.269100069999694824e-01 9.467492103576660156e-01 7.527468204498291016e-01 | |
5.214509367942810059e-01 9.482995271682739258e-01 7.740847468376159668e-01 | |
5.324009060859680176e-01 9.465931057929992676e-01 6.968711614608764648e-01 | |
5.352808237075805664e-01 9.493461251258850098e-01 6.598548889160156250e-01 | |
5.359319448471069336e-01 9.241502285003662109e-01 6.846292018890380859e-01 | |
5.381639003753662109e-01 9.202622175216674805e-01 6.565521359443664551e-01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newmtl material_1 | |
map_Kd rp_mei_posed_001_dif.jpg |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import open3d as o3d | |
import numpy as np | |
def poisson_open3d(ply_path, depth=8): | |
pcd = o3d.io.read_point_cloud(ply_path) | |
mesh, densities = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(pcd, depth=8) | |
vertices_to_remove = densities < np.quantile(densities, 0.02) | |
mesh.remove_vertices_by_mask(vertices_to_remove) |