File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ import cv2
3+ import numpy as np
4+ import matplotlib .pyplot as plt
5+
6+ #读取原始图像
7+ img = cv2 .imread ('people.png' )
8+
9+ #图像向下取样
10+ r1 = cv2 .pyrDown (img )
11+ r2 = cv2 .pyrDown (r1 )
12+ r3 = cv2 .pyrDown (r2 )
13+
14+ #显示图像
15+ cv2 .imshow ('original' , img )
16+ cv2 .imshow ('PyrDown1' , r1 )
17+ cv2 .imshow ('PyrDown2' , r2 )
18+ cv2 .imshow ('PyrDown3' , r3 )
19+ cv2 .waitKey ()
20+ cv2 .destroyAllWindows ()
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ import cv2
3+ import numpy as np
4+ import matplotlib .pyplot as plt
5+
6+ #读取原始图像
7+ img = cv2 .imread ('lena.png' )
8+
9+ #图像向上取样
10+ r = cv2 .pyrUp (img )
11+
12+ #显示图像
13+ cv2 .imshow ('original' , img )
14+ cv2 .imshow ('PyrUp' , r )
15+ cv2 .waitKey ()
16+ cv2 .destroyAllWindows ()
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ import cv2
3+ import numpy as np
4+ import matplotlib .pyplot as plt
5+
6+ #读取原始图像
7+ img = cv2 .imread ('lena2.png' )
8+
9+ #图像向上取样
10+ r1 = cv2 .pyrUp (img )
11+ r2 = cv2 .pyrUp (r1 )
12+ r3 = cv2 .pyrUp (r2 )
13+
14+ #显示图像
15+ cv2 .imshow ('original' , img )
16+ cv2 .imshow ('PyrUp1' , r1 )
17+ cv2 .imshow ('PyrUp2' , r2 )
18+ cv2 .imshow ('PyrUp3' , r3 )
19+ cv2 .waitKey ()
20+ cv2 .destroyAllWindows ()
You can’t perform that action at this time.
0 commit comments