stricter edge selsection, but there must must be a rule that the line must not deviate a couple degrees from detected when fitting to edges
Browse files- handcrafted_solution.py +10 -10
handcrafted_solution.py
CHANGED
@@ -109,20 +109,20 @@ def get_vertices_and_edges_from_segmentation(gest_seg_np, edge_th=50.0):
|
|
109 |
|
110 |
apex_pts = np.concatenate([apex_centroids, eave_end_point_centroids])
|
111 |
|
112 |
-
vertex_mask = np.zeros_like(apex_mask)
|
113 |
-
for i in apex_centroids:
|
114 |
-
|
115 |
-
for i in eave_end_point_centroids:
|
116 |
-
|
117 |
-
vertex_mask = np.bitwise_not(vertex_mask)
|
118 |
-
|
119 |
-
scale =
|
120 |
vertex_size = np.zeros(apex_pts.shape[0])
|
121 |
for i, coords in enumerate(apex_pts):
|
122 |
-
coords = np.round(coords).astype(np.uint32)
|
123 |
radius = 25#np.clip(int(max_depth//2 + depth_np[coords[1], coords[0]]), 10, 30)#int(np.clip(max_depth - depth_np[coords[1], coords[0]], 10, 20))
|
124 |
vertex_size[i] = (scale*radius) ** 2 # because we are using squared distances
|
125 |
-
cv2.circle(vertex_mask, coords, radius - 5, (255, ), 2 * (radius - 5), -1)
|
126 |
# vertex_size *= scale
|
127 |
for edge_class in ['eave', 'ridge', 'rake', 'valley', 'flashing', 'step_flashing']:
|
128 |
if len(apex_pts) < 2:
|
|
|
109 |
|
110 |
apex_pts = np.concatenate([apex_centroids, eave_end_point_centroids])
|
111 |
|
112 |
+
# vertex_mask = np.zeros_like(apex_mask)
|
113 |
+
# for i in apex_centroids:
|
114 |
+
# cv2.circle(vertex_mask, np.round(i).astype(np.uint32), 20, (255,), 40, -1)
|
115 |
+
# for i in eave_end_point_centroids:
|
116 |
+
# cv2.circle(vertex_mask, np.round(i).astype(np.uint32), 15, (255,), 30, -1)
|
117 |
+
# vertex_mask = np.bitwise_not(vertex_mask)
|
118 |
+
|
119 |
+
scale = 2
|
120 |
vertex_size = np.zeros(apex_pts.shape[0])
|
121 |
for i, coords in enumerate(apex_pts):
|
122 |
+
# coords = np.round(coords).astype(np.uint32)
|
123 |
radius = 25#np.clip(int(max_depth//2 + depth_np[coords[1], coords[0]]), 10, 30)#int(np.clip(max_depth - depth_np[coords[1], coords[0]], 10, 20))
|
124 |
vertex_size[i] = (scale*radius) ** 2 # because we are using squared distances
|
125 |
+
# cv2.circle(vertex_mask, coords, radius - 5, (255, ), 2 * (radius - 5), -1)
|
126 |
# vertex_size *= scale
|
127 |
for edge_class in ['eave', 'ridge', 'rake', 'valley', 'flashing', 'step_flashing']:
|
128 |
if len(apex_pts) < 2:
|