#pragma once

#include "../../../include/dv-processing/features/feature_detector.hpp"

#include <pybind11/pybind11.h>

namespace py = pybind11;

/**
 * @brief Bind features::KeyPointResampler to python
 * @param m pybind The module to bind to
 */
void bind_keypoint_resampler(py::module &m) {
	py::class_<dv::features::KeyPointResampler>(m, "KeyPointResampler",
		"Create a feature resampler, which resamples given keypoints with homogenous distribution in pixel space.")
		.def(
			py::init<const cv::Size &>(), py::arg("resolution"), "Initialize resampler with an input image resolution.")
		.def("resample", &dv::features::KeyPointResampler::resample<std::vector<dv::TimedKeyPoint>>,
			py::arg("keyPoints"), py::arg("numRetPoints"), "Perform resampling on given keypoints.")
		.def("getTolerance", &dv::features::KeyPointResampler::getTolerance,
			"Get currently set tolerance for output keypoint count.")
		.def("setTolerance", &dv::features::KeyPointResampler::setTolerance, py::arg("tolerance"),
			"Set a new output size tolerance value. The algorithm search for an optimal distance between keypoints so "
			"the resulting vector would contain the expected amount of keypoints. This search is performed with a "
			"given tolerance, by default - 0.1 (so by default the final resampled amount of events will be within "
			"+/-10% of requested amount).");
}
