fix: run ocr alone without opencv

This commit is contained in:
debugtalk
2022-09-21 18:11:26 +08:00
parent 937b48236e
commit 976e715357
11 changed files with 42 additions and 24 deletions
+11 -1
View File
@@ -22,7 +22,6 @@ import (
type TemplateMatchMode int
type CVArgs struct {
scale float64
matchMode TemplateMatchMode
threshold float64
}
@@ -46,6 +45,7 @@ type DriverExt struct {
windowSize gwda.Size
frame *bytes.Buffer
doneMjpegStream chan bool
scale float64
CVArgs
}
@@ -60,6 +60,10 @@ func extend(driver gwda.WebDriver) (dExt *DriverExt, err error) {
return nil, errors.Wrap(err, "failed to get windows size")
}
if dExt.scale, err = dExt.Scale(); err != nil {
return nil, err
}
return dExt, nil
}
@@ -213,6 +217,12 @@ func (dExt *DriverExt) FindUIRectInUIKit(search string) (x, y, width, height flo
return dExt.FindImageRectInUIKit(search)
}
func (dExt *DriverExt) MappingToRectInUIKit(rect image.Rectangle) (x, y, width, height float64) {
x, y = float64(rect.Min.X)/dExt.scale, float64(rect.Min.Y)/dExt.scale
width, height = float64(rect.Dx())/dExt.scale, float64(rect.Dy())/dExt.scale
return
}
func (dExt *DriverExt) PerformTouchActions(touchActions *gwda.TouchActions) error {
return dExt.PerformAppiumTouchActions(touchActions)
}