From: SeokHoon Lee Date: Thu, 10 Dec 2015 07:06:44 +0000 (+0900) Subject: Change path of saved/loaded model data X-Git-Tag: submit/tizen/20151214.225408^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97aa7477e98a4ae40576ad49fb30960b5947d66d;p=platform%2Fcore%2Fapi%2Fmediavision.git Change path of saved/loaded model data Signed-off-by: SeokHoon Lee Change-Id: Ie7db6b92fede50dd083755b36e1e8ef5a29cff43 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ec1ac79..49c3ed3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,7 @@ INCLUDE_DIRECTORIES(${INC_DIR} ${INC_IMAGE} ${INC_SURVEILLANCE}) -SET(dependents "dlog capi-media-tool capi-system-info capi-appfw-application") +SET(dependents "dlog capi-media-tool capi-system-info") SET(pc_dependents "dlog") INCLUDE(FindPkgConfig) diff --git a/include/mv_face.h b/include/mv_face.h index 2b6d235e..e0f765b6 100644 --- a/include/mv_face.h +++ b/include/mv_face.h @@ -661,10 +661,12 @@ int mv_face_recognition_model_clone( * This examples can be removed by * @ref mv_face_recognition_model_reset() function if * it is needed to clear the memory. - * @remarks @a recognition_model is saved to the application's data directory. + * @remarks @a recognition_model is saved to the absolute path directory. + * Use @ref app_get_data_path for the private app storage path or + * @ref app_get_shared_data_path for the app shared storage path. * After model is saved to the file, it can be loaded from this file * by @ref mv_face_recognition_model_load() function. - * @param [in] file_name Name of the file to save the model + * @param [in] file_name Name of the path/file to save the model * @param [in] recognition_model The handle to the recognition model to be * saved to the file * @return @c 0 on success, otherwise a negative error value @@ -683,6 +685,8 @@ int mv_face_recognition_model_clone( * * @see mv_face_recognition_model_load() * @see mv_face_recognition_model_create() + * @see app_get_data_path() + * @see app_get_shared_data_path() */ int mv_face_recognition_model_save( const char *file_name, @@ -699,10 +703,12 @@ int mv_face_recognition_model_save( * @ref mv_face_recognition_model_reset() function. It * is recommended to clear the memory if learning algorithm doesn't * support reinforcement learning. - * @remarks @a recognition_model is loaded from the application's data directory. + * @remarks @a recognition_model is loaded from the absolute path directory. + * Use @ref app_get_data_path for the private app storage path or + * @ref app_get_shared_data_path for the app shared storage path. * @a recognition_model must be destroyed using * @ref mv_face_recognition_model_destroy(). - * @param [in] file_name Name of file to load the model + * @param [in] file_name Name of path/file to load the model * @param [out] recognition_model The handle to the recognition model * to be loaded from the file * @return @c 0 on success, otherwise a negative error value @@ -719,6 +725,8 @@ int mv_face_recognition_model_save( * * @see mv_face_recognition_model_save() * @see mv_face_recognition_model_destroy() + * @see app_get_data_path() + * @see app_get_shared_data_path() */ int mv_face_recognition_model_load( const char *file_name, @@ -1033,10 +1041,12 @@ int mv_face_tracking_model_clone( * @brief Calls this method to save tracking model to the file. * * @since_tizen 3.0 - * @remarks @ tracking_model is saved to the application's data directory. + * @remarks @a tracking_model is saved to the absolute path directory. + * Use @ref app_get_data_path for the private app storage path or + * @ref app_get_shared_data_path for the app shared storage path. * After model is saved to the file, it can be loaded from this file * with @ref mv_face_tracking_model_load() function. - * @param [in] file_name Name of the file to save the model + * @param [in] file_name Name of the path/file to save the model * @param [in] tracking_model The handle to the tracking model to be * saved to the file * @return @c 0 on success, otherwise a negative error value @@ -1055,6 +1065,8 @@ int mv_face_tracking_model_clone( * * @see mv_face_tracking_model_load() * @see mv_face_tracking_model_create() + * @see app_get_data_path() + * @see app_get_shared_data_path() */ int mv_face_tracking_model_save( const char *file_name, @@ -1064,10 +1076,12 @@ int mv_face_tracking_model_save( * @brief Calls this method to load a tracking model from file. * * @since_tizen 3.0 - * @remarks @a tracking_model is loaded from the application's data directory. + * @remarks @a tracking_model is loaded from the absolute path directory. + * Use @ref app_get_data_path for the private app storage path or + * @ref app_get_shared_data_path for the app shared storage path. * @a tracking_model must be destroyed using * @ref mv_face_tracking_model_destroy. - * @param [in] file_name Name of file to load the model + * @param [in] file_name Name of path/file to load the model * @param [out] tracking_model The handle to the tracking model to be * loaded from file * @return @c 0 on success, otherwise a negative error value @@ -1089,6 +1103,8 @@ int mv_face_tracking_model_save( * * @see mv_face_tracking_model_save() * @see mv_face_tracking_model_destroy() + * @see app_get_data_path() + * @see app_get_shared_data_path() */ int mv_face_tracking_model_load( const char *file_name, diff --git a/include/mv_image.h b/include/mv_image.h index 5efb9b6d..a1a3d34d 100644 --- a/include/mv_image.h +++ b/include/mv_image.h @@ -617,8 +617,10 @@ int mv_image_object_clone( * @brief Saves the image object. * * @since_tizen 3.0 - * @remarks @a image_object is saved to the application's data directory. - * @param [in] file_name Name of the file to save the image object + * @remarks @a image_object is saved to the absolute path directory. + * Use @ref app_get_data_path for the private app storage path or + * @ref app_get_shared_data_path for the app shared storage path. + * @param [in] file_name Name of the file to path/save the image object * @param [in] image_object The handle to the image object which will be saved * @return @c 0 on success, otherwise a negative error value * @retval #MEDIA_VISION_ERROR_NONE Successful @@ -642,10 +644,12 @@ int mv_image_object_save( * @brief Loads an image object from the file. * * @since_tizen 3.0 - * @remarks @a image_object is loaded from the application's data directory. + * @remarks @a image_object is loaded from the absolute path directory. + * Use @ref app_get_data_path for the private app storage path or + * @ref app_get_shared_data_path for the app shared storage path. * @a image_object must be destroyed using * @ref mv_image_object_destroy(). - * @param [in] file_name Name of file to load the image object + * @param [in] file_name Name of path/file to load the image object * @param [out] image_object The handle to the image object which will be * filled * @return @c 0 on success, otherwise a negative error value @@ -799,8 +803,10 @@ int mv_image_tracking_model_clone( * @brief Saves the image tracking model. * * @since_tizen 3.0 - * @remarks @a image_tracking_model is saved to the application's data directory. - * @param [in] file_name Name of file to save the model + * @remarks @a image_tracking_model is saved to the absolute path directory. + * Use @ref app_get_data_path for the private app storage path or + * @ref app_get_shared_data_path for the app shared storage path. + * @param [in] file_name Name of path/file to save the model * @param [in] image_tracking_model The handle to the image tracking model * to be saved * @return @c 0 on success, otherwise a negative error value @@ -826,10 +832,12 @@ int mv_image_tracking_model_save( * @brief Loads an image tracking model from the file. * * @since_tizen 3.0 - * @remarks @a image_tracking_model is loaded from the application's data directory. + * @remarks @a image_tracking_model is loaded from the absolute path directory. + * Use @ref app_get_data_path for the private app storage path or + * @ref app_get_shared_data_path for the app shared storage path. * @a image_tracking_model must be destroyed using * @ref mv_image_tracking_model_destroy. - * @param [in] file_name Name of file to load model + * @param [in] file_name Name of path/file to load model * @param [out] image_tracking_model The handle to the image tracking * model to be filled * @return @c 0 on success, otherwise a negative error value diff --git a/mv_face/face/src/FaceRecognitionModel.cpp b/mv_face/face/src/FaceRecognitionModel.cpp index 394e067a..7a42cffa 100644 --- a/mv_face/face/src/FaceRecognitionModel.cpp +++ b/mv_face/face/src/FaceRecognitionModel.cpp @@ -19,8 +19,6 @@ #include "mv_private.h" #include "mv_common.h" -#include - #include #include @@ -195,11 +193,8 @@ int FaceRecognitionModel::save(const std::string& fileName) if (!m_recognizer.empty()) { std::string filePath; - char *cPath = app_get_data_path(); - if (NULL == cPath) - filePath = fileName; - else - filePath = std::string(cPath) + fileName; + + filePath = fileName; std::string prefixPath = filePath.substr(0, filePath.find_last_of('/')); LOGD("prefixPath: %s", prefixPath.c_str()); @@ -251,11 +246,8 @@ int FaceRecognitionModel::save(const std::string& fileName) int FaceRecognitionModel::load(const std::string& fileName) { std::string filePath; - char *cPath = app_get_data_path(); - if (NULL == cPath) - filePath = fileName; - else - filePath = std::string(cPath) + fileName; + + filePath = fileName; if (access(filePath.c_str(), F_OK)) { LOGE("Can't load face recognition model. File[%s] doesn't existed.", filePath.c_str()); diff --git a/mv_face/face/src/FaceTrackingModel.cpp b/mv_face/face/src/FaceTrackingModel.cpp index 5feeb2ab..cebbb696 100644 --- a/mv_face/face/src/FaceTrackingModel.cpp +++ b/mv_face/face/src/FaceTrackingModel.cpp @@ -19,8 +19,6 @@ #include "mv_private.h" #include "mv_common.h" -#include - #include namespace MediaVision { @@ -74,11 +72,8 @@ int FaceTrackingModel::save(const std::string& fileName) } std::string filePath; - char *cPath = app_get_data_path(); - if (NULL == cPath) - filePath = fileName; - else - filePath = std::string(cPath) + fileName; + + filePath = fileName; std::string prefixPath = filePath.substr(0, filePath.find_last_of('/')); LOGD("prefixPath: %s", prefixPath.c_str()); @@ -111,11 +106,8 @@ int FaceTrackingModel::save(const std::string& fileName) int FaceTrackingModel::load(const std::string& fileName) { std::string filePath; - char *cPath = app_get_data_path(); - if (NULL == cPath) - filePath = fileName; - else - filePath = std::string(cPath) + fileName; + + filePath = fileName; if (access(filePath.c_str(), F_OK)) { LOGE("Can't load face tracking model. File[%s] doesn't existed.", filePath.c_str()); diff --git a/mv_image/image/src/Recognition/ImageObject.cpp b/mv_image/image/src/Recognition/ImageObject.cpp index ac6569fb..d9f99af9 100644 --- a/mv_image/image/src/Recognition/ImageObject.cpp +++ b/mv_image/image/src/Recognition/ImageObject.cpp @@ -25,8 +25,6 @@ #include "mv_private.h" #include "mv_common.h" -#include - #include #include @@ -180,11 +178,8 @@ bool ImageObject::getLabel(int& label) const int ImageObject::save(const char *fileName) const { std::string filePath; - char *cPath = app_get_data_path(); - if (NULL == cPath) - filePath = fileName; - else - filePath = std::string(cPath) + std::string(fileName); + + filePath = fileName; std::string prefixPath = filePath.substr(0, filePath.find_last_of('/')); LOGD("prefixPath: %s", prefixPath.c_str()); @@ -216,11 +211,8 @@ int ImageObject::save(const char *fileName) const int ImageObject::load(const char *fileName) { std::string filePath; - char *cPath = app_get_data_path(); - if (NULL == cPath) - filePath = fileName; - else - filePath = std::string(cPath) + std::string(fileName); + + filePath = fileName; if (access(filePath.c_str(), F_OK)) { LOGE("Can't load image object model. Path[%s] doesn't existed.", filePath.c_str()); diff --git a/mv_image/image/src/Tracking/ImageTrackingModel.cpp b/mv_image/image/src/Tracking/ImageTrackingModel.cpp index 6240ea8d..b9a89cec 100644 --- a/mv_image/image/src/Tracking/ImageTrackingModel.cpp +++ b/mv_image/image/src/Tracking/ImageTrackingModel.cpp @@ -25,8 +25,6 @@ #include "mv_private.h" #include "mv_common.h" -#include - #include #include @@ -223,11 +221,8 @@ ImageTrackingModel& ImageTrackingModel::operator=(const ImageTrackingModel& copy int ImageTrackingModel::save(const char *filepath) const { std::string filePath; - char *cPath = app_get_data_path(); - if (NULL == cPath) - filePath = std::string(filepath); - else - filePath = std::string(cPath) + std::string(filepath); + + filePath = std::string(filepath); std::string prefixPath = filePath.substr(0, filePath.find_last_of('/')); LOGD("prefixPath: %s", prefixPath.c_str()); @@ -258,11 +253,8 @@ int ImageTrackingModel::save(const char *filepath) const int ImageTrackingModel::load(const char *filepath) { std::string filePath; - char *cPath = app_get_data_path(); - if (NULL == cPath) - filePath = std::string(filepath); - else - filePath = std::string(cPath) + std::string(filepath); + + filePath = std::string(filepath); if (access(filePath.c_str(),F_OK)) { LOGE("Can't load tracking model. Path[%s] doesn't existed.", filepath); diff --git a/packaging/capi-media-vision.spec b/packaging/capi-media-vision.spec index 11304f87..32d97bc2 100644 --- a/packaging/capi-media-vision.spec +++ b/packaging/capi-media-vision.spec @@ -1,13 +1,12 @@ Name: capi-media-vision Summary: Media Vision library for Tizen Native API -Version: 0.3.3 +Version: 0.3.4 Release: 0 Group: Multimedia/Framework License: Apache-2.0 and BSD-2.0 Source0: %{name}-%{version}.tar.gz BuildRequires: cmake BuildRequires: pkgconfig(capi-media-tool) -BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(libtbm) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(capi-system-info)