def get_rgb_image(img_id, h=None, w=None):
image = get_rgb_data(img_id)
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
for c in range(3):
min_val, max_val = np.percentile(image[:, :, c], [2, 98])
image[:, :, c] = 255*(image[:, :, c] - min_val) / (max_val - min_val)
image[:, :, c] = np.clip(image[:, :, c], 0, 255)
image = (image).astype(np.uint8)
if h and w:
image = cv2.resize(image, (w, h), interpolation=cv2.INTER_LANCZOS4)
return image
utils.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录