MCPcopy Index your code
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / write_mesh

Function write_mesh

inpaint/mesh.py:1828–2194  ·  view source on GitHub ↗
(image,
              depth,
              int_mtx,
              ply_name,
              config,
              rgb_model,
              depth_edge_model,
              depth_edge_model_init,
              depth_feat_model)

Source from the content-addressed store, hash-verified

1826
1827
1828def write_mesh(image,
1829 depth,
1830 int_mtx,
1831 ply_name,
1832 config,
1833 rgb_model,
1834 depth_edge_model,
1835 depth_edge_model_init,
1836 depth_feat_model):
1837
1838 mean_loc_depth = depth[depth.shape[0]//2, depth.shape[1]//2]
1839
1840 pbar = tqdm.tqdm(total = 7 if config['extrapolate_border'] is True else 6)
1841 pbar.set_description("Creating mesh")
1842
1843 depth = depth.astype(np.float64)
1844 input_mesh, xy2depth, image, depth = create_mesh(depth, image, int_mtx, config)
1845
1846 H, W = input_mesh.graph['H'], input_mesh.graph['W']
1847 input_mesh = tear_edges(input_mesh, config['depth_threshold'], xy2depth)
1848 input_mesh, info_on_pix = generate_init_node(input_mesh, config, min_node_in_cc=200)
1849 edge_ccs, input_mesh, edge_mesh = group_edges(input_mesh, config, image, remove_conflict_ordinal=False)
1850 edge_canvas = np.zeros((H, W)) - 1
1851
1852 input_mesh, info_on_pix, depth = reassign_floating_island(input_mesh, info_on_pix, image, depth)
1853 input_mesh = update_status(input_mesh, info_on_pix)
1854 specific_edge_id = []
1855 edge_ccs, input_mesh, edge_mesh = group_edges(input_mesh, config, image, remove_conflict_ordinal=True)
1856 pre_depth = depth.copy()
1857 input_mesh, info_on_pix, edge_mesh, depth, aft_mark = remove_dangling(input_mesh, edge_ccs, edge_mesh, info_on_pix, image, depth, config)
1858
1859 input_mesh, depth, info_on_pix = update_status(input_mesh, info_on_pix, depth)
1860 edge_ccs, input_mesh, edge_mesh = group_edges(input_mesh, config, image, remove_conflict_ordinal=True)
1861 edge_canvas = np.zeros((H, W)) - 1
1862
1863 mesh, info_on_pix, depth = fill_missing_node(input_mesh, info_on_pix, image, depth)
1864 if config['extrapolate_border'] is True:
1865 pbar.update(1)
1866 pbar.set_description("Extrapolating border")
1867
1868 pre_depth = depth.copy()
1869 input_mesh, info_on_pix, depth = refresh_bord_depth(input_mesh, info_on_pix, image, depth)
1870 input_mesh = remove_node_feat(input_mesh, 'edge_id')
1871 aft_depth = depth.copy()
1872 input_mesh, info_on_pix, depth, image = enlarge_border(input_mesh, info_on_pix, depth, image, config)
1873 noext_H, noext_W = H, W
1874 H, W = image.shape[:2]
1875 input_mesh, info_on_pix = fill_dummy_bord(input_mesh, info_on_pix, image, depth, config)
1876 edge_ccs, input_mesh, edge_mesh = \
1877 group_edges(input_mesh, config, image, remove_conflict_ordinal=True)
1878 input_mesh = combine_end_node(input_mesh, edge_mesh, edge_ccs, depth)
1879 input_mesh, depth, info_on_pix = update_status(input_mesh, info_on_pix, depth)
1880 edge_ccs, input_mesh, edge_mesh = \
1881 group_edges(input_mesh, config, image, remove_conflict_ordinal=True, spdb=False)
1882 input_mesh = remove_redundant_edge(input_mesh, edge_mesh, edge_ccs, info_on_pix, config, redundant_number=config['redundant_number'], spdb=False)
1883 input_mesh, depth, info_on_pix = update_status(input_mesh, info_on_pix, depth)
1884 edge_ccs, input_mesh, edge_mesh = group_edges(input_mesh, config, image, remove_conflict_ordinal=True)
1885 input_mesh = combine_end_node(input_mesh, edge_mesh, edge_ccs, depth)

Callers 2

run_3dphotoFunction · 0.90
main.pyFile · 0.90

Calls 15

fill_missing_nodeFunction · 0.90
refresh_bord_depthFunction · 0.90
enlarge_borderFunction · 0.90
fill_dummy_bordFunction · 0.90
get_map_from_ccsFunction · 0.90
extrapolateFunction · 0.90
filter_edgeFunction · 0.90
tear_edgesFunction · 0.85
generate_init_nodeFunction · 0.85
group_edgesFunction · 0.85
reassign_floating_islandFunction · 0.85
update_statusFunction · 0.85

Tested by

no test coverage detected