mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +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
|
||||
)
|
||||
|
||||
func GetAssetText(assets string) string {
|
||||
func GetAssetText(asset string) string {
|
||||
assetsTextsLock.Lock()
|
||||
defer assetsTextsLock.Unlock()
|
||||
return assetsTexts[assets]
|
||||
ret, ok := assetsTexts[asset]
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue