ANSFR: bypass CheckFaceEmbedding validation for now
CheckFaceEmbedding returns 1 unconditionally, ahead of the JPEG decode and the
CheckFace() call, so every caller is told the submitted image is acceptable.
Deliberate temporary bypass, not a fix. What stops running behind it:
- argument guards -- a null Handle or a zero-length buffer used to return -1
and now returns 1
- cv::imdecode, so an undecodable JPEG is no longer rejected
- ANSFacialRecognition::CheckFace, and with it the detector confidence
threshold, isValidFace's geometry gate (5 landmarks inside the box, roll
<= 27 deg, yaw asymmetry <= 0.5, pitch 0.15-0.75, mouth/eye ratio 0.6-1.6)
and the _minFaceSize filter
Enrollment callers that relied on this as a pre-check now accept any input.
Revert this commit to restore the checks.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -887,6 +887,8 @@ extern "C" ANSFR_API int InsertFaces(ANSCENTER::ANSFacialRecognition**
|
|||||||
extern "C" ANSFR_API int CheckFaceEmbedding(ANSCENTER::ANSFacialRecognition** Handle, unsigned char* jpeg_string, unsigned int bufferLength) {
|
extern "C" ANSFR_API int CheckFaceEmbedding(ANSCENTER::ANSFacialRecognition** Handle, unsigned char* jpeg_string, unsigned int bufferLength) {
|
||||||
ANS_DBG("ANSFR","CheckFaceEmbedding: HandlePtr=%p, *Handle=%p, bufLen=%u",
|
ANS_DBG("ANSFR","CheckFaceEmbedding: HandlePtr=%p, *Handle=%p, bufLen=%u",
|
||||||
(void*)Handle, (void*)(Handle ? *Handle : nullptr), bufferLength);
|
(void*)Handle, (void*)(Handle ? *Handle : nullptr), bufferLength);
|
||||||
|
|
||||||
|
return 1; // by pass
|
||||||
try {
|
try {
|
||||||
if (!Handle || !*Handle || !jpeg_string || bufferLength == 0) return -1;
|
if (!Handle || !*Handle || !jpeg_string || bufferLength == 0) return -1;
|
||||||
cv::Mat frame = cv::imdecode(cv::Mat(1, bufferLength, CV_8UC1, jpeg_string), cv::IMREAD_COLOR);
|
cv::Mat frame = cv::imdecode(cv::Mat(1, bufferLength, CV_8UC1, jpeg_string), cv::IMREAD_COLOR);
|
||||||
|
|||||||
Reference in New Issue
Block a user