Path: blob/master/modules/imgproc/perf/perf_houghcircles.cpp
16354 views
// This file is part of OpenCV project.1// It is subject to the license terms in the LICENSE file found in the top-level directory2// of this distribution and at http://opencv.org/license.html.3#include "perf_precomp.hpp"4#include "opencv2/imgproc/types_c.h"56namespace opencv_test {78PERF_TEST(PerfHoughCircles, Basic)9{10string filename = getDataPath("cv/imgproc/stuff.jpg");11const double dp = 1.0;12double minDist = 20;13double edgeThreshold = 20;14double accumThreshold = 30;15int minRadius = 20;16int maxRadius = 200;1718Mat img = imread(filename, IMREAD_GRAYSCALE);19ASSERT_FALSE(img.empty()) << "Unable to load source image " << filename;2021GaussianBlur(img, img, Size(9, 9), 2, 2);2223vector<Vec3f> circles;24declare.in(img);2526TEST_CYCLE()27{28HoughCircles(img, circles, CV_HOUGH_GRADIENT, dp, minDist, edgeThreshold, accumThreshold, minRadius, maxRadius);29}3031SANITY_CHECK_NOTHING();32}3334PERF_TEST(PerfHoughCircles2, ManySmallCircles)35{36string filename = getDataPath("cv/imgproc/beads.jpg");37const double dp = 1.0;38double minDist = 10;39double edgeThreshold = 90;40double accumThreshold = 11;41int minRadius = 7;42int maxRadius = 18;4344Mat img = imread(filename, IMREAD_GRAYSCALE);45ASSERT_FALSE(img.empty()) << "Unable to load source image " << filename;4647vector<Vec3f> circles;48declare.in(img);4950TEST_CYCLE()51{52HoughCircles(img, circles, CV_HOUGH_GRADIENT, dp, minDist, edgeThreshold, accumThreshold, minRadius, maxRadius);53}5455SANITY_CHECK_NOTHING();56}5758PERF_TEST(PerfHoughCircles4f, Basic)59{60string filename = getDataPath("cv/imgproc/stuff.jpg");61const double dp = 1.0;62double minDist = 20;63double edgeThreshold = 20;64double accumThreshold = 30;65int minRadius = 20;66int maxRadius = 200;6768Mat img = imread(filename, IMREAD_GRAYSCALE);69ASSERT_FALSE(img.empty()) << "Unable to load source image " << filename;7071GaussianBlur(img, img, Size(9, 9), 2, 2);7273vector<Vec4f> circles;74declare.in(img);7576TEST_CYCLE()77{78HoughCircles(img, circles, CV_HOUGH_GRADIENT, dp, minDist, edgeThreshold, accumThreshold, minRadius, maxRadius);79}8081SANITY_CHECK_NOTHING();82}8384} // namespace858687