)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+SET(PC_NAME ${fw_name}-barcode)
+SET(PC_LDFLAGS "-l${MV_BARCODE_DETECTOR_LIB_NAME} -l${MV_BARCODE_GENERATOR_LIB_NAME}")
+CONFIGURE_FILE(
+ ${fw_name}-barcode.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-barcode.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-barcode.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+SET(PC_NAME ${fw_name}-face)
+SET(PC_LDFLAGS -l${MV_FACE_LIB_NAME})
+CONFIGURE_FILE(
+ ${fw_name}-face.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-face.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-face.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+SET(PC_NAME ${fw_name}-image)
+SET(PC_LDFLAGS -l${MV_IMAGE_LIB_NAME})
+CONFIGURE_FILE(
+ ${fw_name}-image.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-image.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-image.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+SET(PC_NAME ${fw_name}-surveillance)
+SET(PC_LDFLAGS -l${MV_SURVEILLANCE_LIB_NAME})
+CONFIGURE_FILE(
+ ${fw_name}-surveillance.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-surveillance.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-surveillance.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
ADD_SUBDIRECTORY(test)
IF(UNIX)
--- /dev/null
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=@LIB_INSTALL_DIR@
+includedir=/usr/include/media
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
--- /dev/null
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=@LIB_INSTALL_DIR@
+includedir=/usr/include/media
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
--- /dev/null
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=@LIB_INSTALL_DIR@
+includedir=/usr/include/media
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
--- /dev/null
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=@LIB_INSTALL_DIR@
+includedir=/usr/include/media
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
include_directories("${PROJECT_SOURCE_DIR}/src")
file(GLOB MV_BARCODE_DET_INC_LIST "${PROJECT_SOURCE_DIR}/include/*.h")
-file(GLOB MV_BARCODE_DET_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp")
+file(GLOB MV_BARCODE_DET_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp"
+ "${PROJECT_SOURCE_DIR}/src/*.c")
if(FORCED_STATIC_BUILD)
add_library(${PROJECT_NAME} STATIC ${MV_BARCODE_DET_INC_LIST} ${MV_BARCODE_DET_SRC_LIST})
--- /dev/null
+/**
+ * Copyright (c) 2015 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 <system_info.h>
+
+#include "mv_private.h"
+#include "mv_barcode_detect.h"
+
+#ifdef MEDIA_VISION_BARCODE_DETECTOR_LICENSE_PORT
+
+/* Include headers of licensed barcode detect module here. */
+#include "mv_barcode_detect_lic.h"
+
+#else
+
+/* Include headers of open barcode detect module here. */
+#include "mv_barcode_detect_open.h"
+
+#endif /* MEDIA_VISION_BARCODE_DETECTOR_LICENSE_PORT */
+
+/**
+ * @file mv_barcode_detect.c
+ * @brief This file contains the porting layer for Media Vision barcode module.
+ */
+
+int mv_barcode_detect(
+ mv_source_h source,
+ mv_engine_config_h engine_cfg,
+ mv_rectangle_s roi,
+ mv_barcode_detected_cb detect_cb,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_barcode_detect_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_NULL_ARG_CHECK(detect_cb);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+ unsigned int src_w = 0;
+ unsigned int src_h = 0;
+
+ ret = mv_source_get_width(source, &src_w);
+ if (ret != MEDIA_VISION_ERROR_NONE) {
+ LOGE("mv_source_get_width fail");
+ return ret;
+ }
+
+ ret = mv_source_get_height(source, &src_h);
+ if (ret != MEDIA_VISION_ERROR_NONE) {
+ LOGE("mv_source_get_height fail");
+ return ret;
+ }
+
+ if (roi.point.x < 0 || roi.point.y < 0 ||
+ (roi.point.x + roi.width) > src_w ||
+ (roi.point.y + roi.height) > src_h) {
+ LOGE("roi is out of area on source");
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+
+#ifdef MEDIA_VISION_BARCODE_DETECTOR_LICENSE_PORT
+
+ /* Use licensed barcode detect functionality here. */
+ ret = mv_barcode_detect_lic(
+ source, engine_cfg, roi, detect_cb, user_data);
+
+#else
+
+ /* Use open barcode detect functionality here. */
+ ret = mv_barcode_detect_open(
+ source, engine_cfg, roi, detect_cb, user_data);
+
+#endif /* MEDIA_VISION_BARCODE_DETECTOR_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
--- /dev/null
+/**
+ * Copyright (c) 2015 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 <system_info.h>
+
+#include "mv_private.h"
+
+bool __mv_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+ bool isBarcodeGenerationSupported = false;
+ bool isFaceRecognitionSupported = false;
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal1 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal1 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ const int nRetVal2 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal2 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ const int nRetVal3 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal3 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ const int nRetVal4 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal4 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported) ?
+ LOGI("system_info_get_platform_bool returned"
+ "Supported one feature among barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") :
+ LOGE("system_info_get_platform_bool returned"
+ "Unsupported all features of barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") ;
+
+ return (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported);
+}
+
+bool __mv_barcode_detect_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ isBarcodeDetectionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode detection feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode detection feature capability\n");
+
+ return isBarcodeDetectionSupported;
+}
+
+bool __mv_barcode_generate_check_system_info_feature_supported()
+{
+ bool isBarcodeGenerationSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ isBarcodeGenerationSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode generation feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode generation feature capability\n");
+
+ return isBarcodeGenerationSupported;
+}
+
+bool __mv_face_check_system_info_feature_supported()
+{
+ bool isFaceRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ isFaceRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported face recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported face recognition feature capability\n");
+
+ return isFaceRecognitionSupported;
+}
+
+bool __mv_image_check_system_info_feature_supported()
+{
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ isImageRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported image recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported image recognition feature capability\n");
+
+ return isImageRecognitionSupported;
+}
include_directories("${PROJECT_SOURCE_DIR}/src")
file(GLOB MV_BARCODE_GEN_INC_LIST "${PROJECT_SOURCE_DIR}/include/*.h")
-file(GLOB MV_BARCODE_GEN_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp")
+file(GLOB MV_BARCODE_GEN_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp"
+ "${PROJECT_SOURCE_DIR}/src/*.c")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
--- /dev/null
+/**
+ * Copyright (c) 2015 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 <system_info.h>
+
+#include "mv_private.h"
+#include "mv_barcode_generate.h"
+
+
+
+#ifdef MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT
+
+/* Include headers of licensed barcode generate module here. */
+#include "mv_barcode_generate_lic.h"
+
+#else
+
+/* Include headers of open barcode generate module here. */
+#include "mv_barcode_generate_open.h"
+
+#endif /* MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT */
+
+/**
+ * @file mv_barcode_generate.c
+ * @brief This file contains the porting layer for Media Vision barcode module.
+ */
+
+
+int mv_barcode_generate_source(
+ mv_engine_config_h engine_cfg,
+ const char *message,
+ mv_barcode_type_e type,
+ mv_barcode_qr_mode_e qr_enc_mode,
+ mv_barcode_qr_ecc_e qr_ecc,
+ int qr_version,
+ mv_source_h image)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_barcode_generate_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(message);
+ MEDIA_VISION_INSTANCE_CHECK(image);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ if (type < MV_BARCODE_QR ||
+ type >= MV_BARCODE_UNDEFINED) {
+ LOGE("Not supported barcode type [%d]", type);
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (type == MV_BARCODE_QR) {
+ if (qr_enc_mode < MV_BARCODE_QR_MODE_NUMERIC ||
+ qr_enc_mode >= MV_BARCODE_QR_MODE_UNAVAILABLE) {
+ LOGE("Not supported QR encoding mode[%d]", qr_enc_mode);
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (qr_ecc < MV_BARCODE_QR_ECC_LOW ||
+ qr_ecc >= MV_BARCODE_QR_ECC_UNAVAILABLE) {
+ LOGE("Not supported QR ECC level [%d]", qr_ecc);
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (qr_version < 1 || qr_version > 40) {
+ LOGE("Not supported QR version [%d]", qr_version);
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+#ifdef MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT
+
+ /* Use licensed barcode generate functionality here. */
+ int ret = mv_barcode_generate_source_lic(
+ engine_cfg, message, type, qr_enc_mode, qr_ecc, qr_version,
+ image);
+
+#else
+
+ /* Use open barcode generate functionality here. */
+ int ret = mv_barcode_generate_source_open(
+ engine_cfg, message, type, qr_enc_mode, qr_ecc, qr_version,
+ image);
+
+#endif /* MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_barcode_generate_image(
+ mv_engine_config_h engine_cfg,
+ const char *message,
+ int image_width,
+ int image_height,
+ mv_barcode_type_e type,
+ mv_barcode_qr_mode_e qr_enc_mode,
+ mv_barcode_qr_ecc_e qr_ecc,
+ int qr_version,
+ const char *image_path,
+ mv_barcode_image_format_e image_format)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_barcode_generate_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(message);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ if (image_path == NULL) {
+ LOGE("image_path is NULL");
+ return MEDIA_VISION_ERROR_INVALID_PATH;
+ }
+
+ if (type < MV_BARCODE_QR ||
+ type >= MV_BARCODE_UNDEFINED) {
+ LOGE("Not supported barcode type [%d]", type);
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (type == MV_BARCODE_QR) {
+ if (qr_enc_mode < MV_BARCODE_QR_MODE_NUMERIC ||
+ qr_enc_mode >= MV_BARCODE_QR_MODE_UNAVAILABLE) {
+ LOGE("Not supported QR encoding mode[%d]", qr_enc_mode);
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (qr_ecc < MV_BARCODE_QR_ECC_LOW ||
+ qr_ecc >= MV_BARCODE_QR_ECC_UNAVAILABLE) {
+ LOGE("Not supported QR ECC level [%d]", qr_ecc);
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (qr_version < 1 || qr_version > 40) {
+ LOGE("Not supported QR version [%d]", qr_version);
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+ if (image_format < MV_BARCODE_IMAGE_FORMAT_BMP ||
+ image_format >= MV_BARCODE_IMAGE_FORMAT_NUM) {
+ LOGE("Not supported image format [%d]", image_format);
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+
+#ifdef MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT
+
+ /* Use licensed barcode generate functionality here. */
+ int ret = mv_barcode_generate_image_lic(
+ engine_cfg, message, image_width, image_height, type,
+ qr_enc_mode, qr_ecc, qr_version, image_path, image_format);
+
+#else
+
+ /* Use open barcode generate functionality here. */
+ int ret = mv_barcode_generate_image_open(
+ engine_cfg, message, image_width, image_height, type,
+ qr_enc_mode, qr_ecc, qr_version, image_path, image_format);
+
+#endif /* MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
--- /dev/null
+/**
+ * Copyright (c) 2015 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 <system_info.h>
+
+#include "mv_private.h"
+
+bool __mv_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+ bool isBarcodeGenerationSupported = false;
+ bool isFaceRecognitionSupported = false;
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal1 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal1 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ const int nRetVal2 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal2 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ const int nRetVal3 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal3 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ const int nRetVal4 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal4 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported) ?
+ LOGI("system_info_get_platform_bool returned"
+ "Supported one feature among barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") :
+ LOGE("system_info_get_platform_bool returned"
+ "Unsupported all features of barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") ;
+
+ return (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported);
+}
+
+bool __mv_barcode_detect_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ isBarcodeDetectionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode detection feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode detection feature capability\n");
+
+ return isBarcodeDetectionSupported;
+}
+
+bool __mv_barcode_generate_check_system_info_feature_supported()
+{
+ bool isBarcodeGenerationSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ isBarcodeGenerationSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode generation feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode generation feature capability\n");
+
+ return isBarcodeGenerationSupported;
+}
+
+bool __mv_face_check_system_info_feature_supported()
+{
+ bool isFaceRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ isFaceRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported face recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported face recognition feature capability\n");
+
+ return isFaceRecognitionSupported;
+}
+
+bool __mv_image_check_system_info_feature_supported()
+{
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ isImageRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported image recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported image recognition feature capability\n");
+
+ return isImageRecognitionSupported;
+}
include_directories("${PROJECT_SOURCE_DIR}/include")
file(GLOB MV_COMMON_INCLUDE_LIST "${PROJECT_SOURCE_DIR}/include/*.h")
-file(GLOB MV_COMMON_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp")
+file(GLOB MV_COMMON_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp"
+ "${PROJECT_SOURCE_DIR}/src/*.c")
find_package(OpenCV REQUIRED core imgproc)
--- /dev/null
+/**
+ * Copyright (c) 2015 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 "mv_private.h"
+#include "mv_common.h"
+#include "mv_common_c.h"
+
+int mv_create_source(
+ mv_source_h *source)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(source);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_create_source_c(source);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_destroy_source(
+ mv_source_h source)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_destroy_source_c(source);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_source_fill_by_media_packet(
+ mv_source_h source,
+ media_packet_h media_packet)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_INSTANCE_CHECK(media_packet);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_source_fill_by_media_packet_c(source, media_packet);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_source_fill_by_buffer(
+ mv_source_h source,
+ unsigned char *data_buffer,
+ unsigned int buffer_size,
+ unsigned int image_width,
+ unsigned int image_height,
+ mv_colorspace_e image_colorspace)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_NULL_ARG_CHECK(data_buffer);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_source_fill_by_buffer_c(
+ source, data_buffer, buffer_size, image_width, image_height,
+ image_colorspace);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_source_clear(
+ mv_source_h source)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_source_clear_c(source);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_source_get_buffer(
+ mv_source_h source,
+ unsigned char **data_buffer,
+ unsigned int *buffer_size)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_NULL_ARG_CHECK(data_buffer);
+ MEDIA_VISION_NULL_ARG_CHECK(buffer_size);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_source_get_buffer_c(source, data_buffer, buffer_size);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_source_get_height(
+ mv_source_h source,
+ unsigned int *image_height)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_NULL_ARG_CHECK(image_height);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_source_get_height_c(source, image_height);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_source_get_width(
+ mv_source_h source,
+ unsigned int *image_width)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_NULL_ARG_CHECK(image_width);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_source_get_width_c(source, image_width);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_source_get_colorspace(
+ mv_source_h source,
+ mv_colorspace_e *image_colorspace)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_NULL_ARG_CHECK(image_colorspace);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_source_get_colorspace_c(source, image_colorspace);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_create_engine_config(
+ mv_engine_config_h *engine_cfg)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(engine_cfg);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_create_engine_config_c(engine_cfg);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_destroy_engine_config(
+ mv_engine_config_h engine_cfg)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(engine_cfg);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_destroy_engine_config_c(engine_cfg);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_engine_config_set_double_attribute(
+ mv_engine_config_h engine_cfg,
+ const char *name,
+ double value)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(engine_cfg);
+ MEDIA_VISION_NULL_ARG_CHECK(name);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_engine_config_set_double_attribute_c(
+ engine_cfg, name, value);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_engine_config_set_int_attribute(
+ mv_engine_config_h engine_cfg,
+ const char *name,
+ int value)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(engine_cfg);
+ MEDIA_VISION_NULL_ARG_CHECK(name);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_engine_config_set_int_attribute_c(
+ engine_cfg, name, value);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_engine_config_set_bool_attribute(
+ mv_engine_config_h engine_cfg,
+ const char *name,
+ bool value)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(engine_cfg);
+ MEDIA_VISION_NULL_ARG_CHECK(name);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_engine_config_set_bool_attribute_c(
+ engine_cfg, name, value);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_engine_config_set_string_attribute(
+ mv_engine_config_h engine_cfg,
+ const char *name,
+ const char *value)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(engine_cfg);
+ MEDIA_VISION_NULL_ARG_CHECK(name);
+ MEDIA_VISION_NULL_ARG_CHECK(value);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_engine_config_set_string_attribute_c(
+ engine_cfg, name, value);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_engine_config_get_double_attribute(
+ mv_engine_config_h engine_cfg,
+ const char *name,
+ double *value)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(engine_cfg);
+ MEDIA_VISION_NULL_ARG_CHECK(name);
+ MEDIA_VISION_NULL_ARG_CHECK(value);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_engine_config_get_double_attribute_c(
+ engine_cfg, name, value);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_engine_config_get_int_attribute(
+ mv_engine_config_h engine_cfg,
+ const char *name,
+ int *value)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(engine_cfg);
+ MEDIA_VISION_NULL_ARG_CHECK(name);
+ MEDIA_VISION_NULL_ARG_CHECK(value);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_engine_config_get_int_attribute_c(
+ engine_cfg, name, value);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_engine_config_get_bool_attribute(
+ mv_engine_config_h engine_cfg,
+ const char *name,
+ bool *value)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(engine_cfg);
+ MEDIA_VISION_NULL_ARG_CHECK(name);
+ MEDIA_VISION_NULL_ARG_CHECK(value);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_engine_config_get_bool_attribute_c(
+ engine_cfg, name, value);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_engine_config_get_string_attribute(
+ mv_engine_config_h engine_cfg,
+ const char *name,
+ char **value)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(engine_cfg);
+ MEDIA_VISION_NULL_ARG_CHECK(name);
+ MEDIA_VISION_NULL_ARG_CHECK(value);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_engine_config_get_string_attribute_c(
+ engine_cfg, name, value);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_engine_config_foreach_supported_attribute(
+ mv_supported_attribute_cb callback,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(callback);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+ int ret = mv_engine_config_foreach_supported_attribute_c(
+ callback, user_data);
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
--- /dev/null
+/**
+ * Copyright (c) 2015 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 <system_info.h>
+
+#include "mv_private.h"
+
+bool __mv_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+ bool isBarcodeGenerationSupported = false;
+ bool isFaceRecognitionSupported = false;
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal1 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal1 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ const int nRetVal2 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal2 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ const int nRetVal3 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal3 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ const int nRetVal4 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal4 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported) ?
+ LOGI("system_info_get_platform_bool returned"
+ "Supported one feature among barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") :
+ LOGE("system_info_get_platform_bool returned"
+ "Unsupported all features of barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") ;
+
+ return (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported);
+}
+
+bool __mv_barcode_detect_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ isBarcodeDetectionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode detection feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode detection feature capability\n");
+
+ return isBarcodeDetectionSupported;
+}
+
+bool __mv_barcode_generate_check_system_info_feature_supported()
+{
+ bool isBarcodeGenerationSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ isBarcodeGenerationSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode generation feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode generation feature capability\n");
+
+ return isBarcodeGenerationSupported;
+}
+
+bool __mv_face_check_system_info_feature_supported()
+{
+ bool isFaceRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ isFaceRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported face recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported face recognition feature capability\n");
+
+ return isFaceRecognitionSupported;
+}
+
+bool __mv_image_check_system_info_feature_supported()
+{
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ isImageRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported image recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported image recognition feature capability\n");
+
+ return isImageRecognitionSupported;
+}
include_directories("${PROJECT_SOURCE_DIR}/src")
file(GLOB MV_FACE_INCLUDE_LIST "${PROJECT_SOURCE_DIR}/include/*.h")
-file(GLOB MV_FACE_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp")
+file(GLOB MV_FACE_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp" "${PROJECT_SOURCE_DIR}/src/*.c")
find_package(OpenCV REQUIRED core objdetect contrib)
if(NOT OpenCV_FOUND)
--- /dev/null
+/**
+ * Copyright (c) 2015 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 "mv_private.h"
+#include "mv_face.h"
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+/* Include headers of licensed face module here. */
+#include "mv_face_lic.h"
+
+#else
+
+/* Include headers of open face module here. */
+#include "mv_face_open.h"
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+/**
+ * @file mv_face.c
+ * @brief This file contains the porting layer for Media Vision face module.
+ */
+
+static const int check_source_roi_quadrangle(mv_quadrangle_s *roi, mv_source_h source)
+{
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+ if (roi) {
+ int src_w = 0;
+ int src_h = 0;
+
+ ret = mv_source_get_width(source, &src_w);
+ if (ret != MEDIA_VISION_ERROR_NONE) {
+ LOGE("mv_source_get_width fail");
+ return ret;
+ }
+
+ ret = mv_source_get_height(source, &src_h);
+ if (ret != MEDIA_VISION_ERROR_NONE) {
+ LOGE("mv_source_get_height fail");
+ return ret;
+ }
+
+ int idx = 0;
+ while (idx < 4) {
+ if (roi->points[idx].x < 0 || roi->points[idx].y < 0 ||
+ roi->points[idx].x > src_w || roi->points[idx].y > src_h) {
+ LOGE("roi is out of area on source");
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+ ++idx;
+ }
+ }
+
+ return ret;
+}
+
+static const int check_source_roi(mv_rectangle_s *roi, mv_source_h source)
+{
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+ if (roi) {
+ int src_w = 0;
+ int src_h = 0;
+
+ ret = mv_source_get_width(source, &src_w);
+ if (ret != MEDIA_VISION_ERROR_NONE) {
+ LOGE("mv_source_get_width fail");
+ return ret;
+ }
+
+ ret = mv_source_get_height(source, &src_h);
+ if (ret != MEDIA_VISION_ERROR_NONE) {
+ LOGE("mv_source_get_height fail");
+ return ret;
+ }
+
+ if (roi->width <= 0 || roi->height <= 0) {
+ LOGE("roi has negative width or height");
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (roi->point.x < 0 || roi->point.y < 0 ||
+ (roi->point.x + roi->width) > src_w ||
+ (roi->point.y + roi->height) > src_h) {
+ LOGE("roi is out of area on source");
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+ return ret;
+}
+
+int mv_face_detect(
+ mv_source_h source,
+ mv_engine_config_h engine_cfg,
+ mv_face_detected_cb detected_cb,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_NULL_ARG_CHECK(detected_cb);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_detect_lic(source, engine_cfg, detected_cb, user_data);
+
+#else
+
+ ret = mv_face_detect_open(source, engine_cfg, detected_cb, user_data);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_recognize(
+ mv_source_h source,
+ mv_face_recognition_model_h recognition_model,
+ mv_engine_config_h engine_cfg,
+ mv_rectangle_s *face_location,
+ mv_face_recognized_cb recognized_cb,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_INSTANCE_CHECK(recognition_model);
+ MEDIA_VISION_NULL_ARG_CHECK(recognized_cb);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = check_source_roi(face_location, source);
+ if (MEDIA_VISION_ERROR_NONE != ret) {
+ LOGE("Errors occured when check source and ROI");
+ return ret;
+ }
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_recognize_lic(
+ source,
+ recognition_model,
+ engine_cfg,
+ face_location,
+ recognized_cb,
+ user_data);
+
+#else
+
+ ret = mv_face_recognize_open(
+ source,
+ recognition_model,
+ engine_cfg,
+ face_location,
+ recognized_cb,
+ user_data);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_track(
+ mv_source_h source,
+ mv_face_tracking_model_h tracking_model,
+ mv_engine_config_h engine_cfg,
+ mv_face_tracked_cb tracked_cb,
+ bool do_learn,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_INSTANCE_CHECK(tracking_model);
+ MEDIA_VISION_NULL_ARG_CHECK(tracked_cb);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_track_lic(
+ source,
+ tracking_model,
+ engine_cfg,
+ tracked_cb,
+ do_learn,
+ user_data);
+
+#else
+
+ ret = mv_face_track_open(
+ source,
+ tracking_model,
+ engine_cfg,
+ tracked_cb,
+ do_learn,
+ user_data);
+
+ #endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_eye_condition_recognize(
+ mv_source_h source,
+ mv_engine_config_h engine_cfg,
+ mv_rectangle_s face_location,
+ mv_face_eye_condition_recognized_cb eye_condition_recognized_cb,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_NULL_ARG_CHECK(eye_condition_recognized_cb);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_eye_condition_recognize_lic(
+ source,
+ engine_cfg,
+ face_location,
+ eye_condition_recognized_cb,
+ user_data);
+
+#else
+
+ ret = mv_face_eye_condition_recognize_open(
+ source,
+ engine_cfg,
+ face_location,
+ eye_condition_recognized_cb,
+ user_data);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+MEDIA_VISION_FUNCTION_LEAVE();
+return ret;
+}
+
+int mv_face_facial_expression_recognize(
+ mv_source_h source,
+ mv_engine_config_h engine_cfg,
+ mv_rectangle_s face_location,
+ mv_face_facial_expression_recognized_cb expression_recognized_cb,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_NULL_ARG_CHECK(expression_recognized_cb);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = check_source_roi(&face_location, source);
+ if (MEDIA_VISION_ERROR_NONE != ret) {
+ LOGE("Errors occurred when check source and ROI");
+ return ret;
+ }
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_facial_expression_recognize_lic(
+ source,
+ engine_cfg,
+ face_location,
+ expression_recognized_cb,
+ user_data);
+
+#else
+
+ ret = mv_face_facial_expression_recognize_open(
+ source,
+ engine_cfg,
+ face_location,
+ expression_recognized_cb,
+ user_data);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_recognition_model_create(
+ mv_face_recognition_model_h *recognition_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(recognition_model);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_recognition_model_create_lic(recognition_model);
+
+#else
+
+ ret = mv_face_recognition_model_create_open(recognition_model);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_recognition_model_destroy(
+ mv_face_recognition_model_h recognition_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(recognition_model);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_recognition_model_destroy_lic(recognition_model);
+
+#else
+
+ ret = mv_face_recognition_model_destroy_open(recognition_model);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+MEDIA_VISION_FUNCTION_LEAVE();
+return ret;
+}
+
+int mv_face_recognition_model_clone(
+ mv_face_recognition_model_h src,
+ mv_face_recognition_model_h *dst)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(src);
+ MEDIA_VISION_NULL_ARG_CHECK(dst);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_recognition_model_clone_lic(src, dst);
+
+#else
+
+ ret = mv_face_recognition_model_clone_open(src, dst);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_recognition_model_save(
+ const char *file_name,
+ mv_face_recognition_model_h recognition_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(recognition_model);
+
+ if (file_name == NULL) {
+ LOGE("File name is NULL. The file name has to be specified");
+ return MEDIA_VISION_ERROR_INVALID_PATH;
+ }
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_recognition_model_save_lic(
+ file_name,
+ recognition_model);
+
+#else
+
+ ret = mv_face_recognition_model_save_open(
+ file_name,
+ recognition_model);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_recognition_model_load(
+ const char *file_name,
+ mv_face_recognition_model_h *recognition_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(recognition_model);
+
+ if (file_name == NULL) {
+ LOGE("File name is NULL. The file name has to be specified");
+ return MEDIA_VISION_ERROR_INVALID_PATH;
+ }
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_recognition_model_load_lic(
+ file_name,
+ recognition_model);
+
+#else
+
+ ret = mv_face_recognition_model_load_open(
+ file_name,
+ recognition_model);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_recognition_model_add(
+ const mv_source_h source,
+ mv_face_recognition_model_h recognition_model,
+ const mv_rectangle_s *example_location,
+ int face_label)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_INSTANCE_CHECK(recognition_model);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = check_source_roi(example_location, source);
+ if (MEDIA_VISION_ERROR_NONE != ret) {
+ LOGE("Errors occured when check source and ROI");
+ return ret;
+ }
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_recognition_model_add_lic(
+ source,
+ recognition_model,
+ example_location,
+ face_label);
+#else
+
+ ret = mv_face_recognition_model_add_open(
+ source,
+ recognition_model,
+ example_location,
+ face_label);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_recognition_model_reset(
+ mv_face_recognition_model_h recognition_model,
+ int *face_label)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(recognition_model);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_recognition_model_reset_lic(
+ recognition_model,
+ face_label);
+
+#else
+
+ ret = mv_face_recognition_model_reset_open(
+ recognition_model,
+ face_label);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_recognition_model_learn(
+ mv_engine_config_h engine_cfg,
+ mv_face_recognition_model_h recognition_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(recognition_model);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_recognition_model_learn_lic(engine_cfg, recognition_model);
+
+#else
+
+ ret = mv_face_recognition_model_learn_open(engine_cfg, recognition_model);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_recognition_model_query_labels(
+ mv_face_recognition_model_h recognition_model,
+ int **labels,
+ unsigned int *number_of_labels)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(recognition_model);
+ MEDIA_VISION_NULL_ARG_CHECK(labels);
+ MEDIA_VISION_NULL_ARG_CHECK(number_of_labels);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_recognition_model_query_labels_lic(recognition_model, labels, number_of_labels);
+
+#else
+
+ ret = mv_face_recognition_model_query_labels_open(recognition_model, labels, number_of_labels);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_tracking_model_create(
+ mv_face_tracking_model_h *tracking_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(tracking_model);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_tracking_model_create_lic(tracking_model);
+
+#else
+
+ ret = mv_face_tracking_model_create_open(tracking_model);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_tracking_model_destroy(
+ mv_face_tracking_model_h tracking_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(tracking_model);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_tracking_model_destroy_lic(tracking_model);
+
+#else
+
+ ret = mv_face_tracking_model_destroy_open(tracking_model);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_tracking_model_prepare(
+ mv_face_tracking_model_h tracking_model,
+ mv_engine_config_h engine_cfg,
+ mv_source_h source,
+ mv_quadrangle_s *location)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(tracking_model);
+ MEDIA_VISION_INSTANCE_CHECK(source);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = check_source_roi_quadrangle(location, source);
+ if (MEDIA_VISION_ERROR_NONE != ret) {
+ LOGE("Errors occured when check source and tracking start location");
+ return ret;
+ }
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_tracking_model_prepare_lic(
+ tracking_model, engine_cfg, source, location);
+
+#else
+
+ ret = mv_face_tracking_model_prepare_open(
+ tracking_model, engine_cfg, source, location);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_tracking_model_clone(
+ mv_face_tracking_model_h src,
+ mv_face_tracking_model_h *dst)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(src);
+ MEDIA_VISION_NULL_ARG_CHECK(dst);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_tracking_model_clone_lic(src, dst);
+
+#else
+
+ ret = mv_face_tracking_model_clone_open(src, dst);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_tracking_model_save(
+ const char *file_name,
+ mv_face_tracking_model_h tracking_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(tracking_model);
+
+ if (file_name == NULL) {
+ LOGE("File name is NULL. The file name has to be specified");
+ return MEDIA_VISION_ERROR_INVALID_PATH;
+ }
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_tracking_model_save_lic(
+ file_name,
+ tracking_model);
+
+#else
+
+ ret = mv_face_tracking_model_save_open(
+ file_name,
+ tracking_model);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_face_tracking_model_load(
+ const char *file_name,
+ mv_face_tracking_model_h *tracking_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(tracking_model);
+
+ if (file_name == NULL) {
+ LOGE("File name is NULL. The file name has to be specifiled");
+ return MEDIA_VISION_ERROR_INVALID_PATH;
+ }
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+#ifdef MEDIA_VISION_FACE_LICENSE_PORT
+
+ ret = mv_face_tracking_model_load_lic(
+ file_name,
+ tracking_model);
+
+#else
+
+ ret = mv_face_tracking_model_load_open(
+ file_name,
+ tracking_model);
+
+#endif /* MEDIA_VISION_FACE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
--- /dev/null
+/**
+ * Copyright (c) 2015 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 <system_info.h>
+
+#include "mv_private.h"
+
+bool __mv_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+ bool isBarcodeGenerationSupported = false;
+ bool isFaceRecognitionSupported = false;
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal1 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal1 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ const int nRetVal2 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal2 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ const int nRetVal3 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal3 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ const int nRetVal4 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal4 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported) ?
+ LOGI("system_info_get_platform_bool returned"
+ "Supported one feature among barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") :
+ LOGE("system_info_get_platform_bool returned"
+ "Unsupported all features of barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") ;
+
+ return (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported);
+}
+
+bool __mv_barcode_detect_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ isBarcodeDetectionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode detection feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode detection feature capability\n");
+
+ return isBarcodeDetectionSupported;
+}
+
+bool __mv_barcode_generate_check_system_info_feature_supported()
+{
+ bool isBarcodeGenerationSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ isBarcodeGenerationSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode generation feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode generation feature capability\n");
+
+ return isBarcodeGenerationSupported;
+}
+
+bool __mv_face_check_system_info_feature_supported()
+{
+ bool isFaceRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ isFaceRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported face recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported face recognition feature capability\n");
+
+ return isFaceRecognitionSupported;
+}
+
+bool __mv_image_check_system_info_feature_supported()
+{
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ isImageRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported image recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported image recognition feature capability\n");
+
+ return isImageRecognitionSupported;
+}
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIB_INSTALL_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-include_directories("${INC_DIR}")
include_directories("${PROJECT_SOURCE_DIR}/include")
include_directories("${PROJECT_SOURCE_DIR}/src")
file(GLOB_RECURSE MV_IMAGE_INC_LIST "${PROJECT_SOURCE_DIR}/include/*.h")
-file(GLOB_RECURSE MV_IMAGE_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp")
+file(GLOB_RECURSE MV_IMAGE_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp" "${PROJECT_SOURCE_DIR}/src/*.c")
-find_package(OpenCV REQUIRED core highgui imgproc objdetect features2d calib3d)
+find_package(OpenCV REQUIRED core imgproc objdetect features2d contrib)
if(NOT OpenCV_FOUND)
message(SEND_ERROR "Failed to find OpenCV")
return()
--- /dev/null
+/**
+ * Copyright (c) 2015 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 "mv_private.h"
+#include "mv_image.h"
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+/* Include headers of licensed image module here. */
+#include "mv_image_lic.h"
+
+#else
+
+/* Include headers of open image module here. */
+#include "mv_image_open.h"
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+/**
+ * @file mv_image.c
+ * @brief This file contains the porting layer for Media Vision image module.
+ */
+
+int mv_image_recognize(
+ mv_source_h source,
+ const mv_image_object_h *image_objects,
+ int number_of_objects,
+ mv_engine_config_h engine_cfg,
+ mv_image_recognized_cb recognized_cb,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_NULL_ARG_CHECK(image_objects);
+
+ int object_num = 0;
+ for (; object_num < number_of_objects; ++object_num)
+ MEDIA_VISION_INSTANCE_CHECK(image_objects[object_num]);
+
+ MEDIA_VISION_NULL_ARG_CHECK(recognized_cb);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_recognize_lic(source, image_objects,
+ number_of_objects, engine_cfg, recognized_cb, user_data);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_recognize_open(source, image_objects,
+ number_of_objects, engine_cfg, recognized_cb, user_data);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_track(
+ mv_source_h source,
+ mv_image_tracking_model_h image_tracking_model,
+ mv_engine_config_h engine_cfg,
+ mv_image_tracked_cb tracked_cb,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_INSTANCE_CHECK(image_tracking_model);
+ MEDIA_VISION_NULL_ARG_CHECK(tracked_cb);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_track_lic(source, image_tracking_model, engine_cfg, tracked_cb, user_data);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_track_open(source, image_tracking_model, engine_cfg, tracked_cb, user_data);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_object_create(
+ mv_image_object_h *image_object)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(image_object);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_object_create_lic(image_object);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_object_create_open(image_object);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_object_destroy(
+ mv_image_object_h image_object)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(image_object);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_object_destroy_lic(image_object);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_object_destroy_open(image_object);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_object_fill(
+ mv_image_object_h image_object,
+ mv_engine_config_h engine_cfg,
+ mv_source_h source,
+ mv_rectangle_s *location)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(image_object);
+ MEDIA_VISION_INSTANCE_CHECK(source);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_object_fill_lic(image_object, engine_cfg, source, location);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_object_fill_open(image_object, engine_cfg, source, location);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_object_get_recognition_rate(
+ mv_image_object_h image_object,
+ double *recognition_rate)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(image_object);
+ MEDIA_VISION_NULL_ARG_CHECK(recognition_rate);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_object_get_recognition_rate_lic(image_object, recognition_rate);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_object_get_recognition_rate_open(image_object, recognition_rate);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_object_set_label(
+ mv_image_object_h image_object,
+ int label)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(image_object);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_object_set_label_lic(image_object, label);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_object_set_label_open(image_object, label);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_object_get_label(
+ mv_image_object_h image_object,
+ int *label)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(image_object);
+ MEDIA_VISION_NULL_ARG_CHECK(label);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_object_get_label_lic(image_object, label);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_object_get_label_open(image_object, label);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_object_clone(
+ mv_image_object_h src,
+ mv_image_object_h *dst)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(src);
+ MEDIA_VISION_NULL_ARG_CHECK(dst);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_object_clone_lic(src, dst);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_object_clone_open(src, dst);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_object_save(
+ const char *file_name, mv_image_object_h image_object)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(image_object);
+
+ if (file_name == NULL) {
+ LOGE("File name is NULL. The file name has to be specified");
+ return MEDIA_VISION_ERROR_INVALID_PATH;
+ }
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_object_save_lic(file_name, image_object);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_object_save_open(file_name, image_object);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_object_load(
+ const char *file_name, mv_image_object_h *image_object)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(image_object);
+
+ if (file_name == NULL) {
+ LOGE("file name is NULL. The file name has to be specified");
+ return MEDIA_VISION_ERROR_INVALID_PATH;
+ }
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_object_load_lic(file_name, image_object);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_object_load_open(file_name, image_object);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_tracking_model_create(
+ mv_image_tracking_model_h *image_tracking_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(image_tracking_model);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_tracking_model_create_lic(image_tracking_model);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_tracking_model_create_open(image_tracking_model);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_tracking_model_set_target(
+ mv_image_object_h image_object,
+ mv_image_tracking_model_h image_tracking_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(image_tracking_model);
+ MEDIA_VISION_INSTANCE_CHECK(image_object);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_tracking_model_set_target_lic(image_object, image_tracking_model);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_tracking_model_set_target_open(image_object, image_tracking_model);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_tracking_model_destroy(
+ mv_image_tracking_model_h image_tracking_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(image_tracking_model);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_tracking_model_destroy_lic(image_tracking_model);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_tracking_model_destroy_open(image_tracking_model);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_tracking_model_refresh(
+ mv_image_tracking_model_h image_tracking_model,
+ mv_engine_config_h engine_cfg)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(image_tracking_model);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_tracking_model_refresh_lic(
+ image_tracking_model,
+ engine_cfg);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_tracking_model_refresh_open(
+ image_tracking_model,
+ engine_cfg);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_tracking_model_clone(
+ mv_image_tracking_model_h src,
+ mv_image_tracking_model_h *dst)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(src);
+ MEDIA_VISION_NULL_ARG_CHECK(dst);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_tracking_model_clone_lic(src, dst);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_tracking_model_clone_open(src, dst);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_tracking_model_save(
+ const char *file_name, mv_image_tracking_model_h image_tracking_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(image_tracking_model);
+
+ if (file_name == NULL) {
+ LOGE("File name is NULL. The file name has to be specified");
+ return MEDIA_VISION_ERROR_INVALID_PATH;
+ }
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_tracking_model_save_lic(file_name, image_tracking_model);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_tracking_model_save_open(file_name, image_tracking_model);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_image_tracking_model_load(
+ const char *file_name, mv_image_tracking_model_h *image_tracking_model)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(image_tracking_model);
+
+ if (file_name == NULL) {
+ LOGE("File name is NULL. The file name has to be specified");
+ return MEDIA_VISION_ERROR_INVALID_PATH;
+ }
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT
+
+ /* Use licensed image functionality here. */
+ int ret = mv_image_tracking_model_load_lic(file_name, image_tracking_model);
+
+#else
+
+ /* Use open image functionality here. */
+ int ret = mv_image_tracking_model_load_open(file_name, image_tracking_model);
+
+#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
--- /dev/null
+/**
+ * Copyright (c) 2015 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 <system_info.h>
+
+#include "mv_private.h"
+
+bool __mv_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+ bool isBarcodeGenerationSupported = false;
+ bool isFaceRecognitionSupported = false;
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal1 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal1 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ const int nRetVal2 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal2 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ const int nRetVal3 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal3 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ const int nRetVal4 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal4 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported) ?
+ LOGI("system_info_get_platform_bool returned"
+ "Supported one feature among barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") :
+ LOGE("system_info_get_platform_bool returned"
+ "Unsupported all features of barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") ;
+
+ return (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported);
+}
+
+bool __mv_barcode_detect_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ isBarcodeDetectionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode detection feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode detection feature capability\n");
+
+ return isBarcodeDetectionSupported;
+}
+
+bool __mv_barcode_generate_check_system_info_feature_supported()
+{
+ bool isBarcodeGenerationSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ isBarcodeGenerationSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode generation feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode generation feature capability\n");
+
+ return isBarcodeGenerationSupported;
+}
+
+bool __mv_face_check_system_info_feature_supported()
+{
+ bool isFaceRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ isFaceRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported face recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported face recognition feature capability\n");
+
+ return isFaceRecognitionSupported;
+}
+
+bool __mv_image_check_system_info_feature_supported()
+{
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ isImageRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported image recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported image recognition feature capability\n");
+
+ return isImageRecognitionSupported;
+}
--- /dev/null
+/**
+ * Copyright (c) 2015 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 <system_info.h>
+
+#include "mv_private.h"
+
+bool __mv_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+ bool isBarcodeGenerationSupported = false;
+ bool isFaceRecognitionSupported = false;
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal1 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal1 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ const int nRetVal2 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal2 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ const int nRetVal3 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal3 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ const int nRetVal4 = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal4 != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported) ?
+ LOGI("system_info_get_platform_bool returned"
+ "Supported one feature among barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") :
+ LOGE("system_info_get_platform_bool returned"
+ "Unsupported all features of barcode detection, "
+ "barcode generation, face recognition, "
+ "and image recognition capability\n") ;
+
+ return (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
+ isFaceRecognitionSupported || isImageRecognitionSupported);
+}
+
+bool __mv_barcode_detect_check_system_info_feature_supported()
+{
+ bool isBarcodeDetectionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_detection",
+ &isBarcodeDetectionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
+ return false;
+ }
+
+ isBarcodeDetectionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode detection feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode detection feature capability\n");
+
+ return isBarcodeDetectionSupported;
+}
+
+bool __mv_barcode_generate_check_system_info_feature_supported()
+{
+ bool isBarcodeGenerationSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.barcode_generation",
+ &isBarcodeGenerationSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
+ return false;
+ }
+
+ isBarcodeGenerationSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported barcode generation feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported barcode generation feature capability\n");
+
+ return isBarcodeGenerationSupported;
+}
+
+bool __mv_face_check_system_info_feature_supported()
+{
+ bool isFaceRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.face_recognition",
+ &isFaceRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
+ return false;
+ }
+
+ isFaceRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported face recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported face recognition feature capability\n");
+
+ return isFaceRecognitionSupported;
+}
+
+bool __mv_image_check_system_info_feature_supported()
+{
+ bool isImageRecognitionSupported = false;
+
+ const int nRetVal = system_info_get_platform_bool(
+ "http://tizen.org/feature/vision.image_recognition",
+ &isImageRecognitionSupported);
+
+ if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+ LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
+ return false;
+ }
+
+ isImageRecognitionSupported ?
+ LOGI("system_info_get_platform_bool returned "
+ "Supported image recognition feature capability\n") :
+ LOGE("system_info_get_platform_bool returned "
+ "Unsupported image recognition feature capability\n");
+
+ return isImageRecognitionSupported;
+}
--- /dev/null
+/**
+ * Copyright (c) 2015 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 "mv_surveillance.h"
+
+#include "mv_surveillance_private.h"
+#include "mv_private.h"
+
+#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT
+
+/* Include headers of licensed surveillance module here. */
+#include "mv_surveillance_lic.h"
+
+#else
+
+/* Include headers of open surveillance module here. */
+#include "mv_surveillance_open.h"
+
+#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */
+
+/**
+ * @file mv_surveillance.c
+ * @brief This file contains the porting layer for Media Vision surveillance module.
+ */
+
+static size_t __mv_surveillance_id_counter = 0;
+
+int mv_surveillance_event_trigger_create(
+ const char *event_type,
+ mv_surveillance_event_trigger_h * trigger)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(event_type);
+ MEDIA_VISION_NULL_ARG_CHECK(trigger);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ mv_surveillance_event_trigger_s *handle =
+ (mv_surveillance_event_trigger_s *) malloc(
+ sizeof(mv_surveillance_event_trigger_s));
+ if (NULL == handle) {
+ LOGE("[%s] malloc fail", __func__);
+ return MEDIA_VISION_ERROR_OUT_OF_MEMORY;
+ }
+
+ memset(handle, 0, sizeof(mv_surveillance_event_trigger_s));
+
+ /* default values: */
+ handle->trigger_id = ++__mv_surveillance_id_counter;
+ handle->event_type = strndup(event_type, 255);
+ handle->number_of_roi_points = 0;
+ handle->roi = NULL;
+
+ *trigger = (mv_surveillance_event_trigger_h) handle;
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return MEDIA_VISION_ERROR_NONE;
+}
+
+int mv_surveillance_event_trigger_destroy(
+ mv_surveillance_event_trigger_h trigger)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(trigger);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ mv_surveillance_event_trigger_s *handle =
+ (mv_surveillance_event_trigger_s *) trigger;
+ free(handle->event_type);
+ free(handle->roi);
+ free((mv_surveillance_event_trigger_s *) trigger);
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return MEDIA_VISION_ERROR_NONE;
+}
+
+int mv_surveillance_get_event_trigger_type(
+ mv_surveillance_event_trigger_h trigger,
+ char **event_type)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(trigger);
+ MEDIA_VISION_NULL_ARG_CHECK(event_type);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ mv_surveillance_event_trigger_s *handle =
+ (mv_surveillance_event_trigger_s *)trigger;
+ *event_type = strndup(handle->event_type, 255);
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return MEDIA_VISION_ERROR_NONE;
+}
+
+int mv_surveillance_set_event_trigger_roi(
+ mv_surveillance_event_trigger_h trigger,
+ int number_of_points,
+ mv_point_s *roi)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(trigger);
+ MEDIA_VISION_NULL_ARG_CHECK(roi);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ if (number_of_points <= 0) {
+ LOGE("number of points shoulde be larger than zero");
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+
+ mv_surveillance_event_trigger_s *handle =
+ (mv_surveillance_event_trigger_s *)trigger;
+
+ if (handle->roi) {
+ free(handle->roi);
+ handle->roi = NULL;
+ }
+
+ handle->number_of_roi_points = number_of_points;
+ handle->roi = (mv_point_s*) malloc(sizeof(mv_point_s) * number_of_points);
+
+ if (NULL == handle->roi) {
+ LOGE("[%s] malloc fail", __func__);
+ return MEDIA_VISION_ERROR_OUT_OF_MEMORY;
+ }
+
+ int i = 0;
+ for (; i < number_of_points; ++i) {
+ handle->roi[i].x = roi[i].x;
+ handle->roi[i].y = roi[i].y;
+ }
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return MEDIA_VISION_ERROR_NONE;
+}
+
+int mv_surveillance_get_event_trigger_roi(
+ mv_surveillance_event_trigger_h trigger,
+ int *number_of_points,
+ mv_point_s ** roi)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(trigger);
+ MEDIA_VISION_NULL_ARG_CHECK(number_of_points);
+ MEDIA_VISION_NULL_ARG_CHECK(roi);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ mv_surveillance_event_trigger_s *handle =
+ (mv_surveillance_event_trigger_s *) trigger;
+
+ *number_of_points = handle->number_of_roi_points;
+ if (0 == *number_of_points) {
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return MEDIA_VISION_ERROR_NONE;
+ }
+
+ *roi = (mv_point_s *) malloc(
+ sizeof(mv_point_s) * handle->number_of_roi_points);
+
+ int i = 0;
+ for (; i < handle->number_of_roi_points; ++i) {
+ (*roi)[i].x = handle->roi[i].x;
+ (*roi)[i].y = handle->roi[i].y;
+ }
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return MEDIA_VISION_ERROR_NONE;
+}
+
+int mv_surveillance_subscribe_event_trigger(
+ mv_surveillance_event_trigger_h event_trigger,
+ int video_stream_id,
+ mv_engine_config_h engine_cfg,
+ mv_surveillance_event_occurred_cb callback,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(event_trigger);
+ MEDIA_VISION_NULL_ARG_CHECK(callback);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT
+
+ /* Use licensed surveillance functionality here. */
+ const int ret = mv_surveillance_subscribe_event_trigger_lic(
+ event_trigger,
+ video_stream_id,
+ engine_cfg,
+ callback,
+ user_data);
+
+#else
+
+ /* Use open surveillance functionality here. */
+ const int ret = mv_surveillance_subscribe_event_trigger_open(
+ event_trigger,
+ video_stream_id,
+ engine_cfg,
+ callback,
+ user_data);
+
+#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_surveillance_unsubscribe_event_trigger(
+ mv_surveillance_event_trigger_h event_trigger,
+ int video_stream_id)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(event_trigger);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT
+
+ /* Use licensed surveillance functionality here. */
+ const int ret = mv_surveillance_unsubscribe_event_trigger_lic(
+ event_trigger,
+ video_stream_id);
+
+#else
+
+ /* Use open surveillance functionality here. */
+ const int ret = mv_surveillance_unsubscribe_event_trigger_open(
+ event_trigger,
+ video_stream_id);
+
+#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_surveillance_push_source(
+ mv_source_h source,
+ int video_stream_id)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(source);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT
+
+ /* Use licensed surveillance functionality here. */
+ const int ret = mv_surveillance_push_source_lic(source, video_stream_id);
+
+#else
+
+ /* Use open surveillance functionality here. */
+ const int ret = mv_surveillance_push_source_open(source, video_stream_id);
+
+#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_surveillance_foreach_supported_event_type(
+ mv_surveillance_event_type_cb callback,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(callback);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT
+
+ /* Use licensed surveillance functionality here. */
+ const int ret = mv_surveillance_foreach_event_type_lic(
+ callback,
+ user_data);
+
+#else
+
+ /* Use open surveillance functionality here. */
+ const int ret = mv_surveillance_foreach_event_type_open(
+ callback,
+ user_data);
+
+#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
+
+int mv_surveillance_foreach_event_result_name(
+ const char *event_type,
+ mv_surveillance_event_result_name_cb callback,
+ void *user_data)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_NULL_ARG_CHECK(event_type);
+ MEDIA_VISION_NULL_ARG_CHECK(callback);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT
+
+ /* Use licensed surveillance functionality here. */
+ const int ret = mv_surveillance_foreach_event_result_value_name_lic(
+ event_type,
+ callback,
+ user_data);
+
+#else
+
+ /* Use open surveillance functionality here. */
+ const int ret = mv_surveillance_foreach_event_result_value_name_open(
+ event_type,
+ callback,
+ user_data);
+
+#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
+int mv_surveillance_get_result_value(
+ mv_surveillance_result_h result,
+ const char *value_name,
+ void *value)
+{
+ MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported());
+ MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(result);
+ MEDIA_VISION_NULL_ARG_CHECK(value_name);
+ MEDIA_VISION_NULL_ARG_CHECK(value);
+ MEDIA_VISION_FUNCTION_ENTER();
+
+#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT
+
+ /* Use licensed surveillance functionality here. */
+ const int ret = mv_surveillance_get_result_value_lic(
+ result,
+ value_name,
+ value);
+
+#else
+
+ /* Use open surveillance functionality here. */
+ const int ret = mv_surveillance_get_result_value_open(
+ result,
+ value_name,
+ value);
+
+#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return ret;
+}
Name: capi-media-vision
Summary: Media Vision library for Tizen Native API
-Version: 0.3.26
+Version: 0.3.27
Release: 0
Group: Multimedia/Framework
License: Apache-2.0 and BSD-3-Clause
%description devel
Media Vision library for Tizen Native API (DEV). Includes barcode detecting, barcode generating, face and image modules.
+%package common
+Summary: Multimedia Vision common Library
+Group: Multimedia/Framework
+
+%description common
+Media Vision common library for Tizen Native API.
+
+%package common-devel
+Summary: Multimedia Vision common Library
+Group: Multimedia/Framework
+Requires: capi-media-vision-common
+
+%description common-devel
+Media Vision common library for Tizen Native API (DEV).
+
+%package barcode
+Summary: Multimedia Vision Barcode Library
+Group: Multimedia/Framework
+Requires: capi-media-vision-common
+
+%description barcode
+Media Vision barcode library for Tizen Native API.
+
+%package barcode-devel
+Summary: Multimedia Vision Barcode Library
+Group: Multimedia/Framework
+Requires: capi-media-vision-barcode
+Requires: capi-media-vision-common-devel
+
+%description barcode-devel
+Media Vision barcode library for Tizen Native API (DEV).
+
+%package face
+Summary: Multimedia Vision Library
+Group: Multimedia/Framework
+Requires: capi-media-vision-common
+
+%description face
+Media Vision face library for Tizen Native API.
+
+%package face-devel
+Summary: Multimedia Vision Face Library (DEV)
+Group: Multimedia/Framework
+Requires: capi-media-vision-face
+Requires: capi-media-vision-common-devel
+
+%description face-devel
+Media Vision face library for Tizen Native API (DEV).
+
+%package image
+Summary: Multimedia Vision Image Library
+Group: Multimedia/Framework
+Requires: capi-media-vision-common
+
+%description image
+Media Vision Image library for Tizen Native API.
+
+%package image-devel
+Summary: Multimedia Vision Image Library
+Group: Multimedia/Framework
+Requires: capi-media-vision-image
+Requires: capi-media-vision-common-devel
+
+%description image-devel
+Media Vision Image library for Tizen Native API (DEV).
+
+%package surveillance
+Summary: Multimedia Vision Surveillance Library
+Group: Multimedia/Framework
+Requires: capi-media-vision-face
+
+%description surveillance
+Media Vision Surveillance library for Tizen Native API.
+
+%package surveillance-devel
+Summary: Multimedia Vision Surveillance Library
+Group: Multimedia/Framework
+Requires: capi-media-vision-surveillance
+Requires: capi-media-vision-common-devel
+
+%description surveillance-devel
+Media Vision Surveillance library for Tizen Native API (DEV).
+
+%package testsuite
+Summary: Multimedia Vision Test Suite
+Group: Multimedia/Framework
+Requires: capi-media-vision-barcode
+Requires: capi-media-vision-face
+Requires: capi-media-vision-image
+Requires: capi-media-vision-surveillance
+
+%description testsuite
+Media Vision Test Suite.
+
%prep
%setup -q
make %{?jobs:-j%jobs}
+
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_datadir}/%{name}
%{_libdir}/pkgconfig/*.pc
%{_libdir}/lib%{name}.so
%TZ_SYS_BIN/*
+
+%files common
+%manifest capi-media-vision.manifest
+%license LICENSE.APLv2
+%{_datadir}/%{name}/media-vision-config.json
+%{_libdir}/libmv_common*.so
+
+%files common-devel
+%{_includedir}/media/mv_common.h
+
+%files barcode
+%{_libdir}/libmv_barcode*.so
+
+%files barcode-devel
+%{_includedir}/media/mv_barcode*.h
+%{_libdir}/pkgconfig/*barcode.pc
+
+%files face
+%{_libdir}/libmv_face*.so
+
+%files face-devel
+%{_includedir}/media/mv_face*.h
+%{_libdir}/pkgconfig/*face.pc
+
+%files image
+%{_libdir}/libmv_image.so
+
+%files image-devel
+%{_includedir}/media/mv_image*.h
+%{_libdir}/pkgconfig/*image.pc
+
+%files surveillance
+%{_libdir}/libmv_surveillance*.so
+
+%files surveillance-devel
+%{_includedir}/media/mv_surveillance*.h
+%{_libdir}/pkgconfig/*surveillance.pc
+
+%files testsuite
+%{_libdir}/libmv_*helper.so
+%{_libdir}/libmv_testsuite*.so
+%TZ_SYS_BIN/mv_barcode*
+%TZ_SYS_BIN/mv_face*
+%TZ_SYS_BIN/mv_image*
+%TZ_SYS_BIN/mv_surveillance*
add_executable(${PROJECT_NAME} ${MV_TEST_SUITE_SRC_LIST} ${MV_TEST_SUITE_INC_LIST} ${MV_CAPI_MEDIA_VISION_INC_LIST})
-target_link_libraries(${PROJECT_NAME} capi-media-vision dlog avcodec avformat avutil swscale mv_image_helper)
+target_link_libraries(${PROJECT_NAME} ${MV_BARCODE_DETECTOR_LIB_NAME}
+ ${MV_BARCODE_GENERATOR_LIB_NAME}
+ capi-system-info
+ dlog
+ avcodec
+ avformat
+ avutil
+ swscale
+ mv_image_helper)
install(TARGETS ${PROJECT_NAME} DESTINATION ${testbin_dir})
${MV_FACE_TEST_SUITE_SRC_LIST}
${MV_CAPI_MEDIA_VISION_INC_LIST})
-target_link_libraries(${PROJECT_NAME} capi-media-vision
+target_link_libraries(${PROJECT_NAME} ${MV_FACE_LIB_NAME}
+ capi-system-info
dlog
mv_image_helper
mv_video_helper
add_executable(${PROJECT_NAME} ${MV_TEST_SUITE_SRC_LIST} ${MV_TEST_SUITE_INC_LIST} ${MV_CAPI_MEDIA_VISION_INC_LIST})
-target_link_libraries(${PROJECT_NAME} capi-media-vision
+target_link_libraries(${PROJECT_NAME} ${MV_IMAGE_LIB_NAME}
+ capi-system-info
glib-2.0
mv_image_helper
mv_video_helper
${MV_SURVEILLANCE_TS_INC_LIST}
${MV_CAPI_MEDIA_VISION_INC_LIST})
-target_link_libraries(${PROJECT_NAME} capi-media-vision
+target_link_libraries(${PROJECT_NAME} ${MV_SURVEILLANCE_LIB_NAME}
+ capi-system-info
mv_testsuite_common
mv_image_helper)