fix(kamite): revert to constant snip size for Kamite
fixes the snip being too large for larger window widths
This commit is contained in:
parent
5557af8306
commit
6c0616868b
|
@ -31,10 +31,10 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
kamiteRecognizeImageSnipScale = 0.8
|
||||
kamiteCMDEndpointBaseTpl = "http://localhost:%d/cmd/"
|
||||
kamiteOCRImageEndpoint = "ocr/image"
|
||||
kamiteOCRManualBlockEndpoint = "ocr/manual-block"
|
||||
kamiteRecognizeImageSnipDimensionPx = 500
|
||||
)
|
||||
|
||||
func (app *App) kamiteRecognizeManualBlock() {
|
||||
|
@ -104,7 +104,7 @@ func (app *App) kamiteRecognizeImageUnderCursorBlock() {
|
|||
srcRowstride := srcPixbuf.GetRowstride()
|
||||
|
||||
// 4. Grab area around the cursor
|
||||
snipDim := app.kamiteSnipDimension()
|
||||
snipDim := kamiteRecognizeImageSnipDimensionPx
|
||||
snipSourceX0, snipSourceY0 := targetX-(snipDim/2), targetY-(snipDim/2)
|
||||
snipBytes := make([]int, snipDim*snipDim)
|
||||
for y := 0; y < snipDim; y++ {
|
||||
|
@ -131,11 +131,6 @@ func (app *App) kamiteRecognizeImageUnderCursorBlock() {
|
|||
)
|
||||
}
|
||||
|
||||
func (app *App) kamiteSnipDimension() int {
|
||||
w, _ := app.getImageAreaInnerSize()
|
||||
return int(kamiteRecognizeImageSnipScale * float64(w))
|
||||
}
|
||||
|
||||
type KamiteOCRImageCommandParams struct {
|
||||
Pixels string `json:"pixels"`
|
||||
Width int `json:"width"`
|
||||
|
|
Loading…
Reference in a new issue