Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 62130eb

Browse files
committed
opencv3 图像处理 4-8
1 parent 3c7e1b8 commit 62130eb

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

opencv3图像处理/demo01.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# @Time : 2020/4/8 14:41
2+
# @Author : Libuda
3+
# @FileName: demo01.py
4+
# @Software: PyCharm
5+
import cv2 as cv
6+
import time
7+
8+
img_path = "test.jpg"
9+
10+
11+
def op_image():
12+
src = cv.imread(img_path)
13+
14+
# 图像分辨率和色彩通道 (1920, 1080, 3)
15+
print(src.shape)
16+
# 图片大小 字节 6220800 (1920 x 1080 x 3)
17+
print(src.size)
18+
19+
# 每个像素三通道 数据类型
20+
print(src.dtype)
21+
22+
# cv.namedWindow("my pic",cv.WINDOW_FULLSCREEN)
23+
24+
cv.imshow("img", src)
25+
26+
cv.waitKey(0)
27+
28+
cv.destroyAllWindows()
29+
30+
31+
def op_vedio():
32+
# 多个摄像头 索引
33+
capture = cv.VideoCapture(0)
34+
35+
while 1:
36+
# frame 图片的每一帧
37+
ret, frame = capture.read()
38+
# 镜像调换 上下 1 为正
39+
frame = cv.flip(frame, -1)
40+
cv.imshow("video", frame)
41+
c = cv.waitKey(50)
42+
43+
# esc退出
44+
if c == 27:
45+
break
46+
47+
48+
def get_op_time():
49+
t1 = cv.getTickCount()
50+
import time
51+
time.sleep(3)
52+
t2 = cv.getTickCount()
53+
54+
time = (t2 - t1) / cv.getTickFrequency()
55+
56+
print(time)
57+
58+
59+
if __name__ == '__main__':
60+
# op_vedio()
61+
get_op_time()

opencv3图像处理/test.jpg

216 KB
Loading

0 commit comments

Comments
 (0)