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

Function read_image

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

Read a image, return uint8 RGB array of shape (H, W, 3).

(path: Union[str, os.PathLike, IO])

Source from the content-addressed store, hash-verified

64
65
66def read_image(path: Union[str, os.PathLike, IO]) -> np.ndarray:
67 """
68 Read a image, return uint8 RGB array of shape (H, W, 3).
69 """
70 if isinstance(path, (str, os.PathLike)):
71 data = Path(path).read_bytes()
72 else:
73 data = path.read()
74 image = cv2.cvtColor(cv2.imdecode(np.frombuffer(data, np.uint8), cv2.IMREAD_COLOR), cv2.COLOR_BGR2RGB)
75 return image
76
77
78def write_image(path: Union[str, os.PathLike, IO], image: np.ndarray, quality: int = 95):

Callers

nothing calls this directly

Calls 1

readMethod · 0.80

Tested by

no test coverage detected