MCPcopy Create free account
hub / github.com/dcharatan/flowmap / load_image

Function load_image

flowmap/dataset/dataset_llff.py:27–39  ·  view source on GitHub ↗
(
    path: Path,
    shape: tuple[int, int] | None,
)

Source from the content-addressed store, hash-verified

25
26
27def load_image(
28 path: Path,
29 shape: tuple[int, int] | None,
30) -> tuple[
31 Float[Tensor, "3 height width"], # image
32 tuple[int, int], # image shape after scaling, before cropping
33]:
34 image = Image.open(path)
35 if shape is None:
36 pre_crop_shape = (image.height, image.width)
37 else:
38 image, pre_crop_shape = resize_to_cover(image, shape)
39 return tf.ToTensor()(image)[:3], pre_crop_shape
40
41
42@dataclass

Callers 1

__getitem__Method · 0.70

Calls 1

resize_to_coverFunction · 0.85

Tested by

no test coverage detected