MCPcopy
hub / github.com/cvg/Hierarchical-Localization / read_image

Function read_image

hloc/utils/io.py:10–20  ·  view source on GitHub ↗
(path, grayscale=False)

Source from the content-addressed store, hash-verified

8
9
10def read_image(path, grayscale=False):
11 if grayscale:
12 mode = cv2.IMREAD_GRAYSCALE
13 else:
14 mode = cv2.IMREAD_COLOR
15 image = cv2.imread(str(path), mode)
16 if image is None:
17 raise ValueError(f'Cannot read image {path}.')
18 if not grayscale and len(image.shape) == 3:
19 image = image[:, :, ::-1] # BGR to RGB
20 return image
21
22
23def list_h5_names(path):

Callers 5

visualize_sfm_2dFunction · 0.85
visualize_loc_from_logFunction · 0.85
__init__Method · 0.85
__getitem__Method · 0.85
__getitem__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected