当前位置:网站首页>gocv图片裁剪并展示
gocv图片裁剪并展示
2022-07-02 06:30:00 【图图是只猫】
gocv实现图片裁剪
新建窗口
window := gocv.NewWindow("Hello")
读取图片
read := gocv.IMRead("image/front.jpg", gocv.IMReadColor)
类型转换
frontImg, _ := read.ToImage()
颜色类型
rgbImg := frontImg.(*image.RGBA)
图片切割 :Rect函数中 (950,100)左上角坐标,左下角坐标(1300,700)即可切割为矩形
subImg := rgbImg.SubImage(image.Rect(950, 100, 1300, 700)).(*image.RGBA)
存储图片
out, _ := os.Create("image/front_face.jpg")
png.Encode(out, subImg)
读取图片
result := gocv.IMRead("image/front_face.jpg",gocv.IMReadColor)
根据上述图片大小设置窗口大小
window.ResizeWindow(1300-950,700-100)
图片展示到窗口
window.IMShow(result)
window.WaitKey(0)
边栏推荐
- Short video with goods source code, double-click to zoom in when watching the video
- Programmer training, crazy job hunting, overtime ridiculed by colleagues deserve it
- 路由基础—动态路由
- Minecraft空岛服开服
- Causes of laptop jam
- Use the kaggle training model and download your own training model
- Illegal use of crawlers, an Internet company was terminated, the police came to the door, and 23 people were taken away
- First week of JS study
- Hcia - Application Layer
- k8s入门:Helm 构建 MySQL
猜你喜欢
Tcp/ip - transport layer
群辉 NAS 配置 iSCSI 存储
Linked list classic interview questions (reverse the linked list, middle node, penultimate node, merge and split the linked list, and delete duplicate nodes)
Googlenet network explanation and model building
Minecraft空岛服开服
Development of digital collection trading website development of metauniverse digital collection
c语言自定义类型枚举,联合(枚举的巧妙使用,联合体大小的计算)
Kubedm deploys kubernetes v1.23.5 cluster
Routing foundation - dynamic routing
Nacos download, start and configure MySQL database
随机推荐
HCIA - application layer
Simple implementation scheme of transcoding and streaming (I)
使用wireshark抓取Tcp三次握手
ARP and ARP Spoofing
Realize bidirectional linked list (with puppet node)
Don't know mock test yet? An article to familiarize you with mock
16: 00 interview, came out at 16:08, the question is really too
文件上传-upload-labs
cve_ 2019_ 0708_ bluekeep_ Rce vulnerability recurrence
Qunhui NAS configuring iSCSI storage
Dip1000 implicitly tagged with fields
Makefile Fundamentals
双向链表的实现(双向链表与单向链表的简单区别联系和实现)
Sqli labs Level 2
Global and Chinese markets of tilting feeders 2022-2028: Research Report on technology, participants, trends, market size and share
Shortcut key to comment code and cancel code in idea
CarSim learning experience - rough translation 1
web安全--逻辑越权
Carsim 学习心得-粗略翻译1
Sentinel 简单使用