Ask Your Question

binarization of an image android

asked 2019-02-03 22:42:18 -0500

ojesus gravatar image

updated 2020-09-28 06:50:07 -0500

hello guys

i am developing an android application which is use for OCR from invoice so i am use tesseract library for ocr but some time some invoice images are not read by the tesseract library because some images are blurry and character are not readable so i want to binarize an image because tesseract work perfect on binarize image.

if any one have an idea please guide me.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-02-04 02:54:48 -0500

berak gravatar image

you already get a grayscale image in onCameraFrame(): then you can use functions like compare(), or threshold

public Mat onCameraFrame(Mat inputFrame) {
    Mat gray = inputFrame.gray();
    Mat bin = new Mat();
    Imgproc.threshold(gray, bin, 120, 255, Imgproc.THRESH_BINARY);

    // process bin image with tesseract

    bin.release(); // must be released manually !
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-02-03 22:42:18 -0500

Seen: 296 times

Last updated: Sep 30 '19