utils.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:kaggle-dstl-satellite-imagery-feature-detection 作者: u1234x1234 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号