Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/imgproc/perf/perf_houghcircles.cpp
16354 views
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.
4
#include "perf_precomp.hpp"
5
#include "opencv2/imgproc/types_c.h"
6
7
namespace opencv_test {
8
9
PERF_TEST(PerfHoughCircles, Basic)
10
{
11
string filename = getDataPath("cv/imgproc/stuff.jpg");
12
const double dp = 1.0;
13
double minDist = 20;
14
double edgeThreshold = 20;
15
double accumThreshold = 30;
16
int minRadius = 20;
17
int maxRadius = 200;
18
19
Mat img = imread(filename, IMREAD_GRAYSCALE);
20
ASSERT_FALSE(img.empty()) << "Unable to load source image " << filename;
21
22
GaussianBlur(img, img, Size(9, 9), 2, 2);
23
24
vector<Vec3f> circles;
25
declare.in(img);
26
27
TEST_CYCLE()
28
{
29
HoughCircles(img, circles, CV_HOUGH_GRADIENT, dp, minDist, edgeThreshold, accumThreshold, minRadius, maxRadius);
30
}
31
32
SANITY_CHECK_NOTHING();
33
}
34
35
PERF_TEST(PerfHoughCircles2, ManySmallCircles)
36
{
37
string filename = getDataPath("cv/imgproc/beads.jpg");
38
const double dp = 1.0;
39
double minDist = 10;
40
double edgeThreshold = 90;
41
double accumThreshold = 11;
42
int minRadius = 7;
43
int maxRadius = 18;
44
45
Mat img = imread(filename, IMREAD_GRAYSCALE);
46
ASSERT_FALSE(img.empty()) << "Unable to load source image " << filename;
47
48
vector<Vec3f> circles;
49
declare.in(img);
50
51
TEST_CYCLE()
52
{
53
HoughCircles(img, circles, CV_HOUGH_GRADIENT, dp, minDist, edgeThreshold, accumThreshold, minRadius, maxRadius);
54
}
55
56
SANITY_CHECK_NOTHING();
57
}
58
59
PERF_TEST(PerfHoughCircles4f, Basic)
60
{
61
string filename = getDataPath("cv/imgproc/stuff.jpg");
62
const double dp = 1.0;
63
double minDist = 20;
64
double edgeThreshold = 20;
65
double accumThreshold = 30;
66
int minRadius = 20;
67
int maxRadius = 200;
68
69
Mat img = imread(filename, IMREAD_GRAYSCALE);
70
ASSERT_FALSE(img.empty()) << "Unable to load source image " << filename;
71
72
GaussianBlur(img, img, Size(9, 9), 2, 2);
73
74
vector<Vec4f> circles;
75
declare.in(img);
76
77
TEST_CYCLE()
78
{
79
HoughCircles(img, circles, CV_HOUGH_GRADIENT, dp, minDist, edgeThreshold, accumThreshold, minRadius, maxRadius);
80
}
81
82
SANITY_CHECK_NOTHING();
83
}
84
85
} // namespace
86
87