node-native-win-utils 1.1.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +144 -27
- package/binding.gyp +18 -5
- package/dist/index.d.ts +146 -4
- package/dist/index.js +107 -3
- package/include/opencv2/core/affine.hpp +678 -0
- package/include/opencv2/core/async.hpp +105 -0
- package/include/opencv2/core/base.hpp +664 -0
- package/include/opencv2/core/bindings_utils.hpp +325 -0
- package/include/opencv2/core/bufferpool.hpp +40 -0
- package/include/opencv2/core/check.hpp +170 -0
- package/include/opencv2/core/core.hpp +48 -0
- package/include/opencv2/core/core_c.h +3128 -0
- package/include/opencv2/core/cuda/block.hpp +211 -0
- package/include/opencv2/core/cuda/border_interpolate.hpp +722 -0
- package/include/opencv2/core/cuda/color.hpp +309 -0
- package/include/opencv2/core/cuda/common.hpp +131 -0
- package/include/opencv2/core/cuda/datamov_utils.hpp +113 -0
- package/include/opencv2/core/cuda/detail/color_detail.hpp +2018 -0
- package/include/opencv2/core/cuda/detail/reduce.hpp +365 -0
- package/include/opencv2/core/cuda/detail/reduce_key_val.hpp +502 -0
- package/include/opencv2/core/cuda/detail/transform_detail.hpp +392 -0
- package/include/opencv2/core/cuda/detail/type_traits_detail.hpp +191 -0
- package/include/opencv2/core/cuda/detail/vec_distance_detail.hpp +121 -0
- package/include/opencv2/core/cuda/dynamic_smem.hpp +88 -0
- package/include/opencv2/core/cuda/emulation.hpp +269 -0
- package/include/opencv2/core/cuda/filters.hpp +293 -0
- package/include/opencv2/core/cuda/funcattrib.hpp +79 -0
- package/include/opencv2/core/cuda/functional.hpp +805 -0
- package/include/opencv2/core/cuda/limits.hpp +128 -0
- package/include/opencv2/core/cuda/reduce.hpp +209 -0
- package/include/opencv2/core/cuda/saturate_cast.hpp +292 -0
- package/include/opencv2/core/cuda/scan.hpp +258 -0
- package/include/opencv2/core/cuda/simd_functions.hpp +869 -0
- package/include/opencv2/core/cuda/transform.hpp +75 -0
- package/include/opencv2/core/cuda/type_traits.hpp +90 -0
- package/include/opencv2/core/cuda/utility.hpp +230 -0
- package/include/opencv2/core/cuda/vec_distance.hpp +232 -0
- package/include/opencv2/core/cuda/vec_math.hpp +923 -0
- package/include/opencv2/core/cuda/vec_traits.hpp +288 -0
- package/include/opencv2/core/cuda/warp.hpp +139 -0
- package/include/opencv2/core/cuda/warp_reduce.hpp +76 -0
- package/include/opencv2/core/cuda/warp_shuffle.hpp +162 -0
- package/include/opencv2/core/cuda.hpp +1279 -0
- package/include/opencv2/core/cuda.inl.hpp +763 -0
- package/include/opencv2/core/cuda_stream_accessor.hpp +86 -0
- package/include/opencv2/core/cuda_types.hpp +144 -0
- package/include/opencv2/core/cv_cpu_dispatch.h +381 -0
- package/include/opencv2/core/cv_cpu_helper.h +550 -0
- package/include/opencv2/core/cvdef.h +973 -0
- package/include/opencv2/core/cvstd.hpp +190 -0
- package/include/opencv2/core/cvstd.inl.hpp +197 -0
- package/include/opencv2/core/cvstd_wrapper.hpp +154 -0
- package/include/opencv2/core/detail/async_promise.hpp +71 -0
- package/include/opencv2/core/detail/dispatch_helper.impl.hpp +49 -0
- package/include/opencv2/core/detail/exception_ptr.hpp +27 -0
- package/include/opencv2/core/directx.hpp +184 -0
- package/include/opencv2/core/dualquaternion.hpp +979 -0
- package/include/opencv2/core/dualquaternion.inl.hpp +487 -0
- package/include/opencv2/core/eigen.hpp +402 -0
- package/include/opencv2/core/fast_math.hpp +433 -0
- package/include/opencv2/core/hal/hal.hpp +256 -0
- package/include/opencv2/core/hal/interface.h +190 -0
- package/include/opencv2/core/hal/intrin.hpp +939 -0
- package/include/opencv2/core/hal/intrin_avx.hpp +3177 -0
- package/include/opencv2/core/hal/intrin_avx512.hpp +3090 -0
- package/include/opencv2/core/hal/intrin_cpp.hpp +3321 -0
- package/include/opencv2/core/hal/intrin_forward.hpp +191 -0
- package/include/opencv2/core/hal/intrin_lasx.hpp +3236 -0
- package/include/opencv2/core/hal/intrin_msa.hpp +1887 -0
- package/include/opencv2/core/hal/intrin_neon.hpp +2610 -0
- package/include/opencv2/core/hal/intrin_rvv.hpp +3320 -0
- package/include/opencv2/core/hal/intrin_rvv071.hpp +2545 -0
- package/include/opencv2/core/hal/intrin_rvv_scalable.hpp +2080 -0
- package/include/opencv2/core/hal/intrin_sse.hpp +3467 -0
- package/include/opencv2/core/hal/intrin_sse_em.hpp +180 -0
- package/include/opencv2/core/hal/intrin_vsx.hpp +1608 -0
- package/include/opencv2/core/hal/intrin_wasm.hpp +2782 -0
- package/include/opencv2/core/hal/msa_macros.h +1558 -0
- package/include/opencv2/core/hal/simd_utils.impl.hpp +186 -0
- package/include/opencv2/core/llapi/llapi.h +102 -0
- package/include/opencv2/core/mat.hpp +3775 -0
- package/include/opencv2/core/mat.inl.hpp +3422 -0
- package/include/opencv2/core/matx.hpp +1536 -0
- package/include/opencv2/core/neon_utils.hpp +128 -0
- package/include/opencv2/core/ocl.hpp +917 -0
- package/include/opencv2/core/ocl_genbase.hpp +69 -0
- package/include/opencv2/core/opencl/ocl_defs.hpp +82 -0
- package/include/opencv2/core/opencl/opencl_info.hpp +212 -0
- package/include/opencv2/core/opencl/opencl_svm.hpp +81 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clblas.hpp +602 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clfft.hpp +146 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp +371 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp +272 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp +62 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp +42 -0
- package/include/opencv2/core/opencl/runtime/opencl_clblas.hpp +53 -0
- package/include/opencv2/core/opencl/runtime/opencl_clfft.hpp +53 -0
- package/include/opencv2/core/opencl/runtime/opencl_core.hpp +84 -0
- package/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp +47 -0
- package/include/opencv2/core/opencl/runtime/opencl_gl.hpp +53 -0
- package/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp +47 -0
- package/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp +48 -0
- package/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp +42 -0
- package/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp +166 -0
- package/include/opencv2/core/opengl.hpp +733 -0
- package/include/opencv2/core/openvx/ovx_defs.hpp +48 -0
- package/include/opencv2/core/operations.hpp +610 -0
- package/include/opencv2/core/optim.hpp +302 -0
- package/include/opencv2/core/ovx.hpp +28 -0
- package/include/opencv2/core/parallel/backend/parallel_for.openmp.hpp +72 -0
- package/include/opencv2/core/parallel/backend/parallel_for.tbb.hpp +153 -0
- package/include/opencv2/core/parallel/parallel_backend.hpp +90 -0
- package/include/opencv2/core/persistence.hpp +1350 -0
- package/include/opencv2/core/private/cv_cpu_include_simd_declarations.hpp +30 -0
- package/include/opencv2/core/private.cuda.hpp +169 -0
- package/include/opencv2/core/private.hpp +896 -0
- package/include/opencv2/core/quaternion.hpp +1696 -0
- package/include/opencv2/core/quaternion.inl.hpp +1063 -0
- package/include/opencv2/core/saturate.hpp +180 -0
- package/include/opencv2/core/simd_intrinsics.hpp +87 -0
- package/include/opencv2/core/softfloat.hpp +514 -0
- package/include/opencv2/core/sse_utils.hpp +652 -0
- package/include/opencv2/core/traits.hpp +417 -0
- package/include/opencv2/core/types.hpp +2457 -0
- package/include/opencv2/core/types_c.h +2126 -0
- package/include/opencv2/core/utility.hpp +1229 -0
- package/include/opencv2/core/utils/allocator_stats.hpp +29 -0
- package/include/opencv2/core/utils/allocator_stats.impl.hpp +158 -0
- package/include/opencv2/core/utils/buffer_area.private.hpp +136 -0
- package/include/opencv2/core/utils/configuration.private.hpp +22 -0
- package/include/opencv2/core/utils/filesystem.hpp +82 -0
- package/include/opencv2/core/utils/filesystem.private.hpp +66 -0
- package/include/opencv2/core/utils/fp_control.private.hpp +29 -0
- package/include/opencv2/core/utils/fp_control_utils.hpp +69 -0
- package/include/opencv2/core/utils/instrumentation.hpp +125 -0
- package/include/opencv2/core/utils/lock.private.hpp +119 -0
- package/include/opencv2/core/utils/logger.defines.hpp +42 -0
- package/include/opencv2/core/utils/logger.hpp +218 -0
- package/include/opencv2/core/utils/logtag.hpp +28 -0
- package/include/opencv2/core/utils/plugin_loader.private.hpp +165 -0
- package/include/opencv2/core/utils/tls.hpp +235 -0
- package/include/opencv2/core/utils/trace.hpp +252 -0
- package/include/opencv2/core/utils/trace.private.hpp +421 -0
- package/include/opencv2/core/va_intel.hpp +75 -0
- package/include/opencv2/core/version.hpp +26 -0
- package/include/opencv2/core/vsx_utils.hpp +1047 -0
- package/include/opencv2/core.hpp +3365 -0
- package/include/opencv2/imgcodecs/imgcodecs.hpp +48 -0
- package/include/opencv2/imgcodecs/imgcodecs_c.h +1 -0
- package/include/opencv2/imgcodecs/ios.h +59 -0
- package/include/opencv2/imgcodecs/legacy/constants_c.h +54 -0
- package/include/opencv2/imgcodecs/macosx.h +20 -0
- package/include/opencv2/imgcodecs.hpp +407 -0
- package/include/opencv2/imgproc/bindings.hpp +34 -0
- package/include/opencv2/imgproc/detail/gcgraph.hpp +395 -0
- package/include/opencv2/imgproc/hal/hal.hpp +246 -0
- package/include/opencv2/imgproc/hal/interface.h +46 -0
- package/include/opencv2/imgproc/imgproc.hpp +48 -0
- package/include/opencv2/imgproc/imgproc_c.h +1177 -0
- package/include/opencv2/imgproc/segmentation.hpp +141 -0
- package/include/opencv2/imgproc/types_c.h +659 -0
- package/include/opencv2/imgproc.hpp +5035 -0
- package/include/opencv2/opencv_modules.hpp +17 -0
- package/libs/libjpeg-turbo.lib +0 -0
- package/libs/libpng.lib +0 -0
- package/libs/opencv_core470.lib +0 -0
- package/libs/opencv_imgcodecs470.lib +0 -0
- package/libs/opencv_imgproc470.lib +0 -0
- package/libs/zlib.lib +0 -0
- package/package.json +8 -2
- package/prebuilds/win32-x64/node.napi.node +0 -0
- package/src/cpp/capturewindow.cpp +36 -46
- package/src/cpp/main.cpp +10 -2
- package/src/cpp/opencv.cpp +425 -0
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
/*M///////////////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
//
|
|
3
|
+
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
|
4
|
+
//
|
|
5
|
+
// By downloading, copying, installing or using the software you agree to this license.
|
|
6
|
+
// If you do not agree to this license, do not download, install,
|
|
7
|
+
// copy or use the software.
|
|
8
|
+
//
|
|
9
|
+
//
|
|
10
|
+
// License Agreement
|
|
11
|
+
// For Open Source Computer Vision Library
|
|
12
|
+
//
|
|
13
|
+
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
|
14
|
+
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
|
15
|
+
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
|
16
|
+
// Third party copyrights are property of their respective owners.
|
|
17
|
+
//
|
|
18
|
+
// Redistribution and use in source and binary forms, with or without modification,
|
|
19
|
+
// are permitted provided that the following conditions are met:
|
|
20
|
+
//
|
|
21
|
+
// * Redistribution's of source code must retain the above copyright notice,
|
|
22
|
+
// this list of conditions and the following disclaimer.
|
|
23
|
+
//
|
|
24
|
+
// * Redistribution's in binary form must reproduce the above copyright notice,
|
|
25
|
+
// this list of conditions and the following disclaimer in the documentation
|
|
26
|
+
// and/or other materials provided with the distribution.
|
|
27
|
+
//
|
|
28
|
+
// * The name of the copyright holders may not be used to endorse or promote products
|
|
29
|
+
// derived from this software without specific prior written permission.
|
|
30
|
+
//
|
|
31
|
+
// This software is provided by the copyright holders and contributors "as is" and
|
|
32
|
+
// any express or implied warranties, including, but not limited to, the implied
|
|
33
|
+
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
|
34
|
+
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
|
35
|
+
// indirect, incidental, special, exemplary, or consequential damages
|
|
36
|
+
// (including, but not limited to, procurement of substitute goods or services;
|
|
37
|
+
// loss of use, data, or profits; or business interruption) however caused
|
|
38
|
+
// and on any theory of liability, whether in contract, strict liability,
|
|
39
|
+
// or tort (including negligence or otherwise) arising in any way out of
|
|
40
|
+
// the use of this software, even if advised of the possibility of such damage.
|
|
41
|
+
//
|
|
42
|
+
//M*/
|
|
43
|
+
|
|
44
|
+
#ifndef OPENCV_CORE_AFFINE3_HPP
|
|
45
|
+
#define OPENCV_CORE_AFFINE3_HPP
|
|
46
|
+
|
|
47
|
+
#ifdef __cplusplus
|
|
48
|
+
|
|
49
|
+
#include <opencv2/core.hpp>
|
|
50
|
+
|
|
51
|
+
namespace cv
|
|
52
|
+
{
|
|
53
|
+
|
|
54
|
+
//! @addtogroup core
|
|
55
|
+
//! @{
|
|
56
|
+
|
|
57
|
+
/** @brief Affine transform
|
|
58
|
+
*
|
|
59
|
+
* It represents a 4x4 homogeneous transformation matrix \f$T\f$
|
|
60
|
+
*
|
|
61
|
+
* \f[T =
|
|
62
|
+
* \begin{bmatrix}
|
|
63
|
+
* R & t\\
|
|
64
|
+
* 0 & 1\\
|
|
65
|
+
* \end{bmatrix}
|
|
66
|
+
* \f]
|
|
67
|
+
*
|
|
68
|
+
* where \f$R\f$ is a 3x3 rotation matrix and \f$t\f$ is a 3x1 translation vector.
|
|
69
|
+
*
|
|
70
|
+
* You can specify \f$R\f$ either by a 3x3 rotation matrix or by a 3x1 rotation vector,
|
|
71
|
+
* which is converted to a 3x3 rotation matrix by the Rodrigues formula.
|
|
72
|
+
*
|
|
73
|
+
* To construct a matrix \f$T\f$ representing first rotation around the axis \f$r\f$ with rotation
|
|
74
|
+
* angle \f$|r|\f$ in radian (right hand rule) and then translation by the vector \f$t\f$, you can use
|
|
75
|
+
*
|
|
76
|
+
* @code
|
|
77
|
+
* cv::Vec3f r, t;
|
|
78
|
+
* cv::Affine3f T(r, t);
|
|
79
|
+
* @endcode
|
|
80
|
+
*
|
|
81
|
+
* If you already have the rotation matrix \f$R\f$, then you can use
|
|
82
|
+
*
|
|
83
|
+
* @code
|
|
84
|
+
* cv::Matx33f R;
|
|
85
|
+
* cv::Affine3f T(R, t);
|
|
86
|
+
* @endcode
|
|
87
|
+
*
|
|
88
|
+
* To extract the rotation matrix \f$R\f$ from \f$T\f$, use
|
|
89
|
+
*
|
|
90
|
+
* @code
|
|
91
|
+
* cv::Matx33f R = T.rotation();
|
|
92
|
+
* @endcode
|
|
93
|
+
*
|
|
94
|
+
* To extract the translation vector \f$t\f$ from \f$T\f$, use
|
|
95
|
+
*
|
|
96
|
+
* @code
|
|
97
|
+
* cv::Vec3f t = T.translation();
|
|
98
|
+
* @endcode
|
|
99
|
+
*
|
|
100
|
+
* To extract the rotation vector \f$r\f$ from \f$T\f$, use
|
|
101
|
+
*
|
|
102
|
+
* @code
|
|
103
|
+
* cv::Vec3f r = T.rvec();
|
|
104
|
+
* @endcode
|
|
105
|
+
*
|
|
106
|
+
* Note that since the mapping from rotation vectors to rotation matrices
|
|
107
|
+
* is many to one. The returned rotation vector is not necessarily the one
|
|
108
|
+
* you used before to set the matrix.
|
|
109
|
+
*
|
|
110
|
+
* If you have two transformations \f$T = T_1 * T_2\f$, use
|
|
111
|
+
*
|
|
112
|
+
* @code
|
|
113
|
+
* cv::Affine3f T, T1, T2;
|
|
114
|
+
* T = T2.concatenate(T1);
|
|
115
|
+
* @endcode
|
|
116
|
+
*
|
|
117
|
+
* To get the inverse transform of \f$T\f$, use
|
|
118
|
+
*
|
|
119
|
+
* @code
|
|
120
|
+
* cv::Affine3f T, T_inv;
|
|
121
|
+
* T_inv = T.inv();
|
|
122
|
+
* @endcode
|
|
123
|
+
*
|
|
124
|
+
*/
|
|
125
|
+
template<typename T>
|
|
126
|
+
class Affine3
|
|
127
|
+
{
|
|
128
|
+
public:
|
|
129
|
+
typedef T float_type;
|
|
130
|
+
typedef Matx<float_type, 3, 3> Mat3;
|
|
131
|
+
typedef Matx<float_type, 4, 4> Mat4;
|
|
132
|
+
typedef Vec<float_type, 3> Vec3;
|
|
133
|
+
|
|
134
|
+
//! Default constructor. It represents a 4x4 identity matrix.
|
|
135
|
+
Affine3();
|
|
136
|
+
|
|
137
|
+
//! Augmented affine matrix
|
|
138
|
+
Affine3(const Mat4& affine);
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The resulting 4x4 matrix is
|
|
142
|
+
*
|
|
143
|
+
* \f[
|
|
144
|
+
* \begin{bmatrix}
|
|
145
|
+
* R & t\\
|
|
146
|
+
* 0 & 1\\
|
|
147
|
+
* \end{bmatrix}
|
|
148
|
+
* \f]
|
|
149
|
+
*
|
|
150
|
+
* @param R 3x3 rotation matrix.
|
|
151
|
+
* @param t 3x1 translation vector.
|
|
152
|
+
*/
|
|
153
|
+
Affine3(const Mat3& R, const Vec3& t = Vec3::all(0));
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Rodrigues vector.
|
|
157
|
+
*
|
|
158
|
+
* The last row of the current matrix is set to [0,0,0,1].
|
|
159
|
+
*
|
|
160
|
+
* @param rvec 3x1 rotation vector. Its direction indicates the rotation axis and its length
|
|
161
|
+
* indicates the rotation angle in radian (using right hand rule).
|
|
162
|
+
* @param t 3x1 translation vector.
|
|
163
|
+
*/
|
|
164
|
+
Affine3(const Vec3& rvec, const Vec3& t = Vec3::all(0));
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Combines all constructors above. Supports 4x4, 3x4, 3x3, 1x3, 3x1 sizes of data matrix.
|
|
168
|
+
*
|
|
169
|
+
* The last row of the current matrix is set to [0,0,0,1] when data is not 4x4.
|
|
170
|
+
*
|
|
171
|
+
* @param data 1-channel matrix.
|
|
172
|
+
* when it is 4x4, it is copied to the current matrix and t is not used.
|
|
173
|
+
* When it is 3x4, it is copied to the upper part 3x4 of the current matrix and t is not used.
|
|
174
|
+
* When it is 3x3, it is copied to the upper left 3x3 part of the current matrix.
|
|
175
|
+
* When it is 3x1 or 1x3, it is treated as a rotation vector and the Rodrigues formula is used
|
|
176
|
+
* to compute a 3x3 rotation matrix.
|
|
177
|
+
* @param t 3x1 translation vector. It is used only when data is neither 4x4 nor 3x4.
|
|
178
|
+
*/
|
|
179
|
+
explicit Affine3(const Mat& data, const Vec3& t = Vec3::all(0));
|
|
180
|
+
|
|
181
|
+
//! From 16-element array
|
|
182
|
+
explicit Affine3(const float_type* vals);
|
|
183
|
+
|
|
184
|
+
//! Create an 4x4 identity transform
|
|
185
|
+
static Affine3 Identity();
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Rotation matrix.
|
|
189
|
+
*
|
|
190
|
+
* Copy the rotation matrix to the upper left 3x3 part of the current matrix.
|
|
191
|
+
* The remaining elements of the current matrix are not changed.
|
|
192
|
+
*
|
|
193
|
+
* @param R 3x3 rotation matrix.
|
|
194
|
+
*
|
|
195
|
+
*/
|
|
196
|
+
void rotation(const Mat3& R);
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Rodrigues vector.
|
|
200
|
+
*
|
|
201
|
+
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
|
|
202
|
+
*
|
|
203
|
+
* @param rvec 3x1 rotation vector. The direction indicates the rotation axis and
|
|
204
|
+
* its length indicates the rotation angle in radian (using the right thumb convention).
|
|
205
|
+
*/
|
|
206
|
+
void rotation(const Vec3& rvec);
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Combines rotation methods above. Supports 3x3, 1x3, 3x1 sizes of data matrix.
|
|
210
|
+
*
|
|
211
|
+
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
|
|
212
|
+
*
|
|
213
|
+
* @param data 1-channel matrix.
|
|
214
|
+
* When it is a 3x3 matrix, it sets the upper left 3x3 part of the current matrix.
|
|
215
|
+
* When it is a 1x3 or 3x1 matrix, it is used as a rotation vector. The Rodrigues formula
|
|
216
|
+
* is used to compute the rotation matrix and sets the upper left 3x3 part of the current matrix.
|
|
217
|
+
*/
|
|
218
|
+
void rotation(const Mat& data);
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Copy the 3x3 matrix L to the upper left part of the current matrix
|
|
222
|
+
*
|
|
223
|
+
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
|
|
224
|
+
*
|
|
225
|
+
* @param L 3x3 matrix.
|
|
226
|
+
*/
|
|
227
|
+
void linear(const Mat3& L);
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Copy t to the first three elements of the last column of the current matrix
|
|
231
|
+
*
|
|
232
|
+
* It sets the upper right 3x1 part of the matrix. The remaining part is unaffected.
|
|
233
|
+
*
|
|
234
|
+
* @param t 3x1 translation vector.
|
|
235
|
+
*/
|
|
236
|
+
void translation(const Vec3& t);
|
|
237
|
+
|
|
238
|
+
//! @return the upper left 3x3 part
|
|
239
|
+
Mat3 rotation() const;
|
|
240
|
+
|
|
241
|
+
//! @return the upper left 3x3 part
|
|
242
|
+
Mat3 linear() const;
|
|
243
|
+
|
|
244
|
+
//! @return the upper right 3x1 part
|
|
245
|
+
Vec3 translation() const;
|
|
246
|
+
|
|
247
|
+
//! Rodrigues vector.
|
|
248
|
+
//! @return a vector representing the upper left 3x3 rotation matrix of the current matrix.
|
|
249
|
+
//! @warning Since the mapping between rotation vectors and rotation matrices is many to one,
|
|
250
|
+
//! this function returns only one rotation vector that represents the current rotation matrix,
|
|
251
|
+
//! which is not necessarily the same one set by `rotation(const Vec3& rvec)`.
|
|
252
|
+
Vec3 rvec() const;
|
|
253
|
+
|
|
254
|
+
//! @return the inverse of the current matrix.
|
|
255
|
+
Affine3 inv(int method = cv::DECOMP_SVD) const;
|
|
256
|
+
|
|
257
|
+
//! a.rotate(R) is equivalent to Affine(R, 0) * a;
|
|
258
|
+
Affine3 rotate(const Mat3& R) const;
|
|
259
|
+
|
|
260
|
+
//! a.rotate(rvec) is equivalent to Affine(rvec, 0) * a;
|
|
261
|
+
Affine3 rotate(const Vec3& rvec) const;
|
|
262
|
+
|
|
263
|
+
//! a.translate(t) is equivalent to Affine(E, t) * a, where E is an identity matrix
|
|
264
|
+
Affine3 translate(const Vec3& t) const;
|
|
265
|
+
|
|
266
|
+
//! a.concatenate(affine) is equivalent to affine * a;
|
|
267
|
+
Affine3 concatenate(const Affine3& affine) const;
|
|
268
|
+
|
|
269
|
+
template <typename Y> operator Affine3<Y>() const;
|
|
270
|
+
|
|
271
|
+
template <typename Y> Affine3<Y> cast() const;
|
|
272
|
+
|
|
273
|
+
Mat4 matrix;
|
|
274
|
+
|
|
275
|
+
#if defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H
|
|
276
|
+
Affine3(const Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>& affine);
|
|
277
|
+
Affine3(const Eigen::Transform<T, 3, Eigen::Affine>& affine);
|
|
278
|
+
operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>() const;
|
|
279
|
+
operator Eigen::Transform<T, 3, Eigen::Affine>() const;
|
|
280
|
+
#endif
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
template<typename T> static
|
|
284
|
+
Affine3<T> operator*(const Affine3<T>& affine1, const Affine3<T>& affine2);
|
|
285
|
+
|
|
286
|
+
//! V is a 3-element vector with member fields x, y and z
|
|
287
|
+
template<typename T, typename V> static
|
|
288
|
+
V operator*(const Affine3<T>& affine, const V& vector);
|
|
289
|
+
|
|
290
|
+
typedef Affine3<float> Affine3f;
|
|
291
|
+
typedef Affine3<double> Affine3d;
|
|
292
|
+
|
|
293
|
+
static Vec3f operator*(const Affine3f& affine, const Vec3f& vector);
|
|
294
|
+
static Vec3d operator*(const Affine3d& affine, const Vec3d& vector);
|
|
295
|
+
|
|
296
|
+
template<typename _Tp> class DataType< Affine3<_Tp> >
|
|
297
|
+
{
|
|
298
|
+
public:
|
|
299
|
+
typedef Affine3<_Tp> value_type;
|
|
300
|
+
typedef Affine3<typename DataType<_Tp>::work_type> work_type;
|
|
301
|
+
typedef _Tp channel_type;
|
|
302
|
+
|
|
303
|
+
enum { generic_type = 0,
|
|
304
|
+
channels = 16,
|
|
305
|
+
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
|
|
306
|
+
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
|
307
|
+
,depth = DataType<channel_type>::depth
|
|
308
|
+
,type = CV_MAKETYPE(depth, channels)
|
|
309
|
+
#endif
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
typedef Vec<channel_type, channels> vec_type;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
namespace traits {
|
|
316
|
+
template<typename _Tp>
|
|
317
|
+
struct Depth< Affine3<_Tp> > { enum { value = Depth<_Tp>::value }; };
|
|
318
|
+
template<typename _Tp>
|
|
319
|
+
struct Type< Affine3<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 16) }; };
|
|
320
|
+
} // namespace
|
|
321
|
+
|
|
322
|
+
//! @} core
|
|
323
|
+
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
//! @cond IGNORED
|
|
327
|
+
|
|
328
|
+
///////////////////////////////////////////////////////////////////////////////////
|
|
329
|
+
// Implementation
|
|
330
|
+
|
|
331
|
+
template<typename T> inline
|
|
332
|
+
cv::Affine3<T>::Affine3()
|
|
333
|
+
: matrix(Mat4::eye())
|
|
334
|
+
{}
|
|
335
|
+
|
|
336
|
+
template<typename T> inline
|
|
337
|
+
cv::Affine3<T>::Affine3(const Mat4& affine)
|
|
338
|
+
: matrix(affine)
|
|
339
|
+
{}
|
|
340
|
+
|
|
341
|
+
template<typename T> inline
|
|
342
|
+
cv::Affine3<T>::Affine3(const Mat3& R, const Vec3& t)
|
|
343
|
+
{
|
|
344
|
+
rotation(R);
|
|
345
|
+
translation(t);
|
|
346
|
+
matrix.val[12] = matrix.val[13] = matrix.val[14] = 0;
|
|
347
|
+
matrix.val[15] = 1;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
template<typename T> inline
|
|
351
|
+
cv::Affine3<T>::Affine3(const Vec3& _rvec, const Vec3& t)
|
|
352
|
+
{
|
|
353
|
+
rotation(_rvec);
|
|
354
|
+
translation(t);
|
|
355
|
+
matrix.val[12] = matrix.val[13] = matrix.val[14] = 0;
|
|
356
|
+
matrix.val[15] = 1;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
template<typename T> inline
|
|
360
|
+
cv::Affine3<T>::Affine3(const cv::Mat& data, const Vec3& t)
|
|
361
|
+
{
|
|
362
|
+
CV_Assert(data.type() == cv::traits::Type<T>::value);
|
|
363
|
+
CV_Assert(data.channels() == 1);
|
|
364
|
+
|
|
365
|
+
if (data.cols == 4 && data.rows == 4)
|
|
366
|
+
{
|
|
367
|
+
data.copyTo(matrix);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
else if (data.cols == 4 && data.rows == 3)
|
|
371
|
+
{
|
|
372
|
+
rotation(data(Rect(0, 0, 3, 3)));
|
|
373
|
+
translation(data(Rect(3, 0, 1, 3)));
|
|
374
|
+
}
|
|
375
|
+
else
|
|
376
|
+
{
|
|
377
|
+
rotation(data);
|
|
378
|
+
translation(t);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
matrix.val[12] = matrix.val[13] = matrix.val[14] = 0;
|
|
382
|
+
matrix.val[15] = 1;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
template<typename T> inline
|
|
386
|
+
cv::Affine3<T>::Affine3(const float_type* vals) : matrix(vals)
|
|
387
|
+
{}
|
|
388
|
+
|
|
389
|
+
template<typename T> inline
|
|
390
|
+
cv::Affine3<T> cv::Affine3<T>::Identity()
|
|
391
|
+
{
|
|
392
|
+
return Affine3<T>(cv::Affine3<T>::Mat4::eye());
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
template<typename T> inline
|
|
396
|
+
void cv::Affine3<T>::rotation(const Mat3& R)
|
|
397
|
+
{
|
|
398
|
+
linear(R);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
template<typename T> inline
|
|
402
|
+
void cv::Affine3<T>::rotation(const Vec3& _rvec)
|
|
403
|
+
{
|
|
404
|
+
double theta = norm(_rvec);
|
|
405
|
+
|
|
406
|
+
if (theta < DBL_EPSILON)
|
|
407
|
+
rotation(Mat3::eye());
|
|
408
|
+
else
|
|
409
|
+
{
|
|
410
|
+
double c = std::cos(theta);
|
|
411
|
+
double s = std::sin(theta);
|
|
412
|
+
double c1 = 1. - c;
|
|
413
|
+
double itheta = (theta != 0) ? 1./theta : 0.;
|
|
414
|
+
|
|
415
|
+
Point3_<T> r = _rvec*itheta;
|
|
416
|
+
|
|
417
|
+
Mat3 rrt( r.x*r.x, r.x*r.y, r.x*r.z, r.x*r.y, r.y*r.y, r.y*r.z, r.x*r.z, r.y*r.z, r.z*r.z );
|
|
418
|
+
Mat3 r_x( 0, -r.z, r.y, r.z, 0, -r.x, -r.y, r.x, 0 );
|
|
419
|
+
|
|
420
|
+
// R = cos(theta)*I + (1 - cos(theta))*r*rT + sin(theta)*[r_x]
|
|
421
|
+
// where [r_x] is [0 -rz ry; rz 0 -rx; -ry rx 0]
|
|
422
|
+
Mat3 R = c*Mat3::eye() + c1*rrt + s*r_x;
|
|
423
|
+
|
|
424
|
+
rotation(R);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
//Combines rotation methods above. Supports 3x3, 1x3, 3x1 sizes of data matrix;
|
|
429
|
+
template<typename T> inline
|
|
430
|
+
void cv::Affine3<T>::rotation(const cv::Mat& data)
|
|
431
|
+
{
|
|
432
|
+
CV_Assert(data.type() == cv::traits::Type<T>::value);
|
|
433
|
+
CV_Assert(data.channels() == 1);
|
|
434
|
+
|
|
435
|
+
if (data.cols == 3 && data.rows == 3)
|
|
436
|
+
{
|
|
437
|
+
Mat3 R;
|
|
438
|
+
data.copyTo(R);
|
|
439
|
+
rotation(R);
|
|
440
|
+
}
|
|
441
|
+
else if ((data.cols == 3 && data.rows == 1) || (data.cols == 1 && data.rows == 3))
|
|
442
|
+
{
|
|
443
|
+
Vec3 _rvec;
|
|
444
|
+
data.reshape(1, 3).copyTo(_rvec);
|
|
445
|
+
rotation(_rvec);
|
|
446
|
+
}
|
|
447
|
+
else
|
|
448
|
+
CV_Error(Error::StsError, "Input matrix can only be 3x3, 1x3 or 3x1");
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
template<typename T> inline
|
|
452
|
+
void cv::Affine3<T>::linear(const Mat3& L)
|
|
453
|
+
{
|
|
454
|
+
matrix.val[0] = L.val[0]; matrix.val[1] = L.val[1]; matrix.val[ 2] = L.val[2];
|
|
455
|
+
matrix.val[4] = L.val[3]; matrix.val[5] = L.val[4]; matrix.val[ 6] = L.val[5];
|
|
456
|
+
matrix.val[8] = L.val[6]; matrix.val[9] = L.val[7]; matrix.val[10] = L.val[8];
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
template<typename T> inline
|
|
460
|
+
void cv::Affine3<T>::translation(const Vec3& t)
|
|
461
|
+
{
|
|
462
|
+
matrix.val[3] = t[0]; matrix.val[7] = t[1]; matrix.val[11] = t[2];
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
template<typename T> inline
|
|
466
|
+
typename cv::Affine3<T>::Mat3 cv::Affine3<T>::rotation() const
|
|
467
|
+
{
|
|
468
|
+
return linear();
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
template<typename T> inline
|
|
472
|
+
typename cv::Affine3<T>::Mat3 cv::Affine3<T>::linear() const
|
|
473
|
+
{
|
|
474
|
+
typename cv::Affine3<T>::Mat3 R;
|
|
475
|
+
R.val[0] = matrix.val[0]; R.val[1] = matrix.val[1]; R.val[2] = matrix.val[ 2];
|
|
476
|
+
R.val[3] = matrix.val[4]; R.val[4] = matrix.val[5]; R.val[5] = matrix.val[ 6];
|
|
477
|
+
R.val[6] = matrix.val[8]; R.val[7] = matrix.val[9]; R.val[8] = matrix.val[10];
|
|
478
|
+
return R;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
template<typename T> inline
|
|
482
|
+
typename cv::Affine3<T>::Vec3 cv::Affine3<T>::translation() const
|
|
483
|
+
{
|
|
484
|
+
return Vec3(matrix.val[3], matrix.val[7], matrix.val[11]);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
template<typename T> inline
|
|
488
|
+
typename cv::Affine3<T>::Vec3 cv::Affine3<T>::rvec() const
|
|
489
|
+
{
|
|
490
|
+
cv::Vec3d w;
|
|
491
|
+
cv::Matx33d u, vt, R = rotation();
|
|
492
|
+
cv::SVD::compute(R, w, u, vt, cv::SVD::FULL_UV + cv::SVD::MODIFY_A);
|
|
493
|
+
R = u * vt;
|
|
494
|
+
|
|
495
|
+
double rx = R.val[7] - R.val[5];
|
|
496
|
+
double ry = R.val[2] - R.val[6];
|
|
497
|
+
double rz = R.val[3] - R.val[1];
|
|
498
|
+
|
|
499
|
+
double s = std::sqrt((rx*rx + ry*ry + rz*rz)*0.25);
|
|
500
|
+
double c = (R.val[0] + R.val[4] + R.val[8] - 1) * 0.5;
|
|
501
|
+
c = c > 1.0 ? 1.0 : c < -1.0 ? -1.0 : c;
|
|
502
|
+
double theta = std::acos(c);
|
|
503
|
+
|
|
504
|
+
if( s < 1e-5 )
|
|
505
|
+
{
|
|
506
|
+
if( c > 0 )
|
|
507
|
+
rx = ry = rz = 0;
|
|
508
|
+
else
|
|
509
|
+
{
|
|
510
|
+
double t;
|
|
511
|
+
t = (R.val[0] + 1) * 0.5;
|
|
512
|
+
rx = std::sqrt(std::max(t, 0.0));
|
|
513
|
+
t = (R.val[4] + 1) * 0.5;
|
|
514
|
+
ry = std::sqrt(std::max(t, 0.0)) * (R.val[1] < 0 ? -1.0 : 1.0);
|
|
515
|
+
t = (R.val[8] + 1) * 0.5;
|
|
516
|
+
rz = std::sqrt(std::max(t, 0.0)) * (R.val[2] < 0 ? -1.0 : 1.0);
|
|
517
|
+
|
|
518
|
+
if( fabs(rx) < fabs(ry) && fabs(rx) < fabs(rz) && (R.val[5] > 0) != (ry*rz > 0) )
|
|
519
|
+
rz = -rz;
|
|
520
|
+
theta /= std::sqrt(rx*rx + ry*ry + rz*rz);
|
|
521
|
+
rx *= theta;
|
|
522
|
+
ry *= theta;
|
|
523
|
+
rz *= theta;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
else
|
|
527
|
+
{
|
|
528
|
+
double vth = 1/(2*s);
|
|
529
|
+
vth *= theta;
|
|
530
|
+
rx *= vth; ry *= vth; rz *= vth;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
return cv::Vec3d(rx, ry, rz);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
template<typename T> inline
|
|
537
|
+
cv::Affine3<T> cv::Affine3<T>::inv(int method) const
|
|
538
|
+
{
|
|
539
|
+
return matrix.inv(method);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
template<typename T> inline
|
|
543
|
+
cv::Affine3<T> cv::Affine3<T>::rotate(const Mat3& R) const
|
|
544
|
+
{
|
|
545
|
+
Mat3 Lc = linear();
|
|
546
|
+
Vec3 tc = translation();
|
|
547
|
+
Mat4 result;
|
|
548
|
+
result.val[12] = result.val[13] = result.val[14] = 0;
|
|
549
|
+
result.val[15] = 1;
|
|
550
|
+
|
|
551
|
+
for(int j = 0; j < 3; ++j)
|
|
552
|
+
{
|
|
553
|
+
for(int i = 0; i < 3; ++i)
|
|
554
|
+
{
|
|
555
|
+
float_type value = 0;
|
|
556
|
+
for(int k = 0; k < 3; ++k)
|
|
557
|
+
value += R(j, k) * Lc(k, i);
|
|
558
|
+
result(j, i) = value;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
result(j, 3) = R.row(j).dot(tc.t());
|
|
562
|
+
}
|
|
563
|
+
return result;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
template<typename T> inline
|
|
567
|
+
cv::Affine3<T> cv::Affine3<T>::rotate(const Vec3& _rvec) const
|
|
568
|
+
{
|
|
569
|
+
return rotate(Affine3f(_rvec).rotation());
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
template<typename T> inline
|
|
573
|
+
cv::Affine3<T> cv::Affine3<T>::translate(const Vec3& t) const
|
|
574
|
+
{
|
|
575
|
+
Mat4 m = matrix;
|
|
576
|
+
m.val[ 3] += t[0];
|
|
577
|
+
m.val[ 7] += t[1];
|
|
578
|
+
m.val[11] += t[2];
|
|
579
|
+
return m;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
template<typename T> inline
|
|
583
|
+
cv::Affine3<T> cv::Affine3<T>::concatenate(const Affine3<T>& affine) const
|
|
584
|
+
{
|
|
585
|
+
return (*this).rotate(affine.rotation()).translate(affine.translation());
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
template<typename T> template <typename Y> inline
|
|
589
|
+
cv::Affine3<T>::operator Affine3<Y>() const
|
|
590
|
+
{
|
|
591
|
+
return Affine3<Y>(matrix);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
template<typename T> template <typename Y> inline
|
|
595
|
+
cv::Affine3<Y> cv::Affine3<T>::cast() const
|
|
596
|
+
{
|
|
597
|
+
return Affine3<Y>(matrix);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
template<typename T> inline
|
|
601
|
+
cv::Affine3<T> cv::operator*(const cv::Affine3<T>& affine1, const cv::Affine3<T>& affine2)
|
|
602
|
+
{
|
|
603
|
+
return affine2.concatenate(affine1);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
template<typename T, typename V> inline
|
|
607
|
+
V cv::operator*(const cv::Affine3<T>& affine, const V& v)
|
|
608
|
+
{
|
|
609
|
+
const typename Affine3<T>::Mat4& m = affine.matrix;
|
|
610
|
+
|
|
611
|
+
V r;
|
|
612
|
+
r.x = m.val[0] * v.x + m.val[1] * v.y + m.val[ 2] * v.z + m.val[ 3];
|
|
613
|
+
r.y = m.val[4] * v.x + m.val[5] * v.y + m.val[ 6] * v.z + m.val[ 7];
|
|
614
|
+
r.z = m.val[8] * v.x + m.val[9] * v.y + m.val[10] * v.z + m.val[11];
|
|
615
|
+
return r;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
static inline
|
|
619
|
+
cv::Vec3f cv::operator*(const cv::Affine3f& affine, const cv::Vec3f& v)
|
|
620
|
+
{
|
|
621
|
+
const cv::Matx44f& m = affine.matrix;
|
|
622
|
+
cv::Vec3f r;
|
|
623
|
+
r.val[0] = m.val[0] * v[0] + m.val[1] * v[1] + m.val[ 2] * v[2] + m.val[ 3];
|
|
624
|
+
r.val[1] = m.val[4] * v[0] + m.val[5] * v[1] + m.val[ 6] * v[2] + m.val[ 7];
|
|
625
|
+
r.val[2] = m.val[8] * v[0] + m.val[9] * v[1] + m.val[10] * v[2] + m.val[11];
|
|
626
|
+
return r;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
static inline
|
|
630
|
+
cv::Vec3d cv::operator*(const cv::Affine3d& affine, const cv::Vec3d& v)
|
|
631
|
+
{
|
|
632
|
+
const cv::Matx44d& m = affine.matrix;
|
|
633
|
+
cv::Vec3d r;
|
|
634
|
+
r.val[0] = m.val[0] * v[0] + m.val[1] * v[1] + m.val[ 2] * v[2] + m.val[ 3];
|
|
635
|
+
r.val[1] = m.val[4] * v[0] + m.val[5] * v[1] + m.val[ 6] * v[2] + m.val[ 7];
|
|
636
|
+
r.val[2] = m.val[8] * v[0] + m.val[9] * v[1] + m.val[10] * v[2] + m.val[11];
|
|
637
|
+
return r;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
#if defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H
|
|
643
|
+
|
|
644
|
+
template<typename T> inline
|
|
645
|
+
cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>& affine)
|
|
646
|
+
{
|
|
647
|
+
cv::Mat(4, 4, cv::traits::Type<T>::value, affine.matrix().data()).copyTo(matrix);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
template<typename T> inline
|
|
651
|
+
cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine>& affine)
|
|
652
|
+
{
|
|
653
|
+
Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> a = affine;
|
|
654
|
+
cv::Mat(4, 4, cv::traits::Type<T>::value, a.matrix().data()).copyTo(matrix);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
template<typename T> inline
|
|
658
|
+
cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>() const
|
|
659
|
+
{
|
|
660
|
+
Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> r;
|
|
661
|
+
cv::Mat hdr(4, 4, cv::traits::Type<T>::value, r.matrix().data());
|
|
662
|
+
cv::Mat(matrix, false).copyTo(hdr);
|
|
663
|
+
return r;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
template<typename T> inline
|
|
667
|
+
cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine>() const
|
|
668
|
+
{
|
|
669
|
+
return this->operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>();
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
#endif /* defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H */
|
|
673
|
+
|
|
674
|
+
//! @endcond
|
|
675
|
+
|
|
676
|
+
#endif /* __cplusplus */
|
|
677
|
+
|
|
678
|
+
#endif /* OPENCV_CORE_AFFINE3_HPP */
|