Created
March 20, 2024 09:08
-
-
Save LethalMaus/ea955b0eaf87e8d77f2133c2a598781b to your computer and use it in GitHub Desktop.
text-recognition.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // From a media image | |
| val image = InputImage.fromMediaImage(mediaImage, rotation) | |
| // From a file path | |
| val image: InputImage | |
| try { | |
| image = InputImage.fromFilePath(context, uri) | |
| } catch (e: IOException) { | |
| e.printStackTrace() | |
| } | |
| // From a byte buffer | |
| val image = InputImage.fromByteBuffer( | |
| byteBuffer, | |
| /* image width */ 480, | |
| /* image height */ 360, | |
| rotationDegrees, | |
| InputImage.IMAGE_FORMAT_NV21 // or IMAGE_FORMAT_YV12 | |
| ) | |
| // From a bitmap | |
| val image = InputImage.fromBitmap(bitmap, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment