Commit 2bd8d585 authored by LaurentBerger's avatar LaurentBerger Committed by Alexander Alekhin

Merge pull request #1678 from LaurentBerger:MoveAssert

* Some bugs in deriche and paillou filter

* Cv_Assert to CV_CheckType
parent c6daea8d
......@@ -135,6 +135,7 @@ HorizontalIIRFilter(Mat &img, Mat &dst, const Range &r, double alphaDerive)
j = cols - 1;
g2[j] = (a3 + a4)* *c1;
j--;
c1--;
g2[j] = (a3 + a4) * c1[1] + b1 * g2[j + 1];
j--;
c1--;
......@@ -160,16 +161,18 @@ public:
dst(d),
alphaDerive(ald),
verbose(false)
{}
{
int type = img.depth();
CV_CheckType(type, type == CV_8UC1 || type == CV_8SC1 || type == CV_16SC1 || type == CV_16UC1 || type == CV_32FC1, "Wrong input type for GradientDericheYCols");
type = dst.depth();
CV_CheckType(type, type==CV_32FC1, "Wrong output type for GradientDericheYCols");
}
void Verbose(bool b) { verbose = b; }
virtual void operator()(const Range& range) const CV_OVERRIDE
{
CV_Assert(img.depth()==CV_8UC1 || img.depth()==CV_8SC1 || img.depth()==CV_16SC1 || img.depth()==CV_16UC1);
CV_Assert(dst.depth()==CV_32FC1);
if (verbose)
std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl;
switch (img.depth()) {
case CV_8U:
VerticalIIRFilter<uchar>(img,dst,range, alphaDerive);
......@@ -183,6 +186,9 @@ public:
case CV_16S:
VerticalIIRFilter<short>(img, dst, range, alphaDerive);
break;
case CV_32F:
VerticalIIRFilter<float>(img, dst, range, alphaDerive);
break;
default:
return;
}
......@@ -207,12 +213,15 @@ public:
dst(d),
alphaMoyenne(alm),
verbose(false)
{}
{
int type = img.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong input type for GradientDericheYRows");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientDericheYRows");
}
void Verbose(bool b) { verbose = b; }
virtual void operator()(const Range& range) const CV_OVERRIDE
{
CV_Assert(img.depth()==CV_32FC1);
CV_Assert(dst.depth()==CV_32FC1);
if (verbose)
std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl;
float *f1, *f2;
......@@ -280,12 +289,15 @@ public:
dst(d),
alphaMoyenne(alm),
verbose(false)
{}
{
int type = img.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong input type for GradientDericheXCols");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientDericheXCols");
}
void Verbose(bool b) { verbose = b; }
virtual void operator()(const Range& range) const CV_OVERRIDE
{
CV_Assert(img.depth()==CV_32FC1);
CV_Assert(dst.depth()==CV_32FC1);
if (verbose)
std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl;
float *f1, *f2;
......@@ -355,12 +367,15 @@ public:
dst(d),
alphaDerive(ald),
verbose(false)
{}
{
int type = img.depth();
CV_CheckType(type, type == CV_8UC1 || type == CV_8SC1 || type == CV_16SC1 || type == CV_16UC1 || type == CV_32FC1, "Wrong input type for GradientDericheXRows");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientDericheXRows");
}
void Verbose(bool b) { verbose = b; }
virtual void operator()(const Range& range) const CV_OVERRIDE
{
CV_Assert(img.depth()==CV_8UC1 || img.depth()==CV_8SC1 || img.depth()==CV_16SC1 || img.depth()==CV_16UC1);
CV_Assert(dst.depth()==CV_32FC1);
if (verbose)
std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl;
......@@ -377,6 +392,9 @@ public:
case CV_16S:
HorizontalIIRFilter<short>(img, dst, range, alphaDerive);
break;
case CV_32F:
HorizontalIIRFilter<float>(img, dst, range, alphaDerive);
break;
default:
return;
}
......
......@@ -143,12 +143,15 @@ public:
a(aa),
w(ww),
verbose(false)
{}
{
int type = img.depth();
CV_CheckType(type, type == CV_8UC1 || type == CV_8SC1 || type == CV_16SC1 || type == CV_16UC1 || type == CV_32FC1, "Wrong input type for GradientPaillouY");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientPaillouYCols");
}
void Verbose(bool b){verbose=b;}
virtual void operator()(const Range& range) const CV_OVERRIDE
{
CV_Assert(img.depth()==CV_8UC1 || img.depth()==CV_16SC1 || img.depth()==CV_16UC1);
CV_Assert(dst.depth()==CV_32FC1);
if (verbose)
std::cout << getThreadNum()<<"# :Start from row " << range.start << " to " << range.end-1<<" ("<<range.end-range.start<<" loops)" << std::endl;
......@@ -162,9 +165,12 @@ public:
case CV_16S :
VerticalIIRFilter<short>(img, dst, range, a, w);
break;
case CV_16U :
case CV_16U:
VerticalIIRFilter<short>(img, dst, range, a, w);
break;
case CV_32F:
VerticalIIRFilter<float>(img, dst, range, a, w);
break;
default :
return ;
}
......@@ -191,11 +197,15 @@ public:
a(aa),
w(ww),
verbose(false)
{}
{
int type = img.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong input type for GradientPaillouYRows");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientPaillouYRows");
}
void Verbose(bool b){verbose=b;}
virtual void operator()(const Range& range) const CV_OVERRIDE
{
CV_Assert(img.depth()==CV_32FC1);
if (verbose)
std::cout << getThreadNum()<<"# :Start from row " << range.start << " to " << range.end-1<<" ("<<range.end-range.start<<" loops)" << std::endl;
float *iy,*iy0;
......@@ -261,11 +271,15 @@ public:
a(aa),
w(ww),
verbose(false)
{}
{
int type = img.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong input type for GradientPaillouXCols");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientPaillouXCols");
}
void Verbose(bool b){verbose=b;}
virtual void operator()(const Range& range) const CV_OVERRIDE
{
CV_Assert(img.depth()==CV_32FC1);
if (verbose)
std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl;
float *iy, *iy0;
......@@ -331,7 +345,12 @@ public:
a(aa),
w(ww),
verbose(false)
{}
{
int type = img.depth();
CV_CheckType(type, type == CV_8UC1 || type == CV_8SC1 || type == CV_16SC1 || type == CV_16UC1 || type == CV_32FC1, "Wrong input type for GradientPaillouXRows");
type = im1.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientPaillouXRows");
}
void Verbose(bool b){verbose=b;}
virtual void operator()(const Range& range) const CV_OVERRIDE
{
......@@ -349,9 +368,12 @@ public:
case CV_16S :
HorizontalIIRFilter<short>(img, im1, range, a, w);
break;
case CV_16U :
case CV_16U:
HorizontalIIRFilter<ushort>(img, im1, range, a, w);
break;
case CV_32F:
HorizontalIIRFilter<float>(img, im1, range, a, w);
break;
default :
return ;
}
......
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