CVB++ 15.0
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, hl2, hev1x, hev1y, hev2x, hev2y;
53 CVB_CALL_CAPI_CHECKED(LocalEigenValuesAndVectors(
54 plane.Parent().Handle(), plane.Plane(), static_cast<CExports::TFilterMask>(derivatorSize),
55 static_cast<CExports::TFilterMask>(blurSize), hl1, hl2, hev1x, hev1y, hev2x, hev2y));
56
57 HandleGuard<Image> gl1(hl1);
58 HandleGuard<Image> gl2(hl2);
59 HandleGuard<Image> gev1x(hev1x);
60 HandleGuard<Image> gev1y(hev1y);
61 HandleGuard<Image> gev2x(hev2x);
62 HandleGuard<Image> gev2y(hev2y);
63
64 auto l1 = Image::FromHandle(std::move(gl1));
65 auto l2 = Image::FromHandle(std::move(gl2));
66 auto ev1x = Image::FromHandle(std::move(gev1x));
67 auto ev1y = Image::FromHandle(std::move(gev1y));
68 auto ev2x = Image::FromHandle(std::move(gev2x));
69 auto ev2y = Image::FromHandle(std::move(gev2y));
70
71 lambda1 = std::move(l1);
72 lambda2 = std::move(l2);
73 eigenValue1x = std::move(ev1x);
74 eigenValue1y = std::move(ev1y);
75 eigenValue2x = std::move(ev2x);
76 eigenValue2y = std::move(ev2y);
77 }
78
80
94 {
95 return Internal::DoResCallObjectOut<Image>([&](void *&resimg) {
96 return CVB_CALL_CAPI(LocalMinEigenValues(plane.Parent().Handle(), plane.Plane(),
97 static_cast<CExports::TFilterMask>(derivatorSize),
98 static_cast<CExports::TFilterMask>(blurSize), resimg));
99 });
100 }
101
103
113 inline double WangQuality(const ImagePlane &plane1, const ImagePlane &plane2)
114 {
115 double quality;
116 CVB_CALL_CAPI_CHECKED(WangImageQuality(plane1.Parent().Handle(), plane1.Plane(), plane2.Parent().Handle(),
117 plane2.Plane(), quality));
118 return quality;
119 }
120
121 } /* namespace Analysis */
122
126
127 } /* namespace Foundation */
128 CVB_END_INLINE_NS
129} /* namespace Cvb */
130
131#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:29
int Plane() const noexcept
Plane index in the image, to which this plane refers to.
Definition decl_image_plane.hpp:147
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:92
double WangQuality(const ImagePlane &plane1, const ImagePlane &plane2)
Calculate the Wang quality for two images.
Definition analysis.hpp:113
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 c_bayer_to_rgb.h:17