3#include "../_cexports/c_dnc_find.h"
4#include "../string.hpp"
5#include "../dense_point_cloud.hpp"
7#include "search_parameters.hpp"
8#include "search_result.hpp"
9#include "teach_parameters.hpp"
17inline HandleGuard<Dnc::Finder>::HandleGuard(
void* handle) noexcept
18 : HandleGuard<Dnc::Finder>(handle, [](
void* handle) { CVB_CALL_CAPI(ReleaseObject(handle)); })
36 Finder(HandleGuard<Finder>&& guard, PrivateTag) noexcept
37 : handle_(std::move(guard))
49 return Internal::DoResCallObjectOut<Finder>([&](
void*& handle)
51 return CVB_CALL_CAPI(CVDNCCreateFromFileTyped(fileName.c_str(), handle));
68 return std::make_unique<Finder>(std::move(guard), PrivateTag{});
80 return handle_.Handle();
100 CVB_CALL_CAPI_CHECKED(CVDNCSetSearchParams(
Handle(), *
reinterpret_cast<const CExports::CVDNCSearchParams*
>(¶meters)));
102 CExports::CVDNCRESULTS resultsHandle =
nullptr;
103 CVB_CALL_CAPI_CHECKED(CVDNCFind(
Handle(), pointCloud.
Handle(), resultsHandle));
104 ReleaseObjectGuard guard(resultsHandle);
106 auto numResults = CExports::CVDNCGetNumResults(resultsHandle);
109 for (
auto& result : results)
111 int index =
static_cast<int>(std::distance(&results.front(), &result));
112 CVB_CALL_CAPI_CHECKED(CVDNCGetResult(resultsHandle, index, *
reinterpret_cast<CExports::CVDNCResult*
>(&result)));
125 CVB_CALL_CAPI_CHECKED(CVDNCSaveClassifierTyped(
Handle(), fileName.c_str()));
140 double resolution = 0.0;
143 Internal::DoResCall([
this, &teachParams , &resolution, &fringe]() {
145 return CVB_CALL_CAPI(CVDNCGetTeachParams(
149 *
reinterpret_cast<CExports::CVDNCTeachParams*
>(&teachParams)));
151 return std::make_tuple(teachParams, resolution, fringe);
156 HandleGuard<Finder> handle_;
A dense Cartesian 3D point cloud object.
Definition: decl_dense_point_cloud.hpp:31
Match3D DNC finder used to perform a search on a point cloud.
Definition: finder.hpp:29
std::vector< SearchResult > Find(const DensePointCloud &pointCloud, const SearchParameters ¶meters)
Search for objects on the given point cloud.
Definition: finder.hpp:98
void Save(const String &fileName)
Saves the finder to the given file name.
Definition: finder.hpp:123
std::tuple< TeachParameters, double, double > GetTeachParameters()
Gets the TeachParameters with which this Finder was trained.
Definition: finder.hpp:138
static std::unique_ptr< Finder > FromHandle(HandleGuard< Finder > &&guard)
Creates a finder from a classic API handle.
Definition: finder.hpp:63
void * Handle() const noexcept
Classic API node handle.
Definition: finder.hpp:78
static std::unique_ptr< Finder > Load(const String &fileName)
Loads a finder from the given file name.
Definition: finder.hpp:47
Definition of search parameters.
Definition: search_parameters.hpp:23
Parameters for teaching a Match3D DNC finder.
Definition: teach_parameters.hpp:18
void * Handle() const noexcept
Returns C-API style handle to Node Object.
Definition: decl_point_cloud.hpp:768
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24