Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latexocr generate completely off result #241

Open
shrninepoints opened this issue Feb 17, 2023 · 4 comments
Open

Latexocr generate completely off result #241

shrninepoints opened this issue Feb 17, 2023 · 4 comments

Comments

@shrninepoints
Copy link

shrninepoints commented Feb 17, 2023

The pix2tex command line tool works really well for me, generating high quality results most of the time. But the GUI by calling latexocr gives completely random results.

E.g. when pix2tex generate $E=m c^{2}$ the GUI generate $\scriptstyle{\hat{s e}}_{k\in G a l}^{a=1,10}$

Environment: macOS 12.6.3, Python 3.7.7, PyQt5

PS, can you add option in pix2tex command line to automatically bracket with $$? Thanks!

@lukas-blecher
Copy link
Owner

Can you tell me more about your setup. Do you use a second monitor? Do you have a retina display?

I'm still wondering how exactly the screen capture works on macOS. The way you explained the problem, it sounds like the region you select is not actually the region the model gets to see.
I can't really do anything about that at the moment, because I don't have a mac book.

If you want you can find the gui.py file and add img.show() in line 300 to see what the model will see.

https://github.com/lukas-blecher/LaTeX-OCR/blob/main/pix2tex/gui.py#L300

like this:

                img = ImageGrab.grab(bbox=(x1//factor, y1//factor, x2//factor, y2//factor), all_screens=True)
            else:
                raise e
+      img.show()
        QApplication.processEvents()

Possibly related #122 #118 #145

@shrninepoints
Copy link
Author

shrninepoints commented Feb 18, 2023 via email

@kaaass
Copy link

kaaass commented Aug 29, 2023

According to BoboTiG/python-mss#134, Grant screen record permission to the Terminal app (I use the Terminal app to run latexocr) solved the problem for me.

@skymagician
Copy link

According to BoboTiG/python-mss#134, Grant screen record permission to the Terminal app (I use the Terminal app to run latexocr) solved the problem for me.

thank you! I met the same problem, and solved it according to your method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants