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

View File

@@ -1 +1 @@
v5.0.0+2412081145
v5.0.0+2412081202

View File

@@ -57,9 +57,12 @@ func (o OCRResults) ToOCRTexts() (ocrTexts OCRTexts) {
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{
Text: ocrResult.Text,
Rect: rect,
Text: ocrResult.Text,
Rect: rect,
RectStr: rectStr,
}
ocrTexts = append(ocrTexts, ocrText)
}
@@ -67,8 +70,9 @@ func (o OCRResults) ToOCRTexts() (ocrTexts OCRTexts) {
}
type OCRText struct {
Text string
Rect image.Rectangle
Text string `json:"text"`
RectStr string `json:"rect"`
Rect image.Rectangle `json:"-"`
}
func (t OCRText) Size() Size {

View File

@@ -80,7 +80,7 @@ type DriverResult struct {
Success bool `json:"success"`
ResponseStatus int `json:"response_status"`
ResponseDuration int64 `json:"response_duration(ms)"` // ms
ResponseBody string `json:"response_body,omitempty"`
ResponseBody string `json:"response_body"`
Error string `json:"error,omitempty"`
}