Use DfsInputData and DfsOutputData instead of DfsData 79/279579/1
authorTae-Young Chung <ty83.chung@samsung.com>
Fri, 12 Aug 2022 01:25:37 +0000 (10:25 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Fri, 12 Aug 2022 01:36:18 +0000 (10:36 +0900)
[Version] 1.0.7-0
[Issue type] update

Apply changes of https://review.tizen.org/gerrit/#/c/platform/core/multimedia/dfs-adaptation/+/279576/
Use DfsInputData and DfsOutputData instead of DfsData and
Define new DFS_DATA_INPUT_FORMAT enumeration
Change-Id: I8e8724ac08704fc420ff96f5c4b238881176110d

packaging/dfs-opencv.spec
src/dfs_opencv.cpp
src/dfs_opencv_private.h

index db501b0af4a405abf8c9bf6ba29acbc229544960..5a310ea3b64c02c08f64c81de3ec6b9e79dc7a52 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dfs-opencv
 Summary:    OpenCV based Depth-from-Stereo implementation
-Version:    1.0.6
+Version:    1.0.7
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index d72f0b2eb372280a05e392dd473a1c26cdb70f78..d429bc9d38a76b7e150e12c00956be5d9bca6217 100644 (file)
@@ -316,30 +316,29 @@ namespace DfsAdaptationImpl
                return results;
        }
 
-       void DfsOCV::Run(DfsData& base, DfsData& extra)
+       void DfsOCV::Run(DfsInputData& data)
        {
                LOGI("ENTER");
 
-               if (!base.data) {
+               if (!data.data) {
                        throw std::runtime_error("invalid data pointer");
                }
 
-               int baseCvType = 1;
-               int extraCvType = -1;
+               int dataCvType = 1;
                cv::Mat baseMat, extraMat;
 
-               if (!extra.data) {
+               if (data.inputFormat == DFS_DATA_INPUT_FORMAT_COUPLED_SBS) {
                        LOGI("side-by-side");
-                       if (cv::Size(base.width >> 1, base.height) != mImageSize) {
+                       if (cv::Size(data.width >> 1, data.height) != mImageSize) {
                                throw std::runtime_error("invalid size");
                        }
 
-                       baseCvType = ConvertDfsDataTypeToCV(base.type);
-                       if (baseCvType < 0) {
+                       dataCvType = ConvertDfsDataTypeToCV(data.type);
+                       if (dataCvType < 0) {
                                throw std::runtime_error("invalid data type");
                        }
-                       cv::Mat mat(cv::Size(base.width, base.height), baseCvType, base.data);
-                       LOGI("%zd x %zd", base.width, base.height);
+                       cv::Mat mat(cv::Size(data.width, data.height), dataCvType, data.data);
+                       LOGI("%zd x %zd", data.width, data.height);
                        baseMat = mat(cv::Rect(0, 0,
                                                mImageSize.width,
                                                mImageSize.height)).clone();
@@ -347,24 +346,24 @@ namespace DfsAdaptationImpl
                                                mImageSize.width,
                                                mImageSize.height)).clone();
                } else {
-                       if (cv::Size(base.width, base.height) != mImageSize ||
-                               cv::Size(extra.width, extra.height) != mImageSize) {
+                       if (cv::Size(data.width, data.height) != mImageSize ||
+                               cv::Size(data.width, data.height) != mImageSize) {
+                               LOGE("%zd x %zd but image size is %d x %d",
+                                               data.width, data.height, mImageSize.width, mImageSize.height);
                                throw std::runtime_error("invalid size");
                        }
-                       baseCvType = ConvertDfsDataTypeToCV(base.type);
-                       extraCvType = ConvertDfsDataTypeToCV(extra.type);
-                       if (baseCvType < 0 || extraCvType < 0) {
-                               LOGE("baseCvType: %d, extraCvType:%d", baseCvType, extraCvType);
+                       dataCvType = ConvertDfsDataTypeToCV(data.type);
+                       if (dataCvType < 0) {
+                               LOGE("dataCvType: %d", dataCvType);
                                throw std::runtime_error("invalid data type");
                        }
 
-                       baseMat = cv::Mat(cv::Size(base.width, base.height),
-                                                       baseCvType,
-                                                       base.data);;
-                       extraMat = cv::Mat(cv::Size(extra.width,
-                                                       extra.height),
-                                                       extraCvType,
-                                                       extra.data);
+                       baseMat = cv::Mat(cv::Size(data.width, data.height),
+                                                       dataCvType,
+                                                       data.data);;
+                       extraMat = cv::Mat(cv::Size(data.width, data.height),
+                                                       dataCvType,
+                                                       data.extraData);
                }
 
                if (baseMat.size() != extraMat.size()) {
@@ -472,13 +471,10 @@ namespace DfsAdaptationImpl
                mDepthData.height = mDepthMat.rows;
                mDepthData.stride = mDepthMat.elemSize() *  mDepthMat.cols;
 
-               mDepthData.pointCloudData = nullptr;
-               mDepthData.pointCloudSize = 0;
-
                LOGI("LEAVE");
        }
 
-       DfsData& DfsOCV::GetDepthData()
+       DfsOutputData& DfsOCV::GetDepthData()
        {
                LOGI("ENTER");
 
index e6da346581b84ff91e4fbc2a3f4275eefb3b647a..b20ce4dd72106f3dad52413498c8b1b6651ac655 100644 (file)
@@ -97,7 +97,7 @@ namespace DfsAdaptationImpl
                cv::Mat mDepthMat;
                cv::Mat mDisp2DepthMat;
                cv::Mat mDispOffsetMat;
-               DfsData mDepthData;
+               DfsOutputData mDepthData;
 
                StereoParam mStereoParam;
                bool mIsStereoCalibrated;
@@ -134,9 +134,9 @@ namespace DfsAdaptationImpl
 
                void Initialize(DfsParameter& param, size_t width, size_t height,
                                                size_t minDisp, size_t maxDisp, std::string stereoConfigPath) override;
-               void Run(DfsData& base, DfsData& extra) override;
+               void Run(DfsInputData& data) override;
 
-               DfsData& GetDepthData() override;
+               DfsOutputData& GetDepthData() override;
 
        };
 }