mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🎨 桌面端支持搜索图片 OCR 文本 https://github.com/siyuan-note/siyuan/issues/3470
This commit is contained in:
parent
d65bce4a17
commit
5593542f73
1 changed files with 15 additions and 3 deletions
|
|
@ -42,10 +42,22 @@ var (
|
||||||
assetsTextsChanged = false
|
assetsTextsChanged = false
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetAssetText(assets string) string {
|
func GetAssetText(asset string) string {
|
||||||
assetsTextsLock.Lock()
|
assetsTextsLock.Lock()
|
||||||
defer assetsTextsLock.Unlock()
|
ret, ok := assetsTexts[asset]
|
||||||
return assetsTexts[assets]
|
assetsTextsLock.Unlock()
|
||||||
|
if ok {
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
assetsPath := GetDataAssetsAbsPath()
|
||||||
|
assetAbsPath := strings.TrimPrefix(asset, "assets")
|
||||||
|
assetAbsPath = filepath.Join(assetsPath, assetAbsPath)
|
||||||
|
ret = Tesseract(assetAbsPath)
|
||||||
|
assetsTextsLock.Lock()
|
||||||
|
assetsTexts[asset] = ret
|
||||||
|
assetsTextsLock.Unlock()
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func Tesseract(imgAbsPath string) string {
|
func Tesseract(imgAbsPath string) string {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue