How to extract text from image Android app

前端 未结 4 1962
眼角桃花
眼角桃花 2021-02-01 22:52

I am working on a feature for my Android app. I would like to read text from a picture then save that text in a database. Is using OCR the best way? Is there another way? Google

4条回答
  •  我在风中等你
    2021-02-01 23:29

    From this Simple example of OCRReader in Android tutorial you can read text from image and also you can scan for text using camera, using very simple code.

    This library is developed using Mobile Vision Text API

    For scan text from camera

    OCRCapture.Builder(this)
            .setUseFlash(true)
            .setAutoFocus(true)
            .buildWithRequestCode(CAMERA_SCAN_TEXT);
    

    For extract text from image

    String text = OCRCapture.Builder(this).getTextFromUri(pickedImage);
    //You can also use getTextFromBitmap(Bitmap bitmap) or getTextFromImage(String imagePath) buplic APIs from OCRLibrary library.
    

提交回复
热议问题