2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __DFS_OPENCV_PRIVATE_H__
18 #define __DFS_OPENCV_PRIVATE_H__
20 #include <dfs_adaptation.h>
21 #include <dfs_parameter.h>
23 #include <opencv2/core.hpp>
24 #include <opencv2/calib3d.hpp>
25 #include <opencv2/imgproc.hpp>
28 * @file dfs_opencv_private.h
29 * @brief This file contains the DfsAdaptorOCV class which
30 * provides OpenCV based depth functionality
37 #define LOG_TAG "DFS_ADAPTATION_OCV"
39 using namespace DfsAdaptation;
41 namespace DfsAdaptationImpl
43 typedef struct _CameraParam {
49 intrinsic = cv::Mat(cv::Size(3,3), CV_32FC1);
50 distCoeffs = cv::Mat(cv::Size(1,5), CV_32FC1);
54 typedef struct _StereoParam {
55 CameraParam baceCamera;
56 CameraParam extraCamera;
63 translation = cv::Mat(cv::Size(1,3), CV_32FC1);
64 rotation = cv::Mat(cv::Size(1,3), CV_32FC1);
68 class DfsOCV : public IDfsAdaptation
71 cv::Ptr<cv::StereoSGBM> mDfsOcv;
73 DfsParameter mDfsParam;
74 size_t mNumDisparities;
84 std::string mCalibFilePath;
85 StereoParam mStereoParam;
86 bool mIsStereoCalibrated;
87 bool mUpdateStereoCalibration;
90 cv::Mat mBaseReMap[2];
91 cv::Mat mExtraReMap[2];
94 int ConvertDfsDataTypeToCV(int type);
95 void InitializeStereoCalibration();
96 void InitRectifyMap();
102 void Initialize(DfsParameter& param) override;
103 void Run(DfsData& base, DfsData& extra) override;
105 DfsData& GetDepthData() override;
110 #endif /* __DFS_OPENCV_PRIVATE_H__ */