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

Function write_image

eval_code/recons/models/moge/utils/io.py:78–86  ·  view source on GitHub ↗

Write a image, input uint8 RGB array of shape (H, W, 3).

(path: Union[str, os.PathLike, IO], image: np.ndarray, quality: int = 95)

Source from the content-addressed store, hash-verified

76
77
78def write_image(path: Union[str, os.PathLike, IO], image: np.ndarray, quality: int = 95):
79 """
80 Write a image, input uint8 RGB array of shape (H, W, 3).
81 """
82 data = cv2.imencode('.jpg', cv2.cvtColor(image, cv2.COLOR_RGB2BGR), [cv2.IMWRITE_JPEG_QUALITY, quality])[1].tobytes()
83 if isinstance(path, (str, os.PathLike)):
84 Path(path).write_bytes(data)
85 else:
86 path.write(data)
87
88
89def read_depth(path: Union[str, os.PathLike, IO]) -> Tuple[np.ndarray, float]:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected