CVB++ 15.1
Loading...
Searching...
No Matches
analysis.hpp
1#pragma once
2
3#if defined _WIN32
4
5# include "../_cexports/c_foundation.h"
6
7# include "../global.hpp"
8# include "../image.hpp"
9# include "../exception.hpp"
10# include "filter.hpp"
11
12# include <memory>
13
14namespace Cvb
15{
16 CVB_BEGIN_INLINE_NS
17
18 namespace Foundation
19 {
20
22
26 namespace Analysis
27 {
28
31
46 inline void LocalEigenValuesAndVectors(const ImagePlane &plane, Filter::FixedFilterSize derivatorSize,
48 std::unique_ptr<Image> &lambda2, std::unique_ptr<Image> &eigenValue1x,
49 std::unique_ptr<Image> &eigenValue1y, std::unique_ptr<Image> &eigenValue2x,
50 std::unique_ptr<Image> &eigenValue2y)
51 {
52 CExports::IMG hl1 = nullptr;
53 CExports::IMG hl2 = nullptr;
54 CExports::IMG hev1x = nullptr;
55 CExports::IMG hev1y = nullptr;
56 CExports::IMG hev2x = nullptr;
57 CExports::IMG hev2y = nullptr;
58 CVB_CALL_CAPI_CHECKED(LocalEigenValuesAndVectors(
59 plane.Parent().Handle(), plane.Plane(), static_cast<CExports::TFilterMask>(derivatorSize),
60 static_cast<CExports::TFilterMask>(blurSize), hl1, hl2, hev1x, hev1y, hev2x, hev2y));
61
62 HandleGuard<Image> gl1(hl1);
63 HandleGuard<Image> gl2(hl2);
64 HandleGuard<Image> gev1x(hev1x);
65 HandleGuard<Image> gev1y(hev1y);
66 HandleGuard<Image> gev2x(hev2x);
67 HandleGuard<Image> gev2y(hev2y);
68
69 auto l1 = Image::FromHandle(std::move(gl1));
70 auto l2 = Image::FromHandle(std::move(gl2));
71 auto ev1x = Image::FromHandle(std::move(gev1x));
72 auto ev1y = Image::FromHandle(std::move(gev1y));
73 auto ev2x = Image::FromHandle(std::move(gev2x));
74 auto ev2y = Image::FromHandle(std::move(gev2y));
75
76 lambda1 = std::move(l1);
77 lambda2 = std::move(l2);
78 eigenValue1x = std::move(ev1x);
79 eigenValue1y = std::move(ev1y);
80 eigenValue2x = std::move(ev2x);
81 eigenValue2y = std::move(ev2y);
82 }
83
85
99 {
100 return Internal::DoResCallObjectOut<Image>([&](void *&resimg) {
101 return CVB_CALL_CAPI(LocalMinEigenValues(plane.Parent().Handle(), plane.Plane(),
102 static_cast<CExports::TFilterMask>(derivatorSize),
103 static_cast<CExports::TFilterMask>(blurSize), resimg));
104 });
105 }
106
108
118 inline double WangQuality(const ImagePlane &plane1, const ImagePlane &plane2)
119 {
120 double quality = 0;
121 CVB_CALL_CAPI_CHECKED(WangImageQuality(plane1.Parent().Handle(), plane1.Plane(), plane2.Parent().Handle(),
122 plane2.Plane(), quality));
123 return quality;
124 }
125
126 } /* namespace Analysis */
127
131
132 } /* namespace Foundation */
133 CVB_END_INLINE_NS
134} /* namespace Cvb */
135
136#endif
static std::unique_ptr< Image > FromHandle(HandleGuard< Image > &&guard)
Creates an image from a classic API handle.
Definition decl_image.hpp:160
void * Handle() const noexcept
Classic API image handle.
Definition decl_image.hpp:237
Image plane information container.
Definition decl_image_plane.hpp:31
int Plane() const noexcept
Plane index in the image, to which this plane refers to.
Definition decl_image_plane.hpp:149
const Image & Parent() const noexcept
Image to which this plane descriptor refers to.
Definition detail_image_plane.hpp:87
cvbres_t WangImageQuality(IMG ImgIn1, long Index1, IMG ImgIn2, long Index2, double &Value)
T move(T... args)
Namespace for collection of miscellaneous image analysis functions.
Definition analysis.hpp:27
std::unique_ptr< Image > LocalMinEigenValues(const ImagePlane &plane, Filter::FixedFilterSize derivatorSize, Filter::FixedFilterSize blurSize)
Calculate the minimum local eigenvalues of the Hesse matrix applied to the pixels of the input image.
Definition analysis.hpp:97
double WangQuality(const ImagePlane &plane1, const ImagePlane &plane2)
Calculate the Wang quality for two images.
Definition analysis.hpp:118
void LocalEigenValuesAndVectors(const ImagePlane &plane, Filter::FixedFilterSize derivatorSize, Filter::FixedFilterSize blurSize, std::unique_ptr< Image > &lambda1, std::unique_ptr< Image > &lambda2, std::unique_ptr< Image > &eigenValue1x, std::unique_ptr< Image > &eigenValue1y, std::unique_ptr< Image > &eigenValue2x, std::unique_ptr< Image > &eigenValue2y)
Calculate the local eigenvalues and eigenvectors of the Hesse matrix applied to the pixels of the inp...
Definition analysis.hpp:46
FixedFilterSize
Filter size values for filters using a fixed or discrete sized kernel.
Definition filter.hpp:43
Namespace for the Foundation package.
Definition decl_metric_aqs12_calibration_piece.hpp:11
Root namespace for the Image Manager interface.
Definition version.hpp:11