diff options
author | Tae-Young Chung <ty83.chung@samsung.com> | 2022-12-19 14:06:43 +0900 |
---|---|---|
committer | Tae-Young Chung <ty83.chung@samsung.com> | 2022-12-21 17:18:19 +0900 |
commit | 0ba09fa87ec75f2ccd7d6b863251d777784ad05e (patch) | |
tree | bc856ff8602697feb77d201cf81a7107b377a088 | |
parent | 4678c01ace6e4ed8def627d83a9475ca67d0ae4e (diff) | |
download | dfs-opencv-tizen.tar.gz dfs-opencv-tizen.tar.bz2 dfs-opencv-tizen.zip |
Support new DFS_DATA_INPUT_FORMAT_COUPLED_TBtizen_9.0_m2_releasetizen_8.0_m2_releaseaccepted/tizen/unified/20230113.091220accepted/tizen/9.0/unified/20241031.000210accepted/tizen/8.0/unified/20231005.093414tizen_9.0tizen_8.0tizenaccepted/tizen_unifiedaccepted/tizen_9.0_unifiedaccepted/tizen_8.0_unified
[Version] 1.0.12-0
[Issue type] new feature
This commit is to support new feature
https://review.tizen.org/gerrit/#/c/platform/core/multimedia/dfs-adaptation/+/285723/
Change-Id: I45205879d3bdd722df37d02b8f8f6b7ce4c99f36
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
-rw-r--r-- | packaging/dfs-opencv.spec | 2 | ||||
-rw-r--r-- | src/dfs_opencv.cpp | 67 |
2 files changed, 27 insertions, 42 deletions
diff --git a/packaging/dfs-opencv.spec b/packaging/dfs-opencv.spec index f7e6508..a0a2088 100644 --- a/packaging/dfs-opencv.spec +++ b/packaging/dfs-opencv.spec @@ -1,6 +1,6 @@ Name: dfs-opencv Summary: OpenCV based Depth-from-Stereo implementation -Version: 1.0.11 +Version: 1.0.12 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/dfs_opencv.cpp b/src/dfs_opencv.cpp index 70e1fe0..ca50668 100644 --- a/src/dfs_opencv.cpp +++ b/src/dfs_opencv.cpp @@ -247,11 +247,9 @@ namespace DfsAdaptationImpl case DFS_DATA_TYPE_UINT8C3: return CV_8UC3; default: - LOGE("Invalide type"); + throw std::runtime_error("invalid data type"); } - return -1; - LOGI("LEAVE"); } @@ -320,58 +318,46 @@ namespace DfsAdaptationImpl { LOGI("ENTER"); - if (!input.data) { + if (!input.data) throw std::runtime_error("invalid data pointer"); - } - int dataCvType = 1; - cv::Mat baseMat, extraMat; + cv::Mat mat(cv::Size(input.width, input.height), convertDfsDataTypeToCV(input.type), input.data); + LOGI("%zd x %zd", input.width, input.height); - if (input.format == DFS_DATA_INPUT_FORMAT_COUPLED_SBS) { + cv::Mat baseMat, extraMat; + switch (input.format) { + case DFS_DATA_INPUT_FORMAT_COUPLED_SBS: LOGI("side-by-side"); - if (cv::Size(input.width >> 1, input.height) != mImageSize) { + if (cv::Size(input.width >> 1, input.height) != mImageSize) throw std::runtime_error("invalid size"); - } - dataCvType = convertDfsDataTypeToCV(input.type); - if (dataCvType < 0) { - throw std::runtime_error("invalid data type"); - } - cv::Mat mat(cv::Size(input.width, input.height), dataCvType, input.data); - LOGI("%zd x %zd", input.width, input.height); baseMat = mat(cv::Rect(0, 0, mImageSize.width, mImageSize.height)).clone(); extraMat = mat(cv::Rect(mImageSize.width, 0, mImageSize.width, mImageSize.height)).clone(); - } else { - if (cv::Size(input.width, input.height) != mImageSize || - cv::Size(input.width, input.height) != mImageSize) { - LOGE("%zd x %zd but image size is %d x %d", - input.width, input.height, mImageSize.width, mImageSize.height); + break; + case DFS_DATA_INPUT_FORMAT_COUPLED_TB: + LOGI("top-and-bottom"); + if (cv::Size(input.width, input.height >> 1) != mImageSize) throw std::runtime_error("invalid size"); - } - dataCvType = convertDfsDataTypeToCV(input.type); - if (dataCvType < 0) { - LOGE("dataCvType: %d", dataCvType); - throw std::runtime_error("invalid data type"); - } - - baseMat = cv::Mat(cv::Size(input.width, input.height), - dataCvType, - input.data);; - extraMat = cv::Mat(cv::Size(input.width, input.height), - dataCvType, - input.extraData); - } - if (baseMat.size() != extraMat.size()) { - throw std::runtime_error("base and extra should be the same size"); - } + baseMat = mat(cv::Rect(0, 0, + mImageSize.width, + mImageSize.height)).clone(); + extraMat = mat(cv::Rect(0, mImageSize.height, + mImageSize.width, + mImageSize.height)).clone(); + break; + default: + if (cv::Size(input.width, input.height) != mImageSize) + throw std::runtime_error("invalid size"); - if (baseMat.type() != extraMat.type()) { - throw std::runtime_error("base and extra should be the type"); + baseMat = mat; + extraMat = cv::Mat(mImageSize, + baseMat.type(), + input.extraData); } cv::Mat dispMat, dispFiltMat; @@ -385,7 +371,6 @@ namespace DfsAdaptationImpl mExtraMat = extraMat; } - cv::Mat srcBaseMat, srcExtraMat; cv::resize(mBaseMat, srcBaseMat, cv::Size(), |