Code Monkey home page Code Monkey logo

Comments (7)

hiroi-sora avatar hiroi-sora commented on June 2, 2024 1

@realDGD

感谢你提供的线索。我出于学习的目的 反编译了天若OCR闭源版本,发现它是采用第2种方案。

首先,它的前端界面库 DSkin 原生支持 Html5+CSS3 ,允许直接显示html格式的公式。

然后,首次运行时下载一个 MathJax.js 。通过该js库,将 Latex 格式的文本转变为 html 元素,将该元素更新到软件界面上。

image

from umi-ocr.

hiroi-sora avatar hiroi-sora commented on June 2, 2024 1

image

柳暗花明又一村!我初步实现了公式渲染。

具体原理是,借助 hfmath.js 这个项目,用js脚本将 latex 字符串转变为 svg 字符串。然后在qml中渲染svg图像。

全程只使用qml引擎自带的js解释器,无需引入额外组件,离线运行,支持实时刷新。

不足:

  1. 只支持纯latex公式,不支持混合文本和公式的Markdown格式。
  2. 只支持显示图像,无法用鼠标划选公式。

综合效果没有天若的 MathJax.js 方案那么好,但至少能用😂

from umi-ocr.

hiroi-sora avatar hiroi-sora commented on June 2, 2024

建议收到,之后会考虑

from umi-ocr.

hiroi-sora avatar hiroi-sora commented on June 2, 2024

目前的前端框架支持简单Markdown渲染。但如果要支持latex语法渲染,我研究了一下,都要付出一定的代价。

方案1:

python使用 matplotlib 库将latex字符串渲染为图片,交给前端显示。 matplotlib 大小 16MB 左右。

方案2:

qml中加载一个web浏览器内核,通过 MathJax 等js库渲染网页,将网页嵌入软件面板中显示。qt的浏览器内核要 100MB 左右。

方案3:

python请求在线API服务,获取图片。无法离线使用。

方案4:

生成一个内置 MathJax 库的网页html文件,调用系统浏览器打开渲染。基本无需占用存储空间,但是操作较繁琐,而且不能实时预览更新。

方案5:

使用 LaTeXML 等命令行工具将字符串转为xml文本。但是该工具的安装非常麻烦,且可能无法绿色化(提取出能单独运行的exe)。


总之,我暂时没有找到一个能平衡空间占用与性能的方案。如果各位有建议可以提。

from umi-ocr.

realDGD avatar realDGD commented on June 2, 2024

总之,我暂时没有找到一个能平衡空间占用与性能的方案。如果各位有建议可以提。

天若的开源版本没有渲染的功能,但是闭源有😂在识别出来的那一刻才进行渲染,而不是实时渲染可以减少空间占用和性能吗

from umi-ocr.

realDGD avatar realDGD commented on June 2, 2024
  1. 只支持纯latex公式,不支持混合文本和公式的Markdown格式。

感谢开发者。

我在用pix2text serve中地Mixed模式会碰到将公式识别成普通文本的问题,我觉得这种东西还是专品专用比较好。

开发者是否可将这个功能单独提出来,采取不同的快捷键的方式分别进行文字识别,公式识别和混合识别。我记得pix2text项目是有cnocr,cnstd两个分支。

另外,可能是我一开始用的是天若OCR养成了使用习惯,对于截图OCR的功能我更倾向于文本识别,表格识别,公式识别的划分,而不是采用mixed。同时,该软件截图功能也很全(画图,序号,马赛克,撤销与重做,录制等等),加上翻译功能,我完全不用再安装其他的截图等软件,可以说是All in One。但是天若从2022年后就没更新了,发邮件也没人回复,很多服务的接口都没有(虽然可以自己写,但无奈实在是不会C#)。

我看目前支持本地公式OCR的面向用户的项目其实挺少的(也有可能是这个功能的使用对象比较小众,最近挺火的PixPin也没人在request提这个功能。),感觉这个方向很不错。

from umi-ocr.

RarityBrown avatar RarityBrown commented on June 2, 2024

纯公式的情况下也许可以考虑 CortexJS,目前 SimpleTex 正在使用的方案,不仅支持实时渲染预览,还支持一定程度的 wysiwyg 公式编辑。

from umi-ocr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.