当前位置:网站首页>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)
边栏推荐
- Introduction to the basic concept of queue and typical application examples
- Sentinel 简单使用
- 汉诺塔问题的求解与分析
- [flask] ORM one-to-one relationship
- Sqli labs Level 2
- Mutex
- gocv opencv exit status 3221225785
- Sqli labs (post type injection)
- 1、 QT's core class QObject
- Analysis of the use of comparable, comparator and clonable interfaces
猜你喜欢

Sentinel 简单使用

Web技术发展史

Linux安装Oracle Database 19c
![[untitled]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[untitled]

Sqli labs (post type injection)

Luogu greedy part of the backpack line segment covers the queue to receive water

Googlenet network explanation and model building

Illegal use of crawlers, an Internet company was terminated, the police came to the door, and 23 people were taken away

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

kubernetes部署loki日志系统
随机推荐
HCIA—数据链路层
STM32 new project (refer to punctual atom)
Count the number of various characters in the string
Driving test Baodian and its spokesperson Huang Bo appeared together to call for safe and civilized travel
Minecraft plug-in service opening
Sentinel 简单使用
Select sort and insert sort
Sqli labs level 8 (Boolean blind note)
Qt的拖动事件
C# 将网页保存为图片(利用WebBrowser)
Sqli labs level 12
Kubesphere virtualization KSV installation experience
First week of JS study
图像变换,转置
kubernetes部署loki日志系统
Flex layout
C language custom type enumeration, Union (clever use of enumeration, calculation of union size)
ARP及ARP欺骗
Chrome debugging
Luogu greedy part of the backpack line segment covers the queue to receive water