run through training set to determine cluster numebr
Browse files- handcrafted_solution.py +6 -6
handcrafted_solution.py
CHANGED
|
@@ -252,7 +252,7 @@ def get_smooth_uv_depth(vertices, depth, gest_seg_np, sfm_depth_np, r=5):
|
|
| 252 |
vertex_depth = np.array(vertex_depth)
|
| 253 |
return uv, vertex_depth
|
| 254 |
|
| 255 |
-
|
| 256 |
from numba import njit, prange
|
| 257 |
@njit(parallel=True)
|
| 258 |
def fill_range(u, v, z, dilate_r, c, sfm_depth_np, sfm_color_np, H, W):
|
|
@@ -266,7 +266,7 @@ def fill_range(u, v, z, dilate_r, c, sfm_depth_np, sfm_color_np, H, W):
|
|
| 266 |
if DUMP_IMG:
|
| 267 |
sfm_color_np[j, i] = c
|
| 268 |
return sfm_depth_np, sfm_color_np
|
| 269 |
-
'''
|
| 270 |
|
| 271 |
def get_SfM_depth(XYZ, rgb, depth_np, gest_seg_np, K, R, t, dilate_r = 5):
|
| 272 |
'''Project 3D sfm pointcloud to the image plane '''
|
|
@@ -295,7 +295,7 @@ def get_SfM_depth(XYZ, rgb, depth_np, gest_seg_np, K, R, t, dilate_r = 5):
|
|
| 295 |
#checked = 0
|
| 296 |
#print('dim of us uv zs rgb:', len(us), len(vs), len(zs), len(rgb))
|
| 297 |
for u,v,z,c in zip(us,vs,zs, rgb):
|
| 298 |
-
|
| 299 |
sfm_depth_np, sfm_color_np = fill_range(u, v, z, dilate_r, c, sfm_depth_np, sfm_color_np, H, W)
|
| 300 |
'''
|
| 301 |
i_range = range(max(0, u - dilate_r), min(W, u + dilate_r))
|
|
@@ -309,7 +309,7 @@ def get_SfM_depth(XYZ, rgb, depth_np, gest_seg_np, K, R, t, dilate_r = 5):
|
|
| 309 |
sfm_depth_np[j, i] = z
|
| 310 |
if DUMP_IMG:
|
| 311 |
sfm_color_np[j, i] = c
|
| 312 |
-
|
| 313 |
|
| 314 |
|
| 315 |
#print(f'checked {checked} pts')
|
|
@@ -784,8 +784,8 @@ def clean_PCD(XYZ, rgb):
|
|
| 784 |
largest_blob_size = 0
|
| 785 |
largest_blob = 0
|
| 786 |
lowest_z = 0
|
| 787 |
-
print('uni label:', len(unique_labels))
|
| 788 |
-
if len(unique_labels) >
|
| 789 |
return XYZ, rgb, lowest_z
|
| 790 |
|
| 791 |
for k in unique_labels:
|
|
|
|
| 252 |
vertex_depth = np.array(vertex_depth)
|
| 253 |
return uv, vertex_depth
|
| 254 |
|
| 255 |
+
'''
|
| 256 |
from numba import njit, prange
|
| 257 |
@njit(parallel=True)
|
| 258 |
def fill_range(u, v, z, dilate_r, c, sfm_depth_np, sfm_color_np, H, W):
|
|
|
|
| 266 |
if DUMP_IMG:
|
| 267 |
sfm_color_np[j, i] = c
|
| 268 |
return sfm_depth_np, sfm_color_np
|
| 269 |
+
'''
|
| 270 |
|
| 271 |
def get_SfM_depth(XYZ, rgb, depth_np, gest_seg_np, K, R, t, dilate_r = 5):
|
| 272 |
'''Project 3D sfm pointcloud to the image plane '''
|
|
|
|
| 295 |
#checked = 0
|
| 296 |
#print('dim of us uv zs rgb:', len(us), len(vs), len(zs), len(rgb))
|
| 297 |
for u,v,z,c in zip(us,vs,zs, rgb):
|
| 298 |
+
'''
|
| 299 |
sfm_depth_np, sfm_color_np = fill_range(u, v, z, dilate_r, c, sfm_depth_np, sfm_color_np, H, W)
|
| 300 |
'''
|
| 301 |
i_range = range(max(0, u - dilate_r), min(W, u + dilate_r))
|
|
|
|
| 309 |
sfm_depth_np[j, i] = z
|
| 310 |
if DUMP_IMG:
|
| 311 |
sfm_color_np[j, i] = c
|
| 312 |
+
|
| 313 |
|
| 314 |
|
| 315 |
#print(f'checked {checked} pts')
|
|
|
|
| 784 |
largest_blob_size = 0
|
| 785 |
largest_blob = 0
|
| 786 |
lowest_z = 0
|
| 787 |
+
#print('uni label:', len(unique_labels))
|
| 788 |
+
if len(unique_labels) > 40:
|
| 789 |
return XYZ, rgb, lowest_z
|
| 790 |
|
| 791 |
for k in unique_labels:
|