Commit 5931f297 authored by 吴升宇's avatar 吴升宇

fix handle

parent d1cb0ff2
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import argparse
import cv2
import urllib
import numpy as np
from maskrcnn_benchmark.config import cfg
from demo.predictor import COCODemo
......@@ -69,11 +71,10 @@ def img_to_three_color_map(img):
def handle_from_url(image_url):
""" 处理网路图片 """
cap = cv2.VideoCapture(image_url)
if (cap.isOpened()):
ret, img = cap.read()
return img_to_three_color_map(img)
return None
resp = urllib.request.urlopen(image_url)
image = np.asarray(bytearray(resp.read()), dtype="uint8")
image = cv2.imdecode(image, cv2.IMREAD_COLOR)
return img_to_three_color_map(image)
def handle_from_path(image_path):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment