Commit 707beb3f authored by Muresan Mircea Paul's avatar Muresan Mircea Paul

modified matching class such that parameters are added at runtime

Removed the matching cpp file as it is no longer usefull

removed warnings

header for some used functions

fixed the popcnt issue

changes according to comments
parent df859520
......@@ -147,12 +147,6 @@ namespace cv
virtual int getSmallerBlockSize() const = 0;
virtual void setSmallerBlockSize(int blockSize) = 0;
virtual Rect getROI1() const = 0;
virtual void setROI1(Rect roi1) = 0;
virtual Rect getROI2() const = 0;
virtual void setROI2(Rect roi2) = 0;
virtual int getScalleFactor() const = 0 ;
virtual void setScalleFactor(int factor) = 0;
......@@ -233,9 +227,9 @@ namespace cv
zero. In the current implementation, this parameter must be divisible by 16.
@param blockSize Matched block size. It must be an odd number \>=1 . Normally, it should be
somewhere in the 3..11 range.
@param P1 The first parameter controlling the disparity smoothness. See below.
@param P2 The second parameter controlling the disparity smoothness. The larger the values are,
the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
@param P1 The first parameter controlling the disparity smoothness.This parameter is used for the case of slanted surfaces (not fronto parallel).
@param P2 The second parameter controlling the disparity smoothness.This parameter is used for "solving" the depth discontinuities problem.
The larger the values are, the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
pixels. The algorithm requires P2 \> P1 . See stereo_match.cpp sample where some reasonably good
P1 and P2 values are shown (like 8\*number_of_image_channels\*SADWindowSize\*SADWindowSize and
......@@ -263,7 +257,7 @@ namespace cv
to a custom value.
*/
CV_EXPORTS static Ptr<cv::stereo::StereoBinarySGBM> create(int minDisparity, int numDisparities, int blockSize,
int P1 = 0, int P2 = 0, int disp12MaxDiff = 0,
int P1 = 100, int P2 = 1000, int disp12MaxDiff = 0,
int preFilterCap = 0, int uniquenessRatio = 0,
int speckleWindowSize = 0, int speckleRange = 0,
int mode = StereoBinarySGBM::MODE_SGBM);
......
This diff is collapsed.
This diff is collapsed.
......@@ -69,7 +69,6 @@ namespace cv
textureThreshold = 10;
uniquenessRatio = 15;
speckleRange = speckleWindowSize = 0;
roi1 = roi2 = Rect(0, 0, 0, 0);
disp12MaxDiff = -1;
dispType = CV_16S;
usePrefilter = false;
......@@ -89,7 +88,6 @@ namespace cv
int uniquenessRatio;
int speckleRange;
int speckleWindowSize;
Rect roi1, roi2;
int disp12MaxDiff;
int dispType;
int scalling;
......@@ -268,7 +266,7 @@ namespace cv
StereoBinaryBMParams* state;
};
class StereoBinaryBMImpl : public StereoBinaryBM,public Matching
class StereoBinaryBMImpl : public StereoBinaryBM, public Matching
{
public:
StereoBinaryBMImpl()
......@@ -279,6 +277,7 @@ namespace cv
StereoBinaryBMImpl(int _numDisparities, int _kernelSize) : Matching(_numDisparities)
{
params = StereoBinaryBMParams(_numDisparities, _kernelSize);
previous_size = 0;
}
void compute(InputArray leftarr, InputArray rightarr, OutputArray disparr)
......@@ -340,6 +339,14 @@ namespace cv
int width = left0.cols;
int height = left0.rows;
if(previous_size != width * height)
{
previous_size = width * height;
specklePointX = new int[width * height];
specklePointY = new int[width * height];
pus = new long long[width * height];
}
int wsz = params.kernelSize;
int bufSize0 = (int)((ndisp + 2)*sizeof(int));
bufSize0 += (int)((height + wsz + 2)*ndisp*sizeof(int));
......@@ -462,12 +469,6 @@ namespace cv
int getSmallerBlockSize() const { return 0; }
void setSmallerBlockSize(int) {}
Rect getROI1() const { return params.roi1; }
void setROI1(Rect roi1) { params.roi1 = roi1; }
Rect getROI2() const { return params.roi2; }
void setROI2(Rect roi2) { params.roi2 = roi2; }
void write(FileStorage& fs) const
{
fs << "name" << name_
......@@ -499,7 +500,6 @@ namespace cv
params.preFilterCap = (int)fn["preFilterCap"];
params.textureThreshold = (int)fn["textureThreshold"];
params.uniquenessRatio = (int)fn["uniquenessRatio"];
params.roi1 = params.roi2 = Rect();
}
StereoBinaryBMParams params;
......@@ -511,7 +511,7 @@ namespace cv
Mat partialSumsLR;
Mat agregatedHammingLRCost;
Mat Integral[2];
int previous_size;
static const char* name_;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment