regulaforensics / flutter_face_api

MIT License
31 stars 14 forks source link

How to get the index of image with which latest image matches? #21

Open hafeezrana opened 1 year ago

hafeezrana commented 1 year ago

here imagesare the list of snapshots data stored for registered employees. how I get the employeeId or name who has been found while matching new image with already existed image. and matching proccess vary over imageType numbers too. there is no proper documentation written for the code.

createButton("Match", () {
                          var image2 = Regula.MatchFacesImage();
                          image2.bitmap = images;
                          image2.imageType = 1;

                          setState(() => _similarity = "Processing...");
                          var request = Regula.MatchFacesRequest();
                          request.images = [image1, image2];

                          Regula.FaceSDK.matchFaces(jsonEncode(request)).then(
                            (value) {
                              var response = Regula.MatchFacesResponse.fromJson(
                                  json.decode(value));
                              Regula.FaceSDK.matchFacesSimilarityThresholdSplit(
                                jsonEncode(response!.results),
                                0.75,
                              ).then(
                                (str) {
                                  var split =
                                      Regula.MatchFacesSimilarityThresholdSplit
                                          .fromJson(json.decode(str));
                                  setState(
                                    () => _similarity = split!
                                            .matchedFaces.isNotEmpty
                                        ? ((split.matchedFaces[0]!.similarity! *
                                                    100)
                                                .toStringAsFixed(2) +
                                            "%")
                                        : "error",
                                  );
                                },
                              );
                            },
                          );
                        }),