Skip to content

Commit 4ad7f4a

Browse files
committed
拆分及合并图像通道
1 parent 750ec93 commit 4ad7f4a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,4 @@ Intel Media SDK现在可以被我们的videoio模块用来进行硬件加速的
7979

8080
- 支付宝
8181
- <img src="data/alipay_donate.jpg" width = "200" height = "200" alt="alipay_donate" />
82-
83-
- 比特币
84-
- 以太坊
82+

ch09-图像的基础操作/9.split_color.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77

88
#
99
b,g,r=cv2.split(img)#比较耗时的操作,请使用numpy 索引
10-
img=cv2.merge(b,g,r)
11-
10+
img=cv2.merge((b,g,r))
1211
#
1312
b=img[:,:,0]
1413

1514
#使所有像素的红色通道值都为 0,你不必先拆分再赋值。
1615
# 你可以 直接使用 Numpy 索引,这会更快。
1716
img[:,:,2]=0
1817

18+
#保存到文件,看下效果
19+
cv2.imwrite(filename='split_color2.jpg',img=img)
20+
1921

2022

2123

69.7 KB
Loading

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy