# CoreVisionKit-SampleCode-ArkTS-FaceCompareDemo **Repository Path**: easy1228/core-vision-kit-sample-code-ark-ts-face-compare-demo ## Basic Information - **Project Name**: CoreVisionKit-SampleCode-ArkTS-FaceCompareDemo - **Description**: 本示例展示了对比两张图片中的人脸并判断是否为同一个人的AI能力。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2025-08-15 - **Last Updated**: 2025-09-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Face Verification ## Overview This sample code illustrates how to use the face verification capability of Core Vision Kit. It simulates how to select two images and calculate the similarity between the largest faces in the two images. You need to use **@hms.ai.face.faceComparator.d.ts**, which contains the APIs for face verification. ## Preview | **App home screen** | **Selecting images** | **Comparing faces** | |:------------------------:|:--------------------------------:|:--------------------------------:| | ![](screenshots/app_en.png) | ![](screenshots/selectImage_en.png) | ![](screenshots/faceResult_en.png) | Instructions: 1. On the home screen of a mobile phone, tap **faceComparatorDemo** to start the app. 2. Tap **Select images** to select images from the gallery or take photos using the camera. 3. Tap **Compare faces** to compare face information. The result is displayed in text. ## Project Directory ``` ├─entry/src/main/ets │ ├─entryability │ │ ├─EntryAbility.ets // Entry ability │ └─pages │ └─Index.ets // App home screen └─entry/src/main/resources // Directory for storing resource files ``` ## How to Implement The APIs for the face verification control in this sample have been defined in **@hms.ai.face.faceComparator.d.ts**. ~~~ * function compareFaces(visionInfo1: VisionInfo, visionInfo2: VisionInfo): Promise; ~~~ Before using the service, you need to import **faceComparator**. Call the face verification API, pass the images to be recognized, and receive the processing result (text information). For details, please refer to **entry/src/main/ets/pages/Index.ets**. ## Required Permissions N/A ## Dependencies N/A ## Constraints 1. The sample app is only supported on Huawei phones, tablets, and 2-in-1 devices with standard systems. 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 SDK or later.