Commit 390e41e0 authored by 赵威's avatar 赵威

update request f

parent b773aebf
......@@ -10,6 +10,7 @@ from PIL import Image
def url_to_ndarray(url):
try:
result = requests.get(url, timeout=30)
if result.ok:
img = Image.open(io.BytesIO(result.content))
......@@ -19,7 +20,9 @@ def url_to_ndarray(url):
else:
print("http get: {}".format(result.status_code))
return np.array([])
except Exception as e:
print(e)
return np.array([])
def file_to_ndarray(path):
result = cv2.imread(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