diff --git a/README.md b/README.md index 80c9e10..3d7f5da 100644 --- a/README.md +++ b/README.md @@ -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() } ``` diff --git a/README_zh.md b/README_zh.md index b971b07..5a2d8e6 100644 --- a/README_zh.md +++ b/README_zh.md @@ -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() } ```