mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 15:13:55 +00:00
Update README.md
This commit is contained in:
parent
86da52b96d
commit
10ae65cc6c
11
README.md
11
README.md
@ -240,6 +240,7 @@ func main() {
|
|||||||
bit2 := robotgo.ToCBitmap(robotgo.ImgToBitmap(img))
|
bit2 := robotgo.ToCBitmap(robotgo.ImgToBitmap(img))
|
||||||
fx, fy := robotgo.FindBitmap(bit2)
|
fx, fy := robotgo.FindBitmap(bit2)
|
||||||
fmt.Println("FindBitmap------ ", fx, fy)
|
fmt.Println("FindBitmap------ ", fx, fy)
|
||||||
|
robotgo.Move(fx, fy)
|
||||||
|
|
||||||
arr := robotgo.FindEveryBitmap(bit2)
|
arr := robotgo.FindEveryBitmap(bit2)
|
||||||
fmt.Println("Find every bitmap: ", arr)
|
fmt.Println("Find every bitmap: ", arr)
|
||||||
@ -259,6 +260,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
|
||||||
"github.com/go-vgo/robotgo"
|
"github.com/go-vgo/robotgo"
|
||||||
"github.com/vcaesar/gcv"
|
"github.com/vcaesar/gcv"
|
||||||
@ -293,7 +295,14 @@ func opencv() {
|
|||||||
|
|
||||||
fmt.Print("gcv find image: ")
|
fmt.Print("gcv find image: ")
|
||||||
fmt.Println(gcv.FindImg(img1, img))
|
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()
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
11
README_zh.md
11
README_zh.md
@ -238,6 +238,7 @@ func main() {
|
|||||||
bit2 := robotgo.ToCBitmap(robotgo.ImgToBitmap(img))
|
bit2 := robotgo.ToCBitmap(robotgo.ImgToBitmap(img))
|
||||||
fx, fy := robotgo.FindBitmap(bit2)
|
fx, fy := robotgo.FindBitmap(bit2)
|
||||||
fmt.Println("FindBitmap------ ", fx, fy)
|
fmt.Println("FindBitmap------ ", fx, fy)
|
||||||
|
robotgo.Move(fx, fy)
|
||||||
|
|
||||||
arr := robotgo.FindEveryBitmap(bit2)
|
arr := robotgo.FindEveryBitmap(bit2)
|
||||||
fmt.Println("Find every bitmap: ", arr)
|
fmt.Println("Find every bitmap: ", arr)
|
||||||
@ -257,6 +258,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
|
||||||
"github.com/go-vgo/robotgo"
|
"github.com/go-vgo/robotgo"
|
||||||
"github.com/vcaesar/gcv"
|
"github.com/vcaesar/gcv"
|
||||||
@ -291,7 +293,14 @@ func opencv() {
|
|||||||
|
|
||||||
fmt.Print("gcv find image: ")
|
fmt.Print("gcv find image: ")
|
||||||
fmt.Println(gcv.FindImg(img1, img))
|
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()
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user