diff --git a/README_EN.md b/README_EN.md new file mode 100644 index 0000000000000000000000000000000000000000..91c750147a784fdac97ef9f41859fc1642ef2361 --- /dev/null +++ b/README_EN.md @@ -0,0 +1,60 @@ +# Photo Text Recognition + +### Overview + +This sample shows how to use the APIs provided by @ohos.multimedia.camera (camera management) and textRecognition (text recognition) to recognize and extract text in images. + +### Preview + +| Home page | Text recognition dialog | +|-----------------------------------|------------------------------------| +| ![](screenshots/device/index_EN.png) | ![](screenshots/device/dialog_EN.png) | + +### How to Use + +1. Tap the round button in the lower part of the page. A dialog is displayed, showing the text extracted from the image. + +2. Tap a blank area except the dialog to close the dialog and return to the home screen. + +### Project Directory + +``` + +├──entry/src/main/ets/ +│ ├──common/constant +│ │ └──CommonConstants.ets // Common constants +│ ├──common/utils +│ │ └──DeviceScreen.ets // Utility used to calculate the screen size +│ │ └──Logger.ets // Logging utility +│ │ └──PermissionUtils.ets // Utility used to obtain permissions +│ │ └──Camera.ets // Utility used to manage the camera +│ ├──entryability +│ │ └──EntryAbility.ets // Entry ability +│ ├──page +│ │ └──Index.ets // Home page +│ └──view +│ └──CustomDialogView.ets // Dialog for displaying the text extracted from the image +└──entry/src/main/resources // Static resources of the app + +``` +### How to Implement + +* The APIs for AI text recognition are encapsulated in **CameraModel**. For details about the source code, see [Camera.ets](entry/src/main/ets/common/utils/Camera.ets). + * Camera module: encapsulates the APIs for initializing and releasing the camera. + * On the Index page, a click event triggers camera shooting. After the photo output stream is obtained, use @hms.ai.ocr.textRecognition to extract the text from the photo. + +### Required Permissions + +**ohos.permission.CAMERA**: allows an app to use the camera. + +### Constraints + +1. The sample app is supported only on Huawei phones running the standard system. + +2. The HarmonyOS version must be HarmonyOS NEXT Developer Beta1 or later. + +3. The DevEco Studio version must be DevEco Studio NEXT Developer Beta1 or later. + +4. The HarmonyOS SDK version must be HarmonyOS NEXT Developer Beta1 or later. + +5. The permission ohos.permission.CAMERA is of the normal level. For details about the permission level, see the permission list. diff --git a/screenshots/device/dialog_EN.png b/screenshots/device/dialog_EN.png new file mode 100644 index 0000000000000000000000000000000000000000..9cbaf56a60c3ac979b134c4680f35e138965b259 Binary files /dev/null and b/screenshots/device/dialog_EN.png differ diff --git a/screenshots/device/index_EN.png b/screenshots/device/index_EN.png new file mode 100644 index 0000000000000000000000000000000000000000..88440a7ea50d690302d6f5a1bcb30c9f3bdff9b6 Binary files /dev/null and b/screenshots/device/index_EN.png differ