Created
November 23, 2020 13:55
-
-
Save burakiren/7605bbb630d778d4a666bcbb5344d036 to your computer and use it in GitHub Desktop.
FaceComparator
This file contains 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
FaceComparator mFaceComparator = new FaceComparator(mContext); | |
VisionImage image1 = null; | |
VisionImage image2 = null; | |
if (bitmapFirst != null) { | |
image1 = VisionImage.fromBitmap(bitmapFirst); | |
} | |
if (bitmapSecond != null) { | |
image2 = VisionImage.fromBitmap(bitmapSecond); | |
} | |
FaceCompareConfiguration config = new FaceCompareConfiguration | |
.Builder() | |
.setProcessMode(.processMode == -1 ? | |
VisionConfiguration.MODE_IN : VisionConfiguration.MODE_OUT) .build();//Whether the calling mode is intra-process. 0 indicates intra-process, while -1 indicates inter-process. | |
mFaceComparator.setConfiguration(config); | |
mFaceCompareResult = new FaceCompareResult(); | |
resultCode = -1; | |
//Check whether the detect method is executed asynchronously. | |
if (!AiEngineMgr.isAsync) { | |
resultCode = mFaceComparator.faceCompare(image1, image2, mFaceCompareResult, null); | |
} else { | |
mFaceComparator.faceCompare(image1, image2, null, | |
new VisionCallback<FaceCompareResult>() { | |
@Override | |
public void onResult(FaceCompareResult faceCompareResult){ | |
mFaceCompareResult = faceCompareResult; | |
resultCode = 0; | |
} | |
@Override | |
public void onError(int i){ | |
resultCode = i; | |
HopeCVLog.d(temp_Log,"onError: "+i); | |
} | |
@Override | |
public void onProcessing(float v){ | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment