当前位置:网站首页>Gocv image cutting and display
Gocv image cutting and display
2022-07-02 08:50:00 【Tutu is a cat】
gocv Realize picture clipping
New window
window := gocv.NewWindow("Hello")
Read the picture
read := gocv.IMRead("image/front.jpg", gocv.IMReadColor)
Type conversion
frontImg, _ := read.ToImage()
Color type
rgbImg := frontImg.(*image.RGBA)
Picture cutting :Rect Function (950,100) Top left coordinates , Bottom left coordinates (1300,700) It can be cut into rectangle
subImg := rgbImg.SubImage(image.Rect(950, 100, 1300, 700)).(*image.RGBA)
Store image
out, _ := os.Create("image/front_face.jpg")
png.Encode(out, subImg)
Read the picture
result := gocv.IMRead("image/front_face.jpg",gocv.IMReadColor)
Set the window size according to the above picture size
window.ResizeWindow(1300-950,700-100)
Picture display to window
window.IMShow(result)
window.WaitKey(0)
边栏推荐
- C# 将网页保存为图片(利用WebBrowser)
- IP protocol and IP address
- Concise analysis of redis source code 11 - Main IO threads and redis 6.0 multi IO threads
- Sqli labs Level 2
- Openfeign is easy to use
- Realization of basic function of sequence table
- Analysis and solution of a classical Joseph problem
- Hcia - Application Layer
- 图像变换,转置
- Qt的connect函数和disconnect函数
猜你喜欢

ICMP协议

Honeypot attack and defense drill landing application scheme

Detailed explanation of NIN network

IP协议与IP地址

C language custom type enumeration, Union (clever use of enumeration, calculation of union size)

Linux binary installation Oracle database 19C

Chrome debugging

C#钉钉开发:取得所有员工通讯录和发送工作通知

Solution and analysis of Hanoi Tower problem

OpenShift 容器平台社区版 OKD 4.10.0部署
随机推荐
kubernetes部署loki日志系统
什么是SQL注入
Gateway is easy to use
Nacos 下载启动、配置 MySQL 数据库
ARP及ARP欺骗
Qt的拖动事件
Pclpy projection filter -- projection of point cloud to cylinder
Network security - summary and thinking of easy-to-use fuzzy tester
Sqli labs level 8 (Boolean blind note)
整理秒杀系统的面试必备!!!
PCL calculates the intersection of three mutually nonparallel planes
File upload Labs
Qt QTimer类
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
Linux安装Oracle Database 19c RAC
Synchronize files using unison
Web security -- core defense mechanism
Aneng logistics' share price hit a new low: the market value evaporated by nearly 10 billion yuan, and it's useless for chairman Wang Yongjun to increase his holdings
Minecraft air Island service
使用递归函数求解字符串的逆置问题