khjde1207 / tesseract_ocr

Tesseract OCR for flutter
BSD 3-Clause "New" or "Revised" License
64 stars 33 forks source link

Extract text based on bytes buffer insead of file path #20

Closed mspnr closed 2 years ago

mspnr commented 3 years ago

Could you consider to add a new extractText function?

Suggestion for improvement

As you already mentioned in #9 if you transfer data directly from camera or somehow manipulate images (changing contrast, cropping etc.), it makes sense to transfer to extractText byte buffer instead of a file path, Otherwise you need to resave the image, which can lead to exceeding use of flash drive.

Technical considerations

Android

From Android side it looks like instead of calling this.baseApi.setImage(this.tempFile); with passing a file path one can use another public void setImage(Bitmap bmp) for passing a bitmap.

iOS

From iOS side it looks like also feasible instead of calling let image = UIImage(contentsOfFile: imagePath) one can use another constructor of UIImage: init?(data: Data).

Alternative solution

As a quick alternative solution one can consider to use MemoryFileSystem() from file package. In this case it will be enough if extractText accepts File instead of a path.

khjde1207 commented 3 years ago

Consider using google_ml_kit I'm going to use google_ml_kit now.

mohblnk commented 1 year ago

Consider using google_ml_kit I'm going to use google_ml_kit now.

I want to use that option as well but I have custom train data, is there is a way to use custom train data for google_ml_kit?

khjde1207 commented 1 year ago

Consider using google_ml_kit I'm going to use google_ml_kit now.

I want to use that option as well but I have custom train data, is there is a way to use custom train data for google_ml_kit?

Custom doesn't seem to be supported.