当前位置:网站首页>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)
边栏推荐
猜你喜欢

History of Web Technology

Analysis of the use of comparable, comparator and clonable interfaces

ARP and ARP Spoofing

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

OpenShift 部署应用

HackTheBox-Gunship

ARP及ARP欺骗

Routing foundation - dynamic routing
![[blackmail virus data recovery] suffix Crylock blackmail virus](/img/b2/8e3a65dd250b9194cfc175138c740c.jpg)
[blackmail virus data recovery] suffix Crylock blackmail virus

Kubedm deploys kubernetes v1.23.5 cluster
随机推荐
D interface and domain problems
File upload and download performance test based on the locust framework
OpenShift 容器平台社区版 OKD 4.10.0部署
Image transformation, transpose
一、Qt的核心类QObject
C# 百度地图,高德地图,Google地图(GPS) 经纬度转换
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
C# 高德地图 根据经纬度获取地址
C language replaces spaces in strings with%20
ICMP协议
Npoi export word font size correspondence
Function ‘ngram‘ is not defined
Flex layout
Zipkin is easy to use
Move a string of numbers backward in sequence
Use Wireshark to grab TCP three handshakes
Using recursive functions to solve the inverse problem of strings
kubernetes部署loki日志系统
C# 调用系统声音 嘀~
Sqli labs Level 2