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

Function chessboard

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

get x chessboard image Args: width (int): image width height (int): image height grid_size (int): size of chessboard grid color_a (np.ndarray): color of the grid at the top-left corner color_b (np.ndarray): color in complementary grid cells Returns:

(width: int, height: int, grid_size: int, color_a: np.ndarray, color_b: np.ndarray)

Source from the content-addressed store, hash-verified

568
569
570def chessboard(width: int, height: int, grid_size: int, color_a: np.ndarray, color_b: np.ndarray) -> np.ndarray:
571 """get x chessboard image
572
573 Args:
574 width (int): image width
575 height (int): image height
576 grid_size (int): size of chessboard grid
577 color_a (np.ndarray): color of the grid at the top-left corner
578 color_b (np.ndarray): color in complementary grid cells
579
580 Returns:
581 image (np.ndarray): shape (height, width, channels), chessboard image
582 """
583 x = np.arange(width) // grid_size
584 y = np.arange(height) // grid_size
585 mask = (x[None, :] + y[:, None]) % 2
586 image = (1 - mask[..., None]) * color_a + mask[..., None] * color_b
587 return image
588
589
590def square(tri: bool = False) -> Tuple[np.ndarray, np.ndarray]:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected