MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / image_scrcoord

Function image_scrcoord

eval_code/recons/models/moge/utils3d/numpy/utils.py:321–341  ·  view source on GitHub ↗

Get OpenGL's screen space coordinates, ranging in [0, 1]. [0, 0] is the bottom-left corner of the image. Args: width (int): image width height (int): image height Returns: (np.ndarray): shape (height, width, 2)

(
    width: int,
    height: int,
)

Source from the content-addressed store, hash-verified

319
320
321def image_scrcoord(
322 width: int,
323 height: int,
324) -> np.ndarray:
325 """
326 Get OpenGL's screen space coordinates, ranging in [0, 1].
327 [0, 0] is the bottom-left corner of the image.
328
329 Args:
330 width (int): image width
331 height (int): image height
332
333 Returns:
334 (np.ndarray): shape (height, width, 2)
335 """
336 x, y = np.meshgrid(
337 np.linspace(0.5 / width, 1 - 0.5 / width, width, dtype=np.float32),
338 np.linspace(1 - 0.5 / height, 0.5 / height, height, dtype=np.float32),
339 indexing='xy'
340 )
341 return np.stack([x, y], axis=2)
342
343
344def image_uv(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected