24#include "testing/testing.h"
30void PreformSinglePointTest(
const DetectOptions&
options) {
42 if (detected_features.size() == 1) {
43 Feature& feature = detected_features[0];
50void PreformCheckerBoardTest(
const DetectOptions &
options) {
53 for (
int y = 0; y < image.Height(); ++
y) {
54 for (
int x = 0; x < image.Width(); ++
x) {
55 image(y, x) = (x / 10 + y / 10) % 2 ? 1.0 : 0.0;
76 for (
int i = 0; i < detected_features.size(); ++i) {
77 Feature &feature = detected_features[i];
78 int rounded_x = ((feature.x + 1) / 10) * 10,
79 rounded_y = ((feature.y + 1) / 10) * 10;
80 EXPECT_LE(1, std::abs(feature.x - rounded_x));
81 EXPECT_LE(1, std::abs(feature.y - rounded_y));
88 EXPECT_EQ(expected_features.size(), detected_features.size());
93 if (expected_features.size() != detected_features.size()) {
97 for (
int i = 0; i < expected_features.size(); ++i) {
98 const Feature& extected_feature = expected_features[i];
100 for (
int j = 0; j < detected_features.size(); ++j) {
101 const Feature& detected_feature = detected_features[j];
102 if (extected_feature.x == detected_feature.x &&
103 extected_feature.y == detected_feature.y) {
112void PreformSingleTriangleTest(
const DetectOptions&
options) {
117 int vertex_x = 10, vertex_y = 5;
118 for (
int i = 0; i < 6; ++i) {
119 int current_x = vertex_x - i, current_y = vertex_y + i;
120 for (
int j = 0; j < i * 2 + 1; ++j, ++current_x) {
121 image(current_y, current_x) = 0.0;
131 expected_features.push_back(Feature(6, 10));
132 expected_features.push_back(Feature(14, 10));
133 expected_features.push_back(Feature(10, 6));
135 CheckExpectedFeatures(detected_features, expected_features);
140#ifndef LIBMV_NO_FAST_DETECTOR
141TEST(Detect, FASTSinglePointTest) {
145 options.fast_min_trackness = 1;
147 PreformSinglePointTest(
options);
153TEST(Detect, FASTCheckerBoardTest) {
157 options.fast_min_trackness = 1;
159 PreformCheckerBoardTest(
options);
165TEST(Detect, FASTSingleTriangleTest) {
170 options.fast_min_trackness = 2;
172 PreformSingleTriangleTest(
options);
183TEST(Detect, MoravecSinglePointTest) {
187 options.moravec_max_count = 10;
189 PreformSinglePointTest(
options);
193TEST(Detect, MoravecCheckerBoardTest) {
197 options.moravec_max_count = 10;
199 PreformCheckerBoardTest(
options);
203TEST(Detect, HarrisSinglePointTest) {
213 PreformSinglePointTest(
options);
216TEST(Detect, HarrisSingleTriangleTest) {
224 PreformSingleTriangleTest(
options);
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
CCL_NAMESPACE_BEGIN struct Options options
void Detect(const FloatImage &image, const DetectOptions &options, vector< Feature > *detected_features)
TEST(PolynomialCameraIntrinsics2, ApplyOnFocalCenter)