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

Function read_img

ldm/modules/image_degradation/utils_image.py:220–230  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

218# get single image of size HxWxn_channles (BGR)
219# --------------------------------------------
220def read_img(path):
221 # read image by cv2
222 # return: Numpy float32, HWC, BGR, [0,1]
223 img = cv2.imread(path, cv2.IMREAD_UNCHANGED) # cv2.IMREAD_GRAYSCALE
224 img = img.astype(np.float32) / 255.
225 if img.ndim == 2:
226 img = np.expand_dims(img, axis=2)
227 # some images have 4 channels
228 if img.shape[2] > 3:
229 img = img[:, :, :3]
230 return img
231
232
233'''

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected