MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / read_image

Function read_image

ldm/modules/midas/utils.py:97–113  ·  view source on GitHub ↗

Read image and output RGB image (0-1). Args: path (str): path to file Returns: array: RGB image (0-1)

(path)

Source from the content-addressed store, hash-verified

95
96
97def read_image(path):
98 """Read image and output RGB image (0-1).
99
100 Args:
101 path (str): path to file
102
103 Returns:
104 array: RGB image (0-1)
105 """
106 img = cv2.imread(path)
107
108 if img.ndim == 2:
109 img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
110
111 img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) / 255.0
112
113 return img
114
115
116def resize_image(img):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected