-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3689 from LiuPeiqiCN:faster_thinning
Faster thinning implementation
- Loading branch information
Showing
2 changed files
with
196 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html. | ||
|
||
#include "perf_precomp.hpp" | ||
|
||
namespace opencv_test { namespace { | ||
|
||
typedef tuple<Size, int> ThinningPerfParam; | ||
typedef TestBaseWithParam<ThinningPerfParam> ThinningPerfTest; | ||
|
||
PERF_TEST_P(ThinningPerfTest, perf, | ||
Combine( | ||
Values(sz1080p, sz720p, szVGA), | ||
Values(THINNING_ZHANGSUEN, THINNING_GUOHALL) | ||
) | ||
) | ||
{ | ||
ThinningPerfParam params = GetParam(); | ||
Size size = get<0>(params); | ||
int type = get<1>(params); | ||
|
||
Mat src = Mat::zeros(size, CV_8UC1); | ||
for (int x = 50; x < src.cols - 50; x += 50) | ||
cv::circle(src, Point(x, x/2), 30 + x/2, Scalar(255), 5); | ||
|
||
Mat dst; | ||
TEST_CYCLE() | ||
{ | ||
thinning(src, dst, type); | ||
} | ||
|
||
SANITY_CHECK_NOTHING(); | ||
} | ||
|
||
}} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters