(edge_mesh, mesh, info_on_pix, cur_node, mark)
| 813 | return mesh |
| 814 | |
| 815 | def recursive_add_edge(edge_mesh, mesh, info_on_pix, cur_node, mark): |
| 816 | ne_nodes = [(x[0], x[1]) for x in edge_mesh.neighbors(cur_node)] |
| 817 | for node_xy in ne_nodes: |
| 818 | node = (node_xy[0], node_xy[1], info_on_pix[node_xy][0]['depth']) |
| 819 | if mark[node[0], node[1]] != 3: |
| 820 | continue |
| 821 | else: |
| 822 | mark[node[0], node[1]] = 0 |
| 823 | mesh.remove_edges_from([(xx, node) for xx in mesh.neighbors(node)]) |
| 824 | mesh = build_connection(mesh, cur_node, node) |
| 825 | re_info = dict(depth=0, count=0) |
| 826 | for re_ne in mesh.neighbors(node): |
| 827 | re_info['depth'] += re_ne[2] |
| 828 | re_info['count'] += 1. |
| 829 | try: |
| 830 | re_depth = re_info['depth'] / re_info['count'] |
| 831 | except: |
| 832 | re_depth = node[2] |
| 833 | re_node = (node_xy[0], node_xy[1], re_depth) |
| 834 | mapping_dict = {node: re_node} |
| 835 | info_on_pix, edge_mesh, mesh = update_info(mapping_dict, info_on_pix, edge_mesh, mesh) |
| 836 | |
| 837 | edge_mesh, mesh, mark, info_on_pix = recursive_add_edge(edge_mesh, mesh, info_on_pix, re_node, mark) |
| 838 | |
| 839 | return edge_mesh, mesh, mark, info_on_pix |
| 840 | |
| 841 | def resize_for_edge(tensor_dict, largest_size): |
| 842 | resize_dict = {k: v.clone() for k, v in tensor_dict.items()} |
no test coverage detected