当前位置:网站首页>gocv拆分颜色通道
gocv拆分颜色通道
2022-07-02 06:30:00 【图图是只猫】
gocv拆分图片颜色通道
开启窗口
window := gocv.NewWindow("Hello")
设置窗口模式自适应
window.SetWindowProperty(gocv.WindowPropertyAutosize,gocv.WindowAutosize)
读取图片
read := gocv.IMRead("image/front.jpg", gocv.IMReadColor)
查看图片类型
fmt.Println(read.Type())
拆分颜色通道(图像拆分后有3个通道分别是BGR)
var rgbChan1 []gocv.Mat
bgrChan := gocv.Split(read)
图像拆分后每个通道的颜色
//blue:= bgrChan[0]
green := bgrChan[1]
//red := bgrChan[2]
新建黑色图片
back_ch := gocv.Zeros(read.Rows(),read.Cols(),gocv.MatTypeCV8UC1)
将该通道与黑色图片组成3通道图片
rgbChan1 = append(rgbChan1,back_ch)
rgbChan1 = append(rgbChan1,green)
rgbChan1 = append(rgbChan1,back_ch)
建立3通道新图片
image := gocv.NewMatWithSize(read.Rows(),read.Cols(),gocv.MatTypeCV8UC3)
将以上通道与图片组合并展示
gocv.Merge(rgbChan1,&image)
window.IMShow(image)
window.WaitKey(0)
边栏推荐
- Force deduction method summary: find classes
- Web security -- Logical ultra vires
- Openshift build image
- Analysis of the use of comparable, comparator and clonable interfaces
- Force deduction method summary: double pointer
- D interface and domain problems
- 实现双向链表(带傀儡节点)
- Force buckle method summary: sliding window
- C language replaces spaces in strings with%20
- Web安全--核心防御机制
猜你喜欢

IP protocol and IP address

Generate database documents with one click, which can be called swagger in the database industry

ARP and ARP Spoofing

Nacos download, start and configure MySQL database

W10 is upgraded to W11 system, but the screen is black, but the mouse and desktop shortcuts can be used. How to solve it

TCP/IP—传输层

Use the kaggle training model and download your own training model

Sqli labs Level 2

类和对象(类和类的实例化,this,static关键字,封装)

File upload Labs
随机推荐
The source code of the live app. When the verification method is mailbox verification, the verification code is automatically sent to the entered mailbox
Shortcut key to comment code and cancel code in idea
sqli-labs第8关(布尔盲注)
KubeSphere 虚拟化 KSV 安装体验
File upload Labs
2022 Heilongjiang latest food safety administrator simulation exam questions and answers
程序猿学英语-Learning C
Openfeign facile à utiliser
STM32-新建工程(参考正点原子)
OpenFeign 简单使用
sqli-labs(POST类型注入)
Minecraft模组服开服
OpenFeign 簡單使用
链表经典面试题(反转链表,中间节点,倒数第k个节点,合并分割链表,删除重复节点)
什么是SQL注入
C language replaces spaces in strings with%20
Minecraft群组服开服
Hcia - Application Layer
Pclpy projection filter -- projection of point cloud to cylinder
W10 is upgraded to W11 system, but the screen is black, but the mouse and desktop shortcuts can be used. How to solve it