The business requirement was to adjust the cursor style of the rotate button in Konva.transformer to a rotation icon. I found a method on Stack Overflow, but it wasn’t entirely suitable for my needs.
1const stage = new Konva.Stage({ 2 container: 'container', 3 width: window.innerWidth, 4 height: window.innerHeight 5}); 6 7const layer = new Konva.Layer(); 8stage.add(layer); 9 10const shape = new Konva.Circle({ 11 x: stage.width() / 2, 12 y: stage.height() / 2, 13 radius: 50, 14 fill: 'green' 15}); 16layer.
...
1// CalibCamera calibrates the camera 2func CalibCamera(imgDatas [][]byte, chessboardRowCornerCount int, chessboardColCornerCount int, curImageIndex int) error { 3 // Save the 2D coordinates of the corner points in each image, i.e., pixel coordinates 4 imgPoints := gocv.NewPoints2fVector() 5 defer imgPoints.Close() 6 // Save the 3D coordinates of the corner points in each image, i.e., world coordinates 7 objPoints := gocv.NewPoints3fVector() 8 defer objPoints.Close() 9 // Save the image size 10 imgSize := image.
...
The application storage directory structure is divided into Users\Username\AppData, and is further categorized into three folders: Roaming, Local, and LocalLow.
Windows uses the Local and LocalLow folders to store non-roaming application data (similar to the Local_machine registry) and some application data that is too large to roam. The Roaming folder, on the other hand, is used to store user application data that can roam, such as personalized settings for each user.
...
panic assignment to entry in nil map 尝试向一个未初始化的 map 中赋值。在 Go 语言中,map 是引用类型,必须在使用前通过 make 或字面量初始化,否则它的值为 nil,此时尝试向 nil
...
1. Least Squares Method 1// fitCenterByLeastSquare fits a circle using the least squares method 2func fitCenterByLeastSquare(points []gocv.Point2f) (gocv.Point2f, float32) { 3 var sumX, sumY, sumX2, sumY2, sumXY, sumX3, sumY3, sumX2Y, sumY2X float32 4 for _, p := range points { 5 sumX += p.X 6 sumY += p.Y 7 sumX2 += p.X * p.X 8 sumY2 += p.Y * p.Y 9 sumXY += p.X * p.Y 10 sumX3 += p.X * p.
...
logrus 日志轮转与切割功能 对于访问量大的应用来说日志的自动轮转切割管理是个很重要的问题,如果应用不能妥善处理日志管理,那么会带来很多不必要的维护开
...
反射 允许程序在运行时检查、修改自身的结构和行为。反射通过 reflect 包实现,主要处理类型(Type)和值(Value)的运行时操作。 概念 一般情况下,在
...
Inspired By: Defer, Panic, and Recover panic 和 recover 最近联调的时候遇到一个 gRPC Server 某个接口返回数据为 nil 的情况,因为 Server 正常且实现了该接口,所以在调用时没有报错,但是程序突然终止了,
...
Once sync.Once 是 Go 语言标准库 sync 包中的一个类型,用于确保某个操作在并发环境下只执行一次。它通常用于初始化资源或执行一次性设置操作,避免重复执行带来的问题
...
1. echo Without Parameters
Displays the current state of echo: whether it is on or off. With Parameters
Parameter [on/off]: on turns on command echoing; off turns off command echoing. “Echoing” can be understood as repeating the display. Parameter message: Prints the content of message. @ before echo: Adding @ means the command itself will not be displayed; otherwise, the command itself will be shown. Parameter message > file: Writes the content of message to file, where > means clear and write.
...