diff options
author | Tae-Young Chung <ty83.chung@samsung.com> | 2018-02-22 14:47:08 +0900 |
---|---|---|
committer | Tae-Young Chung <ty83.chung@samsung.com> | 2018-02-22 14:49:31 +0900 |
commit | 8386f45364ed6f051f4a62fa984d418e21a23256 (patch) | |
tree | 52e75fdeaa2201d768e1fde341577da75b6ac901 | |
parent | 901da2c63c6eafe5b004f97ed21a1dee200ec908 (diff) | |
download | mediavision-8386f45364ed6f051f4a62fa984d418e21a23256.tar.gz mediavision-8386f45364ed6f051f4a62fa984d418e21a23256.tar.bz2 mediavision-8386f45364ed6f051f4a62fa984d418e21a23256.zip |
Fixed static analysis issuessubmit/tizen/20180223.013628accepted/tizen/unified/20180223.062109
Added try-catch to handle cv's throwing exception
Fixed fill_engine_cfg_person_recognized() to return true or false accoring to configuration result
Change-Id: I7ab7abfe9bbb4ba360e2f3b0afbcfb1b9cfe7d94
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
-rw-r--r-- | mv_image/image/src/mv_image_open.cpp | 10 | ||||
-rw-r--r-- | packaging/capi-media-vision.spec | 4 | ||||
-rw-r--r-- | test/testsuites/surveillance/surveillance_test_suite.c | 12 |
3 files changed, 16 insertions, 10 deletions
diff --git a/mv_image/image/src/mv_image_open.cpp b/mv_image/image/src/mv_image_open.cpp index 42a5ce30..38df14f3 100644 --- a/mv_image/image/src/mv_image_open.cpp +++ b/mv_image/image/src/mv_image_open.cpp @@ -377,9 +377,13 @@ int convertSourceMV2GrayCV(mv_source_h mvSource, cv::Mat& cvSource) CV_MAKETYPE(depth, channelsNumber), buffer).clone(); } else {/* With conversion */ /* Class for representation the given image as cv::Mat before conversion */ - cv::Mat origin(cv::Size(width, height), - CV_MAKETYPE(depth, channelsNumber), buffer); - cv::cvtColor(origin, cvSource, conversionType); + cv::Mat origin(cv::Size(width, height), CV_MAKETYPE(depth, channelsNumber), buffer); + + try { + cv::cvtColor(origin, cvSource, conversionType); + } catch (cv::Exception &e) { + return MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT; + } } return MEDIA_VISION_ERROR_NONE; diff --git a/packaging/capi-media-vision.spec b/packaging/capi-media-vision.spec index f729b5bf..49f58982 100644 --- a/packaging/capi-media-vision.spec +++ b/packaging/capi-media-vision.spec @@ -1,7 +1,7 @@ Name: capi-media-vision Summary: Media Vision library for Tizen Native API -Version: 0.3.27 -Release: 5 +Version: 0.3.28 +Release: 1 Group: Multimedia/Framework License: Apache-2.0 and BSD-3-Clause Source0: %{name}-%{version}.tar.gz diff --git a/test/testsuites/surveillance/surveillance_test_suite.c b/test/testsuites/surveillance/surveillance_test_suite.c index 4e398b71..b8cce60c 100644 --- a/test/testsuites/surveillance/surveillance_test_suite.c +++ b/test/testsuites/surveillance/surveillance_test_suite.c @@ -605,6 +605,7 @@ void push_source() bool fill_engine_cfg_person_recognized(mv_engine_config_h engine_cfg) { + bool ret = false; char *path_to_model = NULL; while (input_string("Input file name with face recognition model:", @@ -616,16 +617,17 @@ bool fill_engine_cfg_person_recognized(mv_engine_config_h engine_cfg) MV_SURVEILLANCE_FACE_RECOGNITION_MODEL_FILE_PATH, path_to_model); - if (error != MEDIA_VISION_ERROR_NONE) - PRINT_E("Setting path to face recognition model failed, code %i", - error); - else + if (error != MEDIA_VISION_ERROR_NONE) { + PRINT_E("Setting path to face recognition model failed, code %i", error); + } else { printf("\nModel path is %s \n", path_to_model); + ret = true; + } if (path_to_model != NULL) free(path_to_model); - return true; + return ret; } void turn_on_off_saving_to_image() |