change: simplify ocr texts summary

This commit is contained in:
lilong.129
2024-12-08 12:02:34 +08:00
parent 9830bf4c07
commit aaf36c28ac
3 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -1 +1 @@
v5.0.0+2412081145 v5.0.0+2412081202
+8 -4
View File
@@ -57,9 +57,12 @@ func (o OCRResults) ToOCRTexts() (ocrTexts OCRTexts) {
Y: int(ocrResult.Points[2].Y), Y: int(ocrResult.Points[2].Y),
}, },
} }
rectStr := fmt.Sprintf("%d,%d,%d,%d",
rect.Min.X, rect.Min.Y, rect.Max.X, rect.Max.Y)
ocrText := OCRText{ ocrText := OCRText{
Text: ocrResult.Text, Text: ocrResult.Text,
Rect: rect, Rect: rect,
RectStr: rectStr,
} }
ocrTexts = append(ocrTexts, ocrText) ocrTexts = append(ocrTexts, ocrText)
} }
@@ -67,8 +70,9 @@ func (o OCRResults) ToOCRTexts() (ocrTexts OCRTexts) {
} }
type OCRText struct { type OCRText struct {
Text string Text string `json:"text"`
Rect image.Rectangle RectStr string `json:"rect"`
Rect image.Rectangle `json:"-"`
} }
func (t OCRText) Size() Size { func (t OCRText) Size() Size {
+1 -1
View File
@@ -80,7 +80,7 @@ type DriverResult struct {
Success bool `json:"success"` Success bool `json:"success"`
ResponseStatus int `json:"response_status"` ResponseStatus int `json:"response_status"`
ResponseDuration int64 `json:"response_duration(ms)"` // ms ResponseDuration int64 `json:"response_duration(ms)"` // ms
ResponseBody string `json:"response_body,omitempty"` ResponseBody string `json:"response_body"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }