当前位置:网站首页>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)
边栏推荐
- Application of kotlin - higher order function
- Sqli labs (post type injection)
- 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
- Find the node with the smallest value range in the linked list and move it to the front of the linked list
- 文件上传-upload-labs
- Programming ape learning English - imperative programming
- Tensorflow2 keras 分类模型
- Essay: RGB image color separation (with code)
- Openshift deployment application
- C language custom type enumeration, Union (clever use of enumeration, calculation of union size)
猜你喜欢

Sqli labs level 12

Web security -- core defense mechanism

Sentinel easy to use

sqli-labs第1关

Web security -- Logical ultra vires

Function ‘ngram‘ is not defined

Solution of Xiaomi TV's inability to access computer shared files

kubernetes部署loki日志系统

Qt——如何在QWidget中设置阴影效果

Use Wireshark to grab TCP three handshakes
随机推荐
sqli-labs第2关
Web security -- Logical ultra vires
寻找链表中值域最小的节点并移到链表的最前面
D interface and domain problems
ICMP协议
Oracle 相关统计
Pclpy projection filter -- projection of point cloud to cylinder
OpenShift 容器平台社区版 OKD 4.10.0部署
Gateway is easy to use
Openshift deployment application
整理秒杀系统的面试必备!!!
Benefits of ufcs of D
Luogu greedy part of the backpack line segment covers the queue to receive water
C# 调用系统声音 嘀~
IP协议与IP地址
Minecraft plug-in service opening
[blackmail virus data recovery] suffix Crylock blackmail virus
Linux安装Oracle Database 19c
Linux安装Oracle Database 19c RAC
文件上传-upload-labs