MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / init_image_coor

Function init_image_coor

lib/test_utils.py:8–21  ·  view source on GitHub ↗
(height, width, u0=None, v0=None)

Source from the content-addressed store, hash-verified

6import os
7
8def init_image_coor(height, width, u0=None, v0=None):
9 u0 = width / 2.0 if u0 is None else u0
10 v0 = height / 2.0 if v0 is None else v0
11
12 x_row = np.arange(0, width)
13 x = np.tile(x_row, (height, 1))
14 x = x.astype(np.float32)
15 u_u0 = x - u0
16
17 y_col = np.arange(0, height)
18 y = np.tile(y_col, (width, 1)).T
19 y = y.astype(np.float32)
20 v_v0 = y - v0
21 return u_u0, v_v0
22
23def depth_to_pcd(depth, u_u0, v_v0, f, invalid_value=0):
24 mask_invalid = depth <= invalid_value

Callers 2

refine_focal_one_stepFunction · 0.85
refine_shift_one_stepFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected