Skip to content

Commit

Permalink
拆分及合并图像通道
Browse files Browse the repository at this point in the history
  • Loading branch information
makelove committed Nov 21, 2018
1 parent 750ec93 commit 4ad7f4a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,4 @@ Intel Media SDK现在可以被我们的videoio模块用来进行硬件加速的

- 支付宝
- <img src="data/alipay_donate.jpg" width = "200" height = "200" alt="alipay_donate" />

- 比特币
- 以太坊

6 changes: 4 additions & 2 deletions ch09-图像的基础操作/9.split_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@

#
b,g,r=cv2.split(img)#比较耗时的操作,请使用numpy 索引
img=cv2.merge(b,g,r)

img=cv2.merge((b,g,r))
#
b=img[:,:,0]

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

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




Binary file added ch09-图像的基础操作/split_color2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4ad7f4a

Please sign in to comment.