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

Function path_planning

inpaint/utils.py:29–52  ·  view source on GitHub ↗
(num_frames, x, y, z, path_type='')

Source from the content-addressed store, hash-verified

27from collections import namedtuple
28
29def path_planning(num_frames, x, y, z, path_type=''):
30 if path_type == 'straight-line':
31 corner_points = np.array([[0, 0, 0], [(0 + x) * 0.5, (0 + y) * 0.5, (0 + z) * 0.5], [x, y, z]])
32 corner_t = np.linspace(0, 1, len(corner_points))
33 t = np.linspace(0, 1, num_frames)
34 cs = interp1d(corner_t, corner_points, axis=0, kind='quadratic')
35 spline = cs(t)
36 xs, ys, zs = [xx.squeeze() for xx in np.split(spline, 3, 1)]
37 elif path_type == 'double-straight-line':
38 corner_points = np.array([[-x, -y, -z], [0, 0, 0], [x, y, z]])
39 corner_t = np.linspace(0, 1, len(corner_points))
40 t = np.linspace(0, 1, num_frames)
41 cs = interp1d(corner_t, corner_points, axis=0, kind='quadratic')
42 spline = cs(t)
43 xs, ys, zs = [xx.squeeze() for xx in np.split(spline, 3, 1)]
44 elif path_type == 'circle':
45 xs, ys, zs = [], [], []
46 for frame_id, bs_shift_val in enumerate(np.arange(-2.0, 2.0, (4./num_frames))):
47 xs += [np.cos(bs_shift_val * np.pi) * 1 * x]
48 ys += [np.sin(bs_shift_val * np.pi) * 1 * y]
49 zs += [np.cos(bs_shift_val * np.pi/2.) * 1 * z]
50 xs, ys, zs = np.array(xs), np.array(ys), np.array(zs)
51
52 return xs, ys, zs
53
54def open_small_mask(mask, context, open_iteration, kernel):
55 np_mask = mask.cpu().data.numpy().squeeze().astype(np.uint8)

Callers 2

run_3dphoto_videosFunction · 0.90
get_MiDaS_samplesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected