当前位置:网站首页>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)
边栏推荐
- 群辉 NAS 配置 iSCSI 存储
- Implementation of bidirectional linked list (simple difference, connection and implementation between bidirectional linked list and unidirectional linked list)
- KubeSphere 虚拟化 KSV 安装体验
- 链表经典面试题(反转链表,中间节点,倒数第k个节点,合并分割链表,删除重复节点)
- DWORD ptr[]
- Analysis of the use of comparable, comparator and clonable interfaces
- Honeypot attack and defense drill landing application scheme
- Openshift deployment application
- Carsim 学习心得-粗略翻译1
- ARP and ARP Spoofing
猜你喜欢
Comparable,Comparator,Clonable 接口使用剖析
Openfeign facile à utiliser
Honeypot attack and defense drill landing application scheme
File upload Labs
Minecraft空岛服开服
路由基础—动态路由
2022 Heilongjiang latest construction eight members (materialman) simulated examination questions and answers
Programmer training, crazy job hunting, overtime ridiculed by colleagues deserve it
HCIA—数据链路层
Getting started with k8s: building MySQL with Helm
随机推荐
sqli-labs第8关(布尔盲注)
One of the reasons for WCF update service reference error
cve_ 2019_ 0708_ bluekeep_ Rce vulnerability recurrence
Jumping | Blue Bridge Cup
IP协议与IP地址
Use the numbers 5, 5, 5, 1 to perform four operations. Each number should be used only once, and the operation result value is required to be 24
Illegal use of crawlers, an Internet company was terminated, the police came to the door, and 23 people were taken away
2022 Heilongjiang latest food safety administrator simulation exam questions and answers
Linked list classic interview questions (reverse the linked list, middle node, penultimate node, merge and split the linked list, and delete duplicate nodes)
sqli-labs(POST类型注入)
Generate database documents with one click, which can be called swagger in the database industry
顺序表基本功能函数的实现
Minecraft安装资源包
Matlab - autres
HCIA—應用層
STM32-新建工程(参考正点原子)
kubeadm部署kubernetes v1.23.5集群
Use the kaggle training model and download your own training model
sqli-labs第2关
Sqli labs level 12