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

OCR integration #9

Closed
sdaqo opened this issue Apr 1, 2024 · 6 comments
Closed

OCR integration #9

sdaqo opened this issue Apr 1, 2024 · 6 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@sdaqo
Copy link

sdaqo commented Apr 1, 2024

Hey, first of all thanks a lot for developing this app, it is awesome!
This is a feature request for ocr in this app, this would be a pretty nice feature e.g. for reading physical manga or just for characters on physical stuff that you can't just easily copy-paste.
I would love to integrate this on my own but unfortunately do not have to necessary android dev knowledge to do so. I did however find a library for doing this: https://developers.google.com/ml-kit/vision/text-recognition/v2 this is from google's ml-kit, which is used in things like google lens, it runs on device and it seems like it has an relatively easy API to integrate.
Tell me what you think about this!

@petlyh petlyh added the enhancement New feature or request label Apr 1, 2024
@petlyh petlyh changed the title Feature Request: OCR Integration OCR integration Apr 1, 2024
@petlyh
Copy link
Owner

petlyh commented Apr 1, 2024

Thanks for your feature request. I'm glad you like the app.
While I don't see this feature as strictly necessary since there are separate apps that can recognize text in an image and let you copy it, I think it would be very convenient and a good addition to have it in this app if implementing it won't require too much work (which it probably won't if I use something like ML Kit like you suggested). Just to clarify, what you want is to be able to take a picture (or open an image file), then select part of the recognized text and immediately search for it? Do you have any suggestions on what you think it should look like?

@sdaqo
Copy link
Author

sdaqo commented Apr 1, 2024

Yeah, so essentially you would have a camera button in the search bar or some floating icon in the bottom corner, where you can start the OCR.
I do not know how annoying it would be to implement this but maybe (could also be future thing, don't want to burden you 😅) you could afterwards have the results as a component that slides in from the bottom (probably seen that before on other apps), with this you could search several characters on the same image and you could probably reuse the existing results screen/component. Don't bother if it's too annoying and just implement it as you suggested i.e. select text on picture and start a normal search.

@petlyh
Copy link
Owner

petlyh commented Apr 5, 2024

have the results as a component that slides in from the bottom (probably seen that before on other apps), with this you could search several characters on the same image

Could you elaborate on this a bit? I haven't seen it in other apps before, so I don't know exactly what that looks like. Also, by "component that slides in from the bottom", are you referring to a bottom sheet?

@sdaqo
Copy link
Author

sdaqo commented Apr 5, 2024

Yeah exactly

@petlyh petlyh added the wontfix This will not be worked on label Apr 11, 2024
@petlyh
Copy link
Owner

petlyh commented Apr 11, 2024

Finally had time to look into this. I have decided to reject this feature request. These are my reasons:

  • I don't think ML Kit is currently usable enough for Japanese text. It very regularly misrecognizes kanji (and sometimes even kana) even on clear and in-focus pictures of non-handwritten text. It also particularly struggles with vertically written text.
  • The ML Kit libraries are proprietary and their inclusion in this app is incompatible with its GPL-3.0 license. Their inclusion would also exclude the app from F-Droid, which only accepts apps that are completely open-source.
  • I considered using a different OCR library that is open-source called tesseract. However, it is completely unusable for Japanese text from my testing, as it often doesn't get even a single character right from the picture it's given, even in ideal conditions.
  • For both ML Kit and tesseract, the training data required would more than double the download size of the app, which I would like to avoid.

I suggest using a separate app for OCR like I've mentioned previously. I'm planning on making it possible to share text to JS-Dict from other apps, which should make that workflow a bit less tedious.

@petlyh petlyh closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
@sdaqo
Copy link
Author

sdaqo commented Apr 11, 2024

I see, this makes sense, thank you for considering it! (the text sharing would be awesome!)

@gtbkul
Copy link

gtbkul commented Jul 17, 2024

@sdaqo did you check this out, I think this fork implements your requested feature: http://github.com/3nws/JS-Dict

Maybe @petlyh would be able to pull the changes to main repo? As the tesseract seems to work well enough for computer text as seen in the screenshots in the above linked repo. Maybe it can be an optional feature that downloads the necessary assets if the user wishes to use those features, keeping the app size to a minimal

Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants