当前位置:网站首页>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)
边栏推荐
- Sqli labs level 12
- First week of JS study
- Pointer initialization
- Use Wireshark to grab TCP three handshakes
- Loadbalancer dynamically refreshes Nacos server
- Minecraft空岛服开服
- gocv边界填充
- Minecraft模组服开服
- Find the node with the smallest value range in the linked list and move it to the front of the linked list
- Linux安装Oracle Database 19c
猜你喜欢
随机推荐
Tensorflow2 keras classification model
C language replaces spaces in strings with%20
队列的基本概念介绍以及典型应用示例
C nail development: obtain all employee address books and send work notices
Find the node with the smallest value range in the linked list and move it to the front of the linked list
OpenShift构建镜像
sqli-labs(POST类型注入)
HCIA—应用层
Linux安装Oracle Database 19c
Minecraft群组服开服
D interface and domain problems
Makefile基本原理
Getting started with k8s: building MySQL with Helm
C # save web pages as pictures (using WebBrowser)
Concise analysis of redis source code 11 - Main IO threads and redis 6.0 multi IO threads
Loadbalancer dynamically refreshes Nacos server
Routing foundation - dynamic routing
Minecraft插件服开服
Solution of Xiaomi TV's inability to access computer shared files
Pointer initialization

![[blackmail virus data recovery] suffix Hydra blackmail virus](/img/27/f44334cf98229d0f8b33c70a878ca8.jpg)






