Update README.md

This commit is contained in:
vcaesar 2021-10-28 13:21:25 -04:00
parent 86da52b96d
commit 10ae65cc6c
2 changed files with 20 additions and 2 deletions

View File

@ -240,6 +240,7 @@ func main() {
bit2 := robotgo.ToCBitmap(robotgo.ImgToBitmap(img))
fx, fy := robotgo.FindBitmap(bit2)
fmt.Println("FindBitmap------ ", fx, fy)
robotgo.Move(fx, fy)
arr := robotgo.FindEveryBitmap(bit2)
fmt.Println("Find every bitmap: ", arr)
@ -259,6 +260,7 @@ package main
import (
"fmt"
"math/rand"
"github.com/go-vgo/robotgo"
"github.com/vcaesar/gcv"
@ -293,7 +295,14 @@ func opencv() {
fmt.Print("gcv find image: ")
fmt.Println(gcv.FindImg(img1, img))
fmt.Println(gcv.FindAllImg(img1, img))
fmt.Println()
res := gcv.FindAllImg(img1, img)
fmt.Println(res[0].TopLeft.Y, res[0].Rects.TopLeft.X, res)
x, y := res[0].TopLeft.X, res[0].TopLeft.Y
robotgo.Move(x, y-rand.Intn(5))
robotgo.MilliSleep(100)
robotgo.Click()
}
```

View File

@ -238,6 +238,7 @@ func main() {
bit2 := robotgo.ToCBitmap(robotgo.ImgToBitmap(img))
fx, fy := robotgo.FindBitmap(bit2)
fmt.Println("FindBitmap------ ", fx, fy)
robotgo.Move(fx, fy)
arr := robotgo.FindEveryBitmap(bit2)
fmt.Println("Find every bitmap: ", arr)
@ -257,6 +258,7 @@ package main
import (
"fmt"
"math/rand"
"github.com/go-vgo/robotgo"
"github.com/vcaesar/gcv"
@ -291,7 +293,14 @@ func opencv() {
fmt.Print("gcv find image: ")
fmt.Println(gcv.FindImg(img1, img))
fmt.Println(gcv.FindAllImg(img1, img))
fmt.Println()
res := gcv.FindAllImg(img1, img)
fmt.Println(res[0].TopLeft.Y, res[0].Rects.TopLeft.X, res)
x, y := res[0].TopLeft.X, res[0].TopLeft.Y
robotgo.Move(x, y-rand.Intn(5))
robotgo.MilliSleep(100)
robotgo.Click()
}
```