OCR-Reader | An Android app to extract text from camera preview | Computer Vision library
kandi X-RAY | OCR-Reader Summary
kandi X-RAY | OCR-Reader Summary
An Android app to extract text from camera preview directly.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Override when the view is changed
- Creates a new camera
- Calculates the rotation angle for the given camera id
- Generates a list of acceptable preview sizes for a given camera
- Initialize the camera
- Request the camera permission
- Capture the text block
- Returns the graphic at the specified location
- Returns a callback for the permissions result
- Creates the camera source
- Takes a screenshot
- Starts the auto - focus callback
- Set the auto - focus callback
- Reset the visibility
- Sets the focus mode
- Sets the flash mode
- Initializes the activity
- Receive notification of the TextBlock that is equivalent to this graphic
- Invoked when an activity is exited
- Checks if the specified point is contained within the canvas
- Draws the TextBlock annotation
- Performs the zoom of the camera
- Draws the overlay with all registered graphics objects
OCR-Reader Key Features
OCR-Reader Examples and Code Snippets
Community Discussions
Trending Discussions on OCR-Reader
QUESTION
Starting with this sample project [ https://github.com/googlesamples/android-vision/tree/master/visionSamples/ocr-reader ], I have been able to implement filtering in the OcrDetectorProcessor.receiveDetections()
method.
This works, but com.google.android.gms.vision.text.TextRecognizer
appears to search the the entire screen for characters.
I presume that the receiveDetections()
method could be called more frequently if a smaller portion of the screen were being scanned for characters instead of the entire screen.
Is it possible to specify a smaller portion of the screen to be scanned? It should be straight-forward to direct the user, through a change to the graphic overly, to position their camera so that this smaller portion of the screen contained the target text, but I'm unsure as to how to tell the processor to use just a small portion of the frame when doing it's OCR processing.
What would need to be altered to specify that the OCR should operate on a subset of the frame?
ADDITIONAL INFORMATION:
I tried to subclass TextRecognizer
, but it's marked final
, and the source appears to be closed.
So I'm expanding the question to how the functionality of the ocr-reader sample could be replicated using Tesseract.
I found this link, but haven't explored converting the concepts there into camera frames as opposed to a single image file.
...ANSWER
Answered 2019-Aug-21 at 17:04I had a similar issue and resolved it by using Tesseract and a simple cropping library called "Android Image Cropper" - Link here .
Basically I just crop the image before passing it for processing. Here is a small sample of my code:
This line will start new activity for a result:
QUESTION
In this sample Android OCR application, that uses com.google.android.gms:play-services-vision
, there is a OcrDetectorProcessor.receiveDetections()
method which gets repeatedly called. In that method, while the user points the camera at things in the environment, we have access to whatever text is detected.
If the user presses the back
button, the process ends, but I would like to have the process end when a certain condition occurs within the receiveDetections()
method.
I tried calling mParentActivity.onBackPressed()
, but that threw an exception from super.onBackPressed()
:
OpenCameraSource: Exception thrown from receiver. java.lang.IllegalStateException: Must be called from main thread of fragment host
So although the exception is caught and the app continues to run, calling onBackPressed()
is not the right approach. What is the right way to programatically back-out of receiveDetections()
?
ANSWER
Answered 2018-Dec-11 at 19:30Instead of:
QUESTION
In this sample Android program, the device's camera is used to perform optical character recognition through the com.google.android.gms:play-services-vision
library.
In visionSamples\ocr-codelab\ocr-reader-complete\app\src\main\java\com\google\android\gms\samples\vision\ocrreader\OcrDetectorProcessor.receiveDetections()
I am able to see the text that is identified using logging:
ANSWER
Answered 2017-Nov-29 at 22:26Generally what you need to do is to save a reference to the OcrDetectorProcessor
, then write a data retrieval method and call it from OcrCaptureActivity
.
So make this change to your 'onCreate()':
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install OCR-Reader
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page