alg.py 文件源码

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

项目:image-segmentation 作者: alexlouden 项目源码 文件源码
def download_image(url):
    response = requests.get(url, stream=True, timeout=5)
    # TODO use grequests
    # Raise exception on error
    response.raise_for_status()
    numpy_array = np.asarray(bytearray(response.raw.read()), dtype=np.uint8)
    image = cv2.imdecode(numpy_array, cv2.IMREAD_COLOR)
    # TODO: handle transparency (load using cv2.IMREAD_UNCHANGED and convert alpha layer to white?)
    return image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号