1
// This file is part of OpenCV project.
2
// It is subject to the license terms in the LICENSE file found in the top-level directory
3
// of this distribution and at http://opencv.org/license.html.
5
// Copyright (C) 2014, Itseez, Inc., all rights reserved.
6
// Third party copyrights are property of their respective owners.
8
#include "perf_precomp.hpp"
13
using namespace testing;
14
using std::tr1::make_tuple;
17
typedef std::tr1::tuple<string, Point, int, int, int, int> Size_Source_Fl_t;
18
typedef perf::TestBaseWithParam<Size_Source_Fl_t> Size_Source_Fl;
20
PERF_TEST_P(Size_Source_Fl, floodFill1, Combine(
21
testing::Values("cv/shared/fruits.png", "cv/optflow/RubberWhale1.png"), //images
22
testing::Values(Point(120, 82), Point(200, 140)), //seed points
23
testing::Values(4,8), //connectivity
24
testing::Values((int)IMREAD_COLOR, (int)IMREAD_GRAYSCALE), //color image, or not
25
testing::Values(0, 1, 2), //use fixed(1), gradient (2) or simple(0) mode
26
testing::Values((int)CV_8U, (int)CV_32F, (int)CV_32S) //image depth
30
string filename = getDataPath(get<0>(GetParam()));
32
pseed = get<1>(GetParam());
34
int connectivity = get<2>(GetParam());
35
int colorType = get<3>(GetParam());
36
int modeType = get<4>(GetParam());
37
int imdepth = get<5>(GetParam());
39
Mat image0 = imread(filename, colorType);
41
Scalar newval, loVal, upVal;
44
loVal = Scalar(0, 0, 0);
45
upVal = Scalar(0, 0, 0);
49
loVal = Scalar(4, 4, 4);
50
upVal = Scalar(20, 20, 20);
52
int newMaskVal = 255; //base mask for floodfill type
53
int flags = connectivity + (newMaskVal << 8) + (modeType == 1 ? FLOODFILL_FIXED_RANGE : 0);
55
int b = 152;//(unsigned)theRNG() & 255;
56
int g = 136;//(unsigned)theRNG() & 255;
57
int r = 53;//(unsigned)theRNG() & 255;
58
newval = (colorType == IMREAD_COLOR) ? Scalar(b, g, r) : Scalar(r*0.299 + g*0.587 + b*0.114);
60
Rect outputRect = Rect();
65
image0.convertTo(source, imdepth);
67
cv::floodFill(source, pseed, newval, &outputRect, loVal, upVal, flags);
70
EXPECT_EQ(image0.cols, source.cols);
71
EXPECT_EQ(image0.rows, source.rows);
72
SANITY_CHECK_NOTHING();