summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTae-Young Chung <ty83.chung@samsung.com>2022-12-19 14:06:43 +0900
committerTae-Young Chung <ty83.chung@samsung.com>2022-12-21 17:18:19 +0900
commit0ba09fa87ec75f2ccd7d6b863251d777784ad05e (patch)
treebc856ff8602697feb77d201cf81a7107b377a088
parent4678c01ace6e4ed8def627d83a9475ca67d0ae4e (diff)
downloaddfs-opencv-tizen.tar.gz
dfs-opencv-tizen.tar.bz2
dfs-opencv-tizen.zip
[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.spec2
-rw-r--r--src/dfs_opencv.cpp67
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(),