python c++读取网络图片性能对比
【摘要】
import timeimport numpy as np import cv2import requests urls=["http://www.pptbz.com/pptpic/UploadFiles_6909/201203/2012031220134655.jpg","http://pic22.nipic.com/20120714/96...
-
import time
-
import numpy as np
-
-
import cv2
-
import requests
-
-
-
urls=["http://www.pptbz.com/pptpic/UploadFiles_6909/201203/2012031220134655.jpg","http://pic22.nipic.com/20120714/9622064_105642209176_2.jpg","http://pic104.nipic.com/file/20160715/6171480_185807154956_2.jpg",
-
-
"http://www.pptbz.com/pptpic/UploadFiles_6909/201203/2012031220134655.jpg"]
-
-
for i in urls:
-
start=time.time()
-
file = requests.get(i)
-
img = cv2.imdecode(np.fromstring(file.content, np.uint8), 1) #file.content 是读取的远程文件的字节流
-
print('time',time.time()-start)
时间:
time 0.4249999523162842
time 0.546999454498291
time 0.5099942684173584
time 0.3579742908477783
-
#include <Windows.h>
-
-
#include <tchar.h>
-
#include <iostream>
-
#include <urlmon.h>
-
-
#pragma comment(lib
文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/88761116
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)