Closed animanl00ver closed 2 years ago
The heuristic text detection is not 100% accurate. See the docs for details.
Basically, it first gets all possible text areas and then filters areas with low confidence. It may include non-text areas.
In addition, it needs the characters separate from other drawings as it uses a connected-component labeling method to group words into paragraphs.
I'd recommend you to apply for Google Vision to use its OCR service if you need a higher accuracy.
I applied for the google vision api. I pasted the api key. But after clicking on ocr nothing happens. Is there more settings to be done?
Check if you've pasted it correctly. Remove trailing whitespaces if there are.
There are no white spaces Check the screenshots
I think you've applied a wrong key. It should be an API key, not keys of a service account.
The following is a screenshot of my account page:
The page's URL: https://console.cloud.google.com/apis/credentials
Oh! I was pasting the wrong key. Please tell me how to create the key.
I clicked on Create Credentials and then on Create API key. Then this key generated. Is this the right one?
This one is right.
I pasted this new one still nothing happens when I click on ocr.
Run ImageTrans from PowerShell to see the output to check what is wrong.
https://user-images.githubusercontent.com/5462205/123396509-f5960f00-d5d3-11eb-8c7b-58bd9ffb9b90.mp4
The command line:
.\jre\bin\java -jar ImageTrans.jar
If the API is not valid, then you can see an output like this:
ResponseError. Reason: , Response: {
"error": {
"code": 400,
"message": "API key not valid. Please pass a valid API key.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "API_KEY_INVALID",
"domain": "googleapis.com",
"metadata": {
"service": "vision.googleapis.com"
}
}
]
}
}
PS C:\Users\soura> E:\ImageTrans\ImageTrans\jre\bin\java -jar ImageTrans.jar Error: Unable to access jarfile ImageTrans.jar
There is no java folder in my imagetrans setup
You should run this under the ImageTrans folder: E:\ImageTrans\ImageTrans\
Input: cd E:\ImageTrans\ImageTrans\
run(MyMap) {lang=en, img=javafx.scene.image.Image@2ab6b61f} ResponseError. Reason: Forbidden, Response: { "error": { "code": 403, "message": "This API method requires billing to be enabled. Please enable billing on project #563413037439 by visiting https://console.developers.google.com/billing/enable?project=563413037439 then retry. If you enabled billing for this project recently, wait a few minutes for the action to propagate to our systems and retry.", "status": "PERMISSION_DENIED", "details": [ { "@type": "type.googleapis.com/google.rpc.Help", "links": [ { "description": "Google developers console billing", "url": "https://console.developers.google.com/billing/enable?project=563413037439" } ] }, { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "BILLING_DISABLED", "domain": "googleapis.com", "metadata": { "service": "vision.googleapis.com", "consumer": "projects/563413037439" } } ] } }
(ArrayList) []
This is the error in PowerShell. And the reason I was struggling with google is because the other ocr's are not able to recognise the text. (check the below images So I thought google may help.
You can use baidu:
Tesseract also works:
You should OCR a single bubble instead of the entire image.
All other ocr's don't work and baidu is giving this error:
error: java.lang.RuntimeException: Object should first be initialized (List). StackTrace: java.lang.RuntimeException: Object should first be initialized (List). at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32) at anywheresoftware.b4a.objects.collections.List.getSize(List.java:117) at org.xulihang.imagetrans.ocr$ResumableSub_GetTextWithLocation.resume(ocr.java:2407) at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:136) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:85) at anywheresoftware.b4a.BA.raiseEvent(BA.java:78) at anywheresoftware.b4a.keywords.Common$3.run(Common.java:1086) at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177) at java.lang.Thread.run(Unknown Source)
Tesseract works well only in few places rest all is like this:
Setting the display percentage to 100% will improve the result. And install the latest version of Tesseract: https://github.com/UB-Mannheim/tesseract/wiki
Can you visit www.baidu.com? If not, Baidu may be blocked in your country.
baidu.com is not opening
and I have installed the latest version only tesseract-ocr-w64-setup-v5.0.0-alpha.20210506.exe (64 bit) resp.
Baidu and other Chinese OCR engines work great. But sadly, you cannot use them. You can try enabling the billing of Google.
As for offline OCRs, I haven't found a very good English OCR engine for your images.
Can you add the option of exporting the chat bubbles only without any ocr. All stacked in line. I will use it to work around with google ocr.
Go to Export->Document for translation, save as docx. It will crop bubbles without text and save them to the docx file.
I selected Use image clips for areas without source text? Yes for export the document for translation in docx file. I got this error:
error: java.lang.IllegalArgumentException: Invalid crop bounds: x [1], y [1144], width [140] and height [-64] must all be >= 0 StackTrace: java.lang.IllegalArgumentException: Invalid crop bounds: x [1], y [1144], width [140] and height [-64] must all be >= 0 at org.imgscalr.Scalr.crop(Scalr.java:850) at anywheresoftware.b4a.objects.B4XViewWrapper$B4XBitmapWrapper.Crop(B4XViewWrapper.java:868) at org.xulihang.imagetrans.main._croppedbox(main.java:3717) at org.xulihang.imagetrans.exporter._export(exporter.java:497) at org.xulihang.imagetrans.main$ResumableSub_MenuBar1_Action.resume(main.java:10260) at org.xulihang.imagetrans.main._menubar1_action(main.java:9559) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91) at anywheresoftware.b4a.BA$1.run(BA.java:216) at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177) at java.lang.Thread.run(Unknown Source)
Can you add the option of exporting the chat bubbles only without any ocr. All stacked in line. I will use it to work around with google ocr.
export chat bubbles only like this:
How did you generate text areas? Make sure every one is within the image.
This option is exporting the text in docx file. I want to export only the bubbles of chat in one image file. Check the above image I have attached.
Go to Export->Document for translation, save as docx. It will crop bubbles without text and save them to the docx file.
Save the docx file to an html file and then you can get all the bubble images.
I got it now. I first used 'Detect balloons' and then exported it to docx file and got the bubble images as I wanted. Using 'Detect text areas and recognize text' was giving the text and not the image. Thank once again very much for your support.
when im translating sometimes its erases the bubbles or if theres it skips some of the bubbles and dont translate it and alsothe programs have trouble translating when the website has a lot of water marks it tries to translating part of the drawing