-/**\r
-* Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved\r
-*\r
-* Licensed under the Apache License, Version 2.0 (the "License");\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-* http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
+/**
+* Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
*/
#include "ITs-media-vision-common.h"
* @{
*/
-#define gMaxLabelCount 2\r
+#define gMaxLabelCount 2
#define gMaxImageCount 10
static mv_face_recognition_h g_hFaceRecognitionHandle = NULL;
static mv_source_h gSourceHandle = NULL;
const char *gFaceRecognitionExampleDir1 = NULL;
const char *gFaceRecognitionExampleDir2 = NULL;
-static const char *image_file_names[gMaxImageCount] = {\r
- "00.jpg", "01.jpg", "02.jpg", "03.jpg", "04.jpg",\r
- "05.jpg", "06.jpg", "07.jpg", "08.jpg", "09.jpg"\r
-};\r
-\r
-static const char *label_names[gMaxLabelCount] = {\r
- "p1", "p2"\r
+static const char *image_file_names[gMaxImageCount] = {
+ "00.jpg", "01.jpg", "02.jpg", "03.jpg", "04.jpg",
+ "05.jpg", "06.jpg", "07.jpg", "08.jpg", "09.jpg"
+};
+
+static const char *label_names[gMaxLabelCount] = {
+ "p1", "p2"
};
/**
g_bMediavisionFaceRecognitionModelCreation = false;
g_bMismatch = false;
- g_bIsFaceRecognitionFeatureSupported = TCTCheckSystemInfoFeatureSupported(VISIONINFERENCEFACEFEATURE, API_NAMESPACE);
+ g_bIsFaceRecognitionFeatureSupported = TCTCheckSystemInfoFeatureSupported(VISIONINFERENCEFEATURE, API_NAMESPACE) &&
+ TCTCheckSystemInfoFeatureSupported(VISIONTRAININGFEATURE, API_NAMESPACE) &&
+ TCTCheckSystemInfoFeatureSupported(VISIONINFERENCEFACERECOGNITIONFEATURE, API_NAMESPACE) &&
+ TCTCheckSystemInfoFeatureSupported(VISIONTRAININGFACERECOGNITIONFEATURE, API_NAMESPACE);
char pszValue[CONFIG_VALUE_LEN_MAX] = { 0, };
if (true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE)) {
FPRINTF("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received %s\\n", __LINE__, API_NAMESPACE, pszValue);
- gFaceRecognitionExampleDir1 = (char*)calloc(strlen(pszValue) + strlen("/res/res/face_recognition/images/P1") + 1, sizeof(char));\r
- snprintf(gFaceRecognitionExampleDir1, strlen(pszValue) + strlen("/res/res/face_recognition/images/P1") + 1, "%s/res/res/face_recognition/images/P1", pszValue);\r
-\r
- gFaceRecognitionExampleDir2 = (char*)calloc(strlen(pszValue) + strlen("/res/res/face_recognition/images/P2") + 1, sizeof(char));\r
+ gFaceRecognitionExampleDir1 = (char*)calloc(strlen(pszValue) + strlen("/res/res/face_recognition/images/P1") + 1, sizeof(char));
+ snprintf(gFaceRecognitionExampleDir1, strlen(pszValue) + strlen("/res/res/face_recognition/images/P1") + 1, "%s/res/res/face_recognition/images/P1", pszValue);
+
+ gFaceRecognitionExampleDir2 = (char*)calloc(strlen(pszValue) + strlen("/res/res/face_recognition/images/P2") + 1, sizeof(char));
snprintf(gFaceRecognitionExampleDir2, strlen(pszValue) + strlen("/res/res/face_recognition/images/P2") + 1, "%s/res/res/face_recognition/images/P2", pszValue);
}
else
//& type: auto
//& purpose: To test mv_create_source, image_load, mv_face_recognition_register, mv_destroy_source, mv_face_recognition_unregister API
-int ITc_mv_face_recognition_register_unregister_p(void)\r
-{\r
+int ITc_mv_face_recognition_register_unregister_p(void)
+{
START_TEST_FACE_RECOGNITION;
int nRet = mv_face_recognition_prepare(g_hFaceRecognitionHandle);
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_prepare", MediaVisionGetError(nRet));\r
-\r
- for (unsigned int label_idx = 0; label_idx < gMaxLabelCount; ++label_idx) {\r
- for (unsigned int img_idx = 0; img_idx < gMaxImageCount / 2; ++img_idx) {\r
- char pszImageFileName[PATHLEN] = "";\r
-\r
- nRet = mv_create_source(&gSourceHandle);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));\r
-\r
- if (label_idx == 0)\r
- snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir1, image_file_names[img_idx]);\r
- else\r
- snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir2, image_file_names[img_idx]);\r
-\r
- nRet = image_load(pszImageFileName, gSourceHandle);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));\r
-\r
- nRet = mv_face_recognition_register(g_hFaceRecognitionHandle, gSourceHandle, label_names[label_idx]);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_register", MediaVisionGetError(nRet));\r
-\r
- nRet = mv_destroy_source(gSourceHandle);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_destroy_source", MediaVisionGetError(nRet));\r
- }\r
- }\r
-\r
- for (unsigned int label_idx = 0; label_idx < gMaxLabelCount; ++label_idx) {\r
- nRet = mv_face_recognition_unregister(g_hFaceRecognitionHandle, label_names[label_idx]);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_unregister", MediaVisionGetError(nRet));\r
- }\r
-\r
- return 0;\r
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_prepare", MediaVisionGetError(nRet));
+
+ for (unsigned int label_idx = 0; label_idx < gMaxLabelCount; ++label_idx) {
+ for (unsigned int img_idx = 0; img_idx < gMaxImageCount / 2; ++img_idx) {
+ char pszImageFileName[PATHLEN] = "";
+
+ nRet = mv_create_source(&gSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));
+
+ if (label_idx == 0)
+ snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir1, image_file_names[img_idx]);
+ else
+ snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir2, image_file_names[img_idx]);
+
+ nRet = image_load(pszImageFileName, gSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));
+
+ nRet = mv_face_recognition_register(g_hFaceRecognitionHandle, gSourceHandle, label_names[label_idx]);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_register", MediaVisionGetError(nRet));
+
+ nRet = mv_destroy_source(gSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_destroy_source", MediaVisionGetError(nRet));
+ }
+ }
+
+ for (unsigned int label_idx = 0; label_idx < gMaxLabelCount; ++label_idx) {
+ nRet = mv_face_recognition_unregister(g_hFaceRecognitionHandle, label_names[label_idx]);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_unregister", MediaVisionGetError(nRet));
+ }
+
+ return 0;
}
/**
START_TEST_FACE_RECOGNITION;
int nRet = mv_face_recognition_prepare(g_hFaceRecognitionHandle);
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_prepare", MediaVisionGetError(nRet));\r
- //register\r
- for (unsigned int label_idx = 0; label_idx < gMaxLabelCount; ++label_idx) {\r
- for (unsigned int img_idx = 0; img_idx < gMaxImageCount / 2; ++img_idx) {\r
- char pszImageFileName[PATHLEN] = "";\r
-\r
- nRet = mv_create_source(&gSourceHandle);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));\r
-\r
- if (label_idx == 0)\r
- snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir1, image_file_names[img_idx]);\r
- else\r
- snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir2, image_file_names[img_idx]);\r
-\r
- nRet = image_load(pszImageFileName, gSourceHandle);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));\r
-\r
- nRet = mv_face_recognition_register(g_hFaceRecognitionHandle, gSourceHandle, label_names[label_idx]);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_register", MediaVisionGetError(nRet));\r
-\r
- nRet = mv_destroy_source(gSourceHandle);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_destroy_source", MediaVisionGetError(nRet));\r
- }\r
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_prepare", MediaVisionGetError(nRet));
+ //register
+ for (unsigned int label_idx = 0; label_idx < gMaxLabelCount; ++label_idx) {
+ for (unsigned int img_idx = 0; img_idx < gMaxImageCount / 2; ++img_idx) {
+ char pszImageFileName[PATHLEN] = "";
+
+ nRet = mv_create_source(&gSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));
+
+ if (label_idx == 0)
+ snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir1, image_file_names[img_idx]);
+ else
+ snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir2, image_file_names[img_idx]);
+
+ nRet = image_load(pszImageFileName, gSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));
+
+ nRet = mv_face_recognition_register(g_hFaceRecognitionHandle, gSourceHandle, label_names[label_idx]);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_register", MediaVisionGetError(nRet));
+
+ nRet = mv_destroy_source(gSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_destroy_source", MediaVisionGetError(nRet));
+ }
}
//inference & get_label
- for (unsigned int label_idx = 0; label_idx < gMaxLabelCount; ++label_idx) {\r
- for (unsigned int img_idx = 5; img_idx < gMaxImageCount; ++img_idx) {\r
- char pszImageFileName[PATHLEN] = "";\r
- const char *out_label = NULL;\r
-\r
- nRet = mv_create_source(&gSourceHandle);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));\r
-\r
- if (label_idx == 0)\r
- snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir1, image_file_names[img_idx]);\r
- else\r
- snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir2, image_file_names[img_idx]);\r
-\r
- nRet = image_load(pszImageFileName, gSourceHandle);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));\r
-\r
- nRet = mv_face_recognition_inference(g_hFaceRecognitionHandle, gSourceHandle);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_inference", MediaVisionGetError(nRet));\r
-\r
- nRet = mv_face_recognition_get_label(g_hFaceRecognitionHandle, &out_label);\r
- if (nRet != MEDIA_VISION_ERROR_NO_DATA)\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_get_label", MediaVisionGetError(nRet));\r
-\r
- nRet = mv_destroy_source(gSourceHandle);\r
- PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_destroy_source", MediaVisionGetError(nRet));\r
- }\r
- }\r
-\r
+ for (unsigned int label_idx = 0; label_idx < gMaxLabelCount; ++label_idx) {
+ for (unsigned int img_idx = 5; img_idx < gMaxImageCount; ++img_idx) {
+ char pszImageFileName[PATHLEN] = "";
+ const char *out_label = NULL;
+
+ nRet = mv_create_source(&gSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_create_source", MediaVisionGetError(nRet));
+
+ if (label_idx == 0)
+ snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir1, image_file_names[img_idx]);
+ else
+ snprintf(pszImageFileName, PATHLEN, "%s/%s", gFaceRecognitionExampleDir2, image_file_names[img_idx]);
+
+ nRet = image_load(pszImageFileName, gSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "image_load", MediaVisionGetError(nRet));
+
+ nRet = mv_face_recognition_inference(g_hFaceRecognitionHandle, gSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_inference", MediaVisionGetError(nRet));
+
+ nRet = mv_face_recognition_get_label(g_hFaceRecognitionHandle, &out_label);
+ if (nRet != MEDIA_VISION_ERROR_NO_DATA)
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_face_recognition_get_label", MediaVisionGetError(nRet));
+
+ nRet = mv_destroy_source(gSourceHandle);
+ PRINT_RESULT(MEDIA_VISION_ERROR_NONE, nRet, "mv_destroy_source", MediaVisionGetError(nRet));
+ }
+ }
+
return 0;
}