SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
ENDFOREACH(flag)
-find_package(OpenCV REQUIRED calib3d imgproc)
+find_package(OpenCV REQUIRED core calib3d imgproc)
if(NOT OpenCV_FOUND)
message(SEND_ERROR "OpenCV NOT FOUND")
return()
namespace DfsAdaptationImpl
{
- DfsOCV::DfsOCV()
+ DfsOCV::DfsOCV() :
+ mDfsOcv(nullptr),
+ mTextureThreshold(0.0),
+ mAggregationWindowWidth(3),
+ mAggregationWindowHeight(3),
+ mMaxSpeckleSize(0),
+ mNumDisparities(179),
+ mBlockSize(5),
+ mMinDisparity(32),
+ mP1(24*3),
+ mP2(96*3),
+ mPreFilterCap(63)
{
LOGI("ENTER");
LOGI("LEAVE");
LOGI("LEAVE");
}
+ void DfsOCV::Initialize(double textureThreshold,
+ size_t aggregationWindowWidth,
+ size_t aggregationWindowHeight,
+ size_t maxSpeckleSize)
+ {
+ mTextureThreshold = textureThreshold;
+ mAggregationWindowWidth = aggregationWindowWidth;
+ mAggregationWindowHeight = aggregationWindowHeight;
+ mMaxSpeckleSize = maxSpeckleSize;
+
+ mDfsOcv = cv::StereoSGBM::create(1, mNumDisparities, mBlockSize);
+
+ this->SetParameters();
+ }
+
+ void DfsOCV::SetParameters()
+ {
+ mDfsOcv->setMinDisaprity(mMinDisparity);
+ mDfsOcv->setNumDisaprities(mNumDisparities);
+ mDfsOcv->setBlockSize(mBlockSize);
+ mDfsOcv->setP1(mP1 * mBlockSize * mBlockSize);
+ mDfsOcv->setP2(mP2 * mBlockSize * mBlockSize);
+ mDfsOcv->setPreFilterCap(mPreFilterCap);
+
+ mDfsOcv->setMode(cv::StereoSGBM::MODE_SGBM_3WAY);
+ }
+
extern "C"
{
class IDfsAdaptation *AdaptorInit(void)
#include <dfs_adaptation.h>
+#include <opencv2/core.hpp>
+#include <opencv2/calib3d.hpp>
+#include <opencv2/imgproc.hpp>
+
/**
* @file dfs_opencv_private.h
* @brief This file contains the DfsAdaptorOCV class which
{
class DfsOCV : public IDfsAdaptation
{
+ private:
+ cv::Ptr<cv::StereoSGBM> mDfsOcv;
+
+ double mTextureThreshold;
+ size_t mAggregationWindowWidth;
+ size_t mAggregationWindowHeight;
+ size_t mMaxSpeckleSize;
+ size_t mNumDisparities;
+ size_t mBlockSize;
+ size_t mMinDisparity;
+ size_t mP1;
+ size_t mP2;
+ size_t mPreFilterCap;
+
+ void SetParameters();
public:
DfsOCV();
~DfsOCV();
+
+ void Initialize(double textureThreshold,
+ size_t aggregationWindowWidth,
+ size_t aggregationWindowHeight,
+ size_t maxSpeckleSize) override;
+
};
}