MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / apply_image

Method apply_image

utils/sam_utils/transforms.py:26–31  ·  view source on GitHub ↗

Expects a numpy array with shape HxWxC in uint8 format.

(self, image: np.ndarray)

Source from the content-addressed store, hash-verified

24 self.target_length = target_length
25
26 def apply_image(self, image: np.ndarray) -> np.ndarray:
27 """
28 Expects a numpy array with shape HxWxC in uint8 format.
29 """
30 target_size = self.get_preprocess_shape(image.shape[0], image.shape[1], self.target_length)
31 return np.array(resize(to_pil_image(image), target_size))
32
33 def apply_coords(self, coords: np.ndarray, original_size: Tuple[int, ...]) -> np.ndarray:
34 """

Callers

nothing calls this directly

Calls 1

get_preprocess_shapeMethod · 0.95

Tested by

no test coverage detected