how to create face app in flutter using Augmented Reality

Viewed 975
1 Answers

If you want to develop a mobile app, you can use the capabilities of facial recognition, graphics rendering, and AR display provided by Huawei AR Engine to access Product AR fitting.

AR Engine is a platform for building AR apps on Android smartphones. It integrates AR core algorithms to provide basic AR capabilities such as motion tracking, environment tracking, body tracking, and face tracking.

Huawei provides Flutter plug-ins for you to integrate AR Engine. You can download it on Github: https://github.com/HMS-Core/hms-flutter-plugin/tree/master/flutter-hms-ar

The main procedures are as follows:

  1. Create a FaceViewActivity inherited from Activity, and create the corresponding layout file.
  2. Override the onCreate method in FaceViewActivity to obtain FaceView.
  3. Create a listener for Switch. When Switch is enabled, call the loadAsset method to load the 3D model of the product. Set the position of facial recognition in LandmarkType.
mSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        mFaceView.clearResource();
        if (isChecked) {
            // Load materials.
         int index = mFaceView.loadAsset("FaceView/sunglasses.glb", LandmarkType.TIP_OF_NOSE);
        }
    }
});
  1. Create a onBtnTryProductOn in MainActivity. When the user taps the onBtnTryProductOn button, the FaceViewActivity is called, which enables the user to view the AR fitting effects.

For more details, see docs.

Related