1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

ts: refactor OpenCV tests

- removed tr1 usage (dropped in C++17)
- moved includes of vector/map/iostream/limits into ts.hpp
- require opencv_test + anonymous namespace (added compile check)
- fixed norm() usage (must be from cvtest::norm for checks) and other conflict functions
- added missing license headers
This commit is contained in:
Alexander Alekhin
2017-11-05 13:48:40 +00:00
parent f1e50ecab3
commit 4a297a2443
435 changed files with 2009 additions and 2378 deletions
+7 -9
View File
@@ -46,12 +46,8 @@
*/
#include "test_precomp.hpp"
#include <limits>
#include <cstdio>
#include <map>
using namespace std;
using namespace cv;
namespace opencv_test { namespace {
const float EVAL_BAD_THRESH = 1.f;
const int EVAL_TEXTURELESS_WIDTH = 3;
@@ -238,10 +234,10 @@ void computeDepthDiscontMask( const Mat& disp, Mat& depthDiscontMask, const Mat&
Mat curDisp; disp.copyTo( curDisp );
if( !unknDispMask.empty() )
curDisp.setTo( Scalar(numeric_limits<float>::min()), unknDispMask );
curDisp.setTo( Scalar(std::numeric_limits<float>::min()), unknDispMask );
Mat maxNeighbDisp; dilate( curDisp, maxNeighbDisp, Mat(3, 3, CV_8UC1, Scalar(1)) );
if( !unknDispMask.empty() )
curDisp.setTo( Scalar(numeric_limits<float>::max()), unknDispMask );
curDisp.setTo( Scalar(std::numeric_limits<float>::max()), unknDispMask );
Mat minNeighbDisp; erode( curDisp, minNeighbDisp, Mat(3, 3, CV_8UC1, Scalar(1)) );
depthDiscontMask = max( (Mat)(maxNeighbDisp-disp), (Mat)(disp-minNeighbDisp) ) > dispGap;
if( !unknDispMask.empty() )
@@ -566,12 +562,12 @@ int CV_StereoMatchingTest::processStereoMatchingResults( FileStorage& fs, int ca
Mat leftUnknMask, rightUnknMask;
DatasetParams params = datasetsParams[caseDatasets[caseIdx]];
absdiff( trueLeftDisp, Scalar(params.dispUnknVal), leftUnknMask );
leftUnknMask = leftUnknMask < numeric_limits<float>::epsilon();
leftUnknMask = leftUnknMask < std::numeric_limits<float>::epsilon();
assert(leftUnknMask.type() == CV_8UC1);
if( !trueRightDisp.empty() )
{
absdiff( trueRightDisp, Scalar(params.dispUnknVal), rightUnknMask );
rightUnknMask = rightUnknMask < numeric_limits<float>::epsilon();
rightUnknMask = rightUnknMask < std::numeric_limits<float>::epsilon();
assert(rightUnknMask.type() == CV_8UC1);
}
@@ -892,3 +888,5 @@ TEST(Calib3d_StereoSGBM_HH4, regression)
absdiff(toCheck, testData,diff);
CV_Assert( countNonZero(diff)==0);
}
}} // namespace