Path: blob/master/modules/imgproc/perf/perf_corners.cpp
16339 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"45namespace opencv_test {67CV_ENUM(BorderType, BORDER_REPLICATE, BORDER_CONSTANT, BORDER_REFLECT, BORDER_REFLECT_101)89typedef tuple<string, int, int, double, BorderType> Img_BlockSize_ApertureSize_k_BorderType_t;10typedef perf::TestBaseWithParam<Img_BlockSize_ApertureSize_k_BorderType_t> Img_BlockSize_ApertureSize_k_BorderType;1112PERF_TEST_P(Img_BlockSize_ApertureSize_k_BorderType, cornerHarris,13testing::Combine(14testing::Values( "stitching/a1.png", "cv/shared/pic5.png"),15testing::Values( 3, 5 ),16testing::Values( 3, 5 ),17testing::Values( 0.04, 0.1 ),18BorderType::all()19)20)21{22string filename = getDataPath(get<0>(GetParam()));23int blockSize = get<1>(GetParam());24int apertureSize = get<2>(GetParam());25double k = get<3>(GetParam());26BorderType borderType = get<4>(GetParam());2728Mat src = imread(filename, IMREAD_GRAYSCALE);29ASSERT_FALSE(src.empty()) << "Unable to load source image: " << filename;3031Mat dst;3233TEST_CYCLE() cornerHarris(src, dst, blockSize, apertureSize, k, borderType);3435SANITY_CHECK(dst, 2e-5, ERROR_RELATIVE);36}3738typedef tuple<string, int, int, BorderType> Img_BlockSize_ApertureSize_BorderType_t;39typedef perf::TestBaseWithParam<Img_BlockSize_ApertureSize_BorderType_t> Img_BlockSize_ApertureSize_BorderType;4041PERF_TEST_P(Img_BlockSize_ApertureSize_BorderType, cornerEigenValsAndVecs,42testing::Combine(43testing::Values( "stitching/a1.png", "cv/shared/pic5.png"),44testing::Values( 3, 5 ),45testing::Values( 3, 5 ),46BorderType::all()47)48)49{50string filename = getDataPath(get<0>(GetParam()));51int blockSize = get<1>(GetParam());52int apertureSize = get<2>(GetParam());53BorderType borderType = get<3>(GetParam());5455Mat src = imread(filename, IMREAD_GRAYSCALE);56ASSERT_FALSE(src.empty()) << "Unable to load source image: " << filename;5758Mat dst;5960TEST_CYCLE() cornerEigenValsAndVecs(src, dst, blockSize, apertureSize, borderType);6162Mat l1;63extractChannel(dst, l1, 0);6465SANITY_CHECK(l1, 2e-5, ERROR_RELATIVE);66}6768PERF_TEST_P(Img_BlockSize_ApertureSize_BorderType, cornerMinEigenVal,69testing::Combine(70testing::Values( "stitching/a1.png", "cv/shared/pic5.png"),71testing::Values( 3, 5 ),72testing::Values( 3, 5 ),73BorderType::all()74)75)76{77string filename = getDataPath(get<0>(GetParam()));78int blockSize = get<1>(GetParam());79int apertureSize = get<2>(GetParam());80BorderType borderType = get<3>(GetParam());8182Mat src = imread(filename, IMREAD_GRAYSCALE);83ASSERT_FALSE(src.empty()) << "Unable to load source image: " << filename;8485Mat dst;8687TEST_CYCLE() cornerMinEigenVal(src, dst, blockSize, apertureSize, borderType);8889SANITY_CHECK(dst, 2e-5, ERROR_RELATIVE);90}9192} // namespace939495