MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / bounding_box

Function bounding_box

k_diffusion/models/axial_rope.py:42–57  ·  view source on GitHub ↗
(h, w, pixel_aspect_ratio=1.0)

Source from the content-addressed store, hash-verified

40
41
42def bounding_box(h, w, pixel_aspect_ratio=1.0):
43 # Adjusted dimensions
44 w_adj = w
45 h_adj = h * pixel_aspect_ratio
46
47 # Adjusted aspect ratio
48 ar_adj = w_adj / h_adj
49
50 # Determine bounding box based on the adjusted aspect ratio
51 y_min, y_max, x_min, x_max = -1.0, 1.0, -1.0, 1.0
52 if ar_adj > 1:
53 y_min, y_max = -1 / ar_adj, 1 / ar_adj
54 elif ar_adj < 1:
55 x_min, x_max = -ar_adj, ar_adj
56
57 return y_min, y_max, x_min, x_max
58
59
60def make_axial_pos(h, w, pixel_aspect_ratio=1.0, align_corners=False, dtype=None, device=None):

Callers 1

make_axial_posFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected