MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / create_pan_cameras

Function create_pan_cameras

diffusers/src/diffusers/pipelines/shap_e/camera.py:122–147  ·  view source on GitHub ↗
(size: int)

Source from the content-addressed store, hash-verified

120
121
122def create_pan_cameras(size: int) -> DifferentiableProjectiveCamera:
123 origins = []
124 xs = []
125 ys = []
126 zs = []
127 for theta in np.linspace(0, 2 * np.pi, num=20):
128 z = np.array([np.sin(theta), np.cos(theta), -0.5])
129 z /= np.sqrt(np.sum(z**2))
130 origin = -z * 4
131 x = np.array([np.cos(theta), -np.sin(theta), 0.0])
132 y = np.cross(z, x)
133 origins.append(origin)
134 xs.append(x)
135 ys.append(y)
136 zs.append(z)
137 return DifferentiableProjectiveCamera(
138 origin=torch.from_numpy(np.stack(origins, axis=0)).float(),
139 x=torch.from_numpy(np.stack(xs, axis=0)).float(),
140 y=torch.from_numpy(np.stack(ys, axis=0)).float(),
141 z=torch.from_numpy(np.stack(zs, axis=0)).float(),
142 width=size,
143 height=size,
144 x_fov=0.7,
145 y_fov=0.7,
146 shape=(1, len(xs)),
147 )

Callers 1

decode_to_imageMethod · 0.85

Calls 1

Tested by

no test coverage detected