node-native-win-utils 1.4.0 → 2.1.1

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.
Files changed (204) hide show
  1. package/README.md +29 -82
  2. package/binding.gyp +2 -0
  3. package/dist/dirnameLocal.cjs +4 -0
  4. package/dist/dirnameLocal.d.cts +1 -0
  5. package/dist/dirnameLocal.d.mts +1 -0
  6. package/dist/dirnameLocal.mjs +2 -0
  7. package/dist/{index.js → index.cjs} +83 -16
  8. package/dist/{index.d.ts → index.d.cts} +68 -17
  9. package/dist/index.d.mts +230 -0
  10. package/dist/index.mjs +212 -0
  11. package/dist/keyCodes.d.mts +101 -0
  12. package/dist/keyCodes.mjs +201 -0
  13. package/node22.json +16 -0
  14. package/package.json +19 -9
  15. package/prebuilds/win32-x64/node-native-win-utils.node +0 -0
  16. package/src/cpp/keyboard.cpp +141 -140
  17. package/src/cpp/main.cpp +9 -3
  18. package/src/cpp/{capturewindow.cpp → screenshot.cpp} +174 -2
  19. package/src/dirnameLocal.mts +3 -0
  20. package/src/index.mts +455 -0
  21. package/src/keyCodes.mts +203 -0
  22. package/dllCopy.js +0 -14
  23. package/include/opencv2/core/affine.hpp +0 -678
  24. package/include/opencv2/core/async.hpp +0 -105
  25. package/include/opencv2/core/base.hpp +0 -664
  26. package/include/opencv2/core/bindings_utils.hpp +0 -325
  27. package/include/opencv2/core/bufferpool.hpp +0 -40
  28. package/include/opencv2/core/check.hpp +0 -170
  29. package/include/opencv2/core/core.hpp +0 -48
  30. package/include/opencv2/core/core_c.h +0 -3128
  31. package/include/opencv2/core/cuda/block.hpp +0 -211
  32. package/include/opencv2/core/cuda/border_interpolate.hpp +0 -722
  33. package/include/opencv2/core/cuda/color.hpp +0 -309
  34. package/include/opencv2/core/cuda/common.hpp +0 -131
  35. package/include/opencv2/core/cuda/datamov_utils.hpp +0 -113
  36. package/include/opencv2/core/cuda/detail/color_detail.hpp +0 -2018
  37. package/include/opencv2/core/cuda/detail/reduce.hpp +0 -365
  38. package/include/opencv2/core/cuda/detail/reduce_key_val.hpp +0 -502
  39. package/include/opencv2/core/cuda/detail/transform_detail.hpp +0 -392
  40. package/include/opencv2/core/cuda/detail/type_traits_detail.hpp +0 -191
  41. package/include/opencv2/core/cuda/detail/vec_distance_detail.hpp +0 -121
  42. package/include/opencv2/core/cuda/dynamic_smem.hpp +0 -88
  43. package/include/opencv2/core/cuda/emulation.hpp +0 -269
  44. package/include/opencv2/core/cuda/filters.hpp +0 -293
  45. package/include/opencv2/core/cuda/funcattrib.hpp +0 -79
  46. package/include/opencv2/core/cuda/functional.hpp +0 -805
  47. package/include/opencv2/core/cuda/limits.hpp +0 -128
  48. package/include/opencv2/core/cuda/reduce.hpp +0 -209
  49. package/include/opencv2/core/cuda/saturate_cast.hpp +0 -292
  50. package/include/opencv2/core/cuda/scan.hpp +0 -258
  51. package/include/opencv2/core/cuda/simd_functions.hpp +0 -869
  52. package/include/opencv2/core/cuda/transform.hpp +0 -75
  53. package/include/opencv2/core/cuda/type_traits.hpp +0 -90
  54. package/include/opencv2/core/cuda/utility.hpp +0 -230
  55. package/include/opencv2/core/cuda/vec_distance.hpp +0 -232
  56. package/include/opencv2/core/cuda/vec_math.hpp +0 -923
  57. package/include/opencv2/core/cuda/vec_traits.hpp +0 -288
  58. package/include/opencv2/core/cuda/warp.hpp +0 -139
  59. package/include/opencv2/core/cuda/warp_reduce.hpp +0 -76
  60. package/include/opencv2/core/cuda/warp_shuffle.hpp +0 -162
  61. package/include/opencv2/core/cuda.hpp +0 -1279
  62. package/include/opencv2/core/cuda.inl.hpp +0 -763
  63. package/include/opencv2/core/cuda_stream_accessor.hpp +0 -86
  64. package/include/opencv2/core/cuda_types.hpp +0 -144
  65. package/include/opencv2/core/cv_cpu_dispatch.h +0 -381
  66. package/include/opencv2/core/cv_cpu_helper.h +0 -550
  67. package/include/opencv2/core/cvdef.h +0 -973
  68. package/include/opencv2/core/cvstd.hpp +0 -190
  69. package/include/opencv2/core/cvstd.inl.hpp +0 -197
  70. package/include/opencv2/core/cvstd_wrapper.hpp +0 -154
  71. package/include/opencv2/core/detail/async_promise.hpp +0 -71
  72. package/include/opencv2/core/detail/dispatch_helper.impl.hpp +0 -49
  73. package/include/opencv2/core/detail/exception_ptr.hpp +0 -27
  74. package/include/opencv2/core/directx.hpp +0 -184
  75. package/include/opencv2/core/dualquaternion.hpp +0 -979
  76. package/include/opencv2/core/dualquaternion.inl.hpp +0 -487
  77. package/include/opencv2/core/eigen.hpp +0 -402
  78. package/include/opencv2/core/fast_math.hpp +0 -433
  79. package/include/opencv2/core/hal/hal.hpp +0 -256
  80. package/include/opencv2/core/hal/interface.h +0 -190
  81. package/include/opencv2/core/hal/intrin.hpp +0 -939
  82. package/include/opencv2/core/hal/intrin_avx.hpp +0 -3177
  83. package/include/opencv2/core/hal/intrin_avx512.hpp +0 -3090
  84. package/include/opencv2/core/hal/intrin_cpp.hpp +0 -3321
  85. package/include/opencv2/core/hal/intrin_forward.hpp +0 -191
  86. package/include/opencv2/core/hal/intrin_lasx.hpp +0 -3236
  87. package/include/opencv2/core/hal/intrin_msa.hpp +0 -1887
  88. package/include/opencv2/core/hal/intrin_neon.hpp +0 -2610
  89. package/include/opencv2/core/hal/intrin_rvv.hpp +0 -3320
  90. package/include/opencv2/core/hal/intrin_rvv071.hpp +0 -2545
  91. package/include/opencv2/core/hal/intrin_rvv_scalable.hpp +0 -2080
  92. package/include/opencv2/core/hal/intrin_sse.hpp +0 -3467
  93. package/include/opencv2/core/hal/intrin_sse_em.hpp +0 -180
  94. package/include/opencv2/core/hal/intrin_vsx.hpp +0 -1608
  95. package/include/opencv2/core/hal/intrin_wasm.hpp +0 -2782
  96. package/include/opencv2/core/hal/msa_macros.h +0 -1558
  97. package/include/opencv2/core/hal/simd_utils.impl.hpp +0 -186
  98. package/include/opencv2/core/llapi/llapi.h +0 -102
  99. package/include/opencv2/core/mat.hpp +0 -3775
  100. package/include/opencv2/core/mat.inl.hpp +0 -3422
  101. package/include/opencv2/core/matx.hpp +0 -1536
  102. package/include/opencv2/core/neon_utils.hpp +0 -128
  103. package/include/opencv2/core/ocl.hpp +0 -917
  104. package/include/opencv2/core/ocl_genbase.hpp +0 -69
  105. package/include/opencv2/core/opencl/ocl_defs.hpp +0 -82
  106. package/include/opencv2/core/opencl/opencl_info.hpp +0 -212
  107. package/include/opencv2/core/opencl/opencl_svm.hpp +0 -81
  108. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clblas.hpp +0 -602
  109. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clfft.hpp +0 -146
  110. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp +0 -371
  111. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp +0 -272
  112. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp +0 -62
  113. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp +0 -42
  114. package/include/opencv2/core/opencl/runtime/opencl_clblas.hpp +0 -53
  115. package/include/opencv2/core/opencl/runtime/opencl_clfft.hpp +0 -53
  116. package/include/opencv2/core/opencl/runtime/opencl_core.hpp +0 -84
  117. package/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp +0 -47
  118. package/include/opencv2/core/opencl/runtime/opencl_gl.hpp +0 -53
  119. package/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp +0 -47
  120. package/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp +0 -48
  121. package/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp +0 -42
  122. package/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp +0 -166
  123. package/include/opencv2/core/opengl.hpp +0 -733
  124. package/include/opencv2/core/openvx/ovx_defs.hpp +0 -48
  125. package/include/opencv2/core/operations.hpp +0 -610
  126. package/include/opencv2/core/optim.hpp +0 -302
  127. package/include/opencv2/core/ovx.hpp +0 -28
  128. package/include/opencv2/core/parallel/backend/parallel_for.openmp.hpp +0 -72
  129. package/include/opencv2/core/parallel/backend/parallel_for.tbb.hpp +0 -153
  130. package/include/opencv2/core/parallel/parallel_backend.hpp +0 -90
  131. package/include/opencv2/core/persistence.hpp +0 -1350
  132. package/include/opencv2/core/private/cv_cpu_include_simd_declarations.hpp +0 -30
  133. package/include/opencv2/core/private.cuda.hpp +0 -169
  134. package/include/opencv2/core/private.hpp +0 -896
  135. package/include/opencv2/core/quaternion.hpp +0 -1696
  136. package/include/opencv2/core/quaternion.inl.hpp +0 -1063
  137. package/include/opencv2/core/saturate.hpp +0 -180
  138. package/include/opencv2/core/simd_intrinsics.hpp +0 -87
  139. package/include/opencv2/core/softfloat.hpp +0 -514
  140. package/include/opencv2/core/sse_utils.hpp +0 -652
  141. package/include/opencv2/core/traits.hpp +0 -417
  142. package/include/opencv2/core/types.hpp +0 -2457
  143. package/include/opencv2/core/types_c.h +0 -2126
  144. package/include/opencv2/core/utility.hpp +0 -1229
  145. package/include/opencv2/core/utils/allocator_stats.hpp +0 -29
  146. package/include/opencv2/core/utils/allocator_stats.impl.hpp +0 -158
  147. package/include/opencv2/core/utils/buffer_area.private.hpp +0 -136
  148. package/include/opencv2/core/utils/configuration.private.hpp +0 -22
  149. package/include/opencv2/core/utils/filesystem.hpp +0 -82
  150. package/include/opencv2/core/utils/filesystem.private.hpp +0 -66
  151. package/include/opencv2/core/utils/fp_control.private.hpp +0 -29
  152. package/include/opencv2/core/utils/fp_control_utils.hpp +0 -69
  153. package/include/opencv2/core/utils/instrumentation.hpp +0 -125
  154. package/include/opencv2/core/utils/lock.private.hpp +0 -119
  155. package/include/opencv2/core/utils/logger.defines.hpp +0 -42
  156. package/include/opencv2/core/utils/logger.hpp +0 -218
  157. package/include/opencv2/core/utils/logtag.hpp +0 -28
  158. package/include/opencv2/core/utils/plugin_loader.private.hpp +0 -165
  159. package/include/opencv2/core/utils/tls.hpp +0 -235
  160. package/include/opencv2/core/utils/trace.hpp +0 -252
  161. package/include/opencv2/core/utils/trace.private.hpp +0 -421
  162. package/include/opencv2/core/va_intel.hpp +0 -75
  163. package/include/opencv2/core/version.hpp +0 -26
  164. package/include/opencv2/core/vsx_utils.hpp +0 -1047
  165. package/include/opencv2/core.hpp +0 -3365
  166. package/include/opencv2/imgcodecs/imgcodecs.hpp +0 -48
  167. package/include/opencv2/imgcodecs/imgcodecs_c.h +0 -1
  168. package/include/opencv2/imgcodecs/ios.h +0 -59
  169. package/include/opencv2/imgcodecs/legacy/constants_c.h +0 -54
  170. package/include/opencv2/imgcodecs/macosx.h +0 -20
  171. package/include/opencv2/imgcodecs.hpp +0 -407
  172. package/include/opencv2/imgproc/bindings.hpp +0 -34
  173. package/include/opencv2/imgproc/detail/gcgraph.hpp +0 -395
  174. package/include/opencv2/imgproc/hal/hal.hpp +0 -246
  175. package/include/opencv2/imgproc/hal/interface.h +0 -46
  176. package/include/opencv2/imgproc/imgproc.hpp +0 -48
  177. package/include/opencv2/imgproc/imgproc_c.h +0 -1177
  178. package/include/opencv2/imgproc/segmentation.hpp +0 -141
  179. package/include/opencv2/imgproc/types_c.h +0 -659
  180. package/include/opencv2/imgproc.hpp +0 -5035
  181. package/include/opencv2/opencv_modules.hpp +0 -17
  182. package/include/tesseract/baseapi.h +0 -820
  183. package/include/tesseract/capi.h +0 -485
  184. package/include/tesseract/export.h +0 -37
  185. package/include/tesseract/ltrresultiterator.h +0 -235
  186. package/include/tesseract/ocrclass.h +0 -158
  187. package/include/tesseract/osdetect.h +0 -139
  188. package/include/tesseract/pageiterator.h +0 -364
  189. package/include/tesseract/publictypes.h +0 -281
  190. package/include/tesseract/renderer.h +0 -334
  191. package/include/tesseract/resultiterator.h +0 -250
  192. package/include/tesseract/tesseract.h +0 -40
  193. package/include/tesseract/unichar.h +0 -174
  194. package/include/tesseract/version.h +0 -34
  195. package/include/tesseract/version.h.in +0 -34
  196. package/libs/libjpeg-turbo.lib +0 -0
  197. package/libs/libpng.lib +0 -0
  198. package/libs/opencv_core470.lib +0 -0
  199. package/libs/opencv_imgcodecs470.lib +0 -0
  200. package/libs/opencv_imgproc470.lib +0 -0
  201. package/libs/tesseract.lib +0 -0
  202. package/libs/zlib.lib +0 -0
  203. /package/dist/{keyCodes.js → keyCodes.cjs} +0 -0
  204. /package/dist/{keyCodes.d.ts → keyCodes.d.cts} +0 -0
@@ -1,487 +0,0 @@
1
- // This file is part of OpenCV project.
2
- // It is subject to the license terms in the LICENSE file found in the top-level directory
3
- // of this distribution and at http://opencv.org/license.html.
4
- //
5
- //
6
- // License Agreement
7
- // For Open Source Computer Vision Library
8
- //
9
- // Copyright (C) 2020, Huawei Technologies Co., Ltd. All rights reserved.
10
- // Third party copyrights are property of their respective owners.
11
- //
12
- // Licensed under the Apache License, Version 2.0 (the "License");
13
- // you may not use this file except in compliance with the License.
14
- // You may obtain a copy of the License at
15
- //
16
- // http://www.apache.org/licenses/LICENSE-2.0
17
- //
18
- // Unless required by applicable law or agreed to in writing, software
19
- // distributed under the License is distributed on an "AS IS" BASIS,
20
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- // See the License for the specific language governing permissions and
22
- // limitations under the License.
23
- //
24
- // Author: Liangqian Kong <kongliangqian@huawei.com>
25
- // Longbu Wang <wanglongbu@huawei.com>
26
-
27
- #ifndef OPENCV_CORE_DUALQUATERNION_INL_HPP
28
- #define OPENCV_CORE_DUALQUATERNION_INL_HPP
29
-
30
- #ifndef OPENCV_CORE_DUALQUATERNION_HPP
31
- #error This is not a standalone header. Include dualquaternion.hpp instead.
32
- #endif
33
-
34
- ///////////////////////////////////////////////////////////////////////////////////////
35
- //Implementation
36
- namespace cv {
37
-
38
- template <typename T>
39
- DualQuat<T>::DualQuat():w(0), x(0), y(0), z(0), w_(0), x_(0), y_(0), z_(0){};
40
-
41
- template <typename T>
42
- DualQuat<T>::DualQuat(const T vw, const T vx, const T vy, const T vz, const T _w, const T _x, const T _y, const T _z):
43
- w(vw), x(vx), y(vy), z(vz), w_(_w), x_(_x), y_(_y), z_(_z){};
44
-
45
- template <typename T>
46
- DualQuat<T>::DualQuat(const Vec<T, 8> &q):w(q[0]), x(q[1]), y(q[2]), z(q[3]),
47
- w_(q[4]), x_(q[5]), y_(q[6]), z_(q[7]){};
48
-
49
- template <typename T>
50
- DualQuat<T> DualQuat<T>::createFromQuat(const Quat<T> &realPart, const Quat<T> &dualPart)
51
- {
52
- T w = realPart.w;
53
- T x = realPart.x;
54
- T y = realPart.y;
55
- T z = realPart.z;
56
- T w_ = dualPart.w;
57
- T x_ = dualPart.x;
58
- T y_ = dualPart.y;
59
- T z_ = dualPart.z;
60
- return DualQuat<T>(w, x, y, z, w_, x_, y_, z_);
61
- }
62
-
63
- template <typename T>
64
- DualQuat<T> DualQuat<T>::createFromAngleAxisTrans(const T angle, const Vec<T, 3> &axis, const Vec<T, 3> &trans)
65
- {
66
- Quat<T> r = Quat<T>::createFromAngleAxis(angle, axis);
67
- Quat<T> t{0, trans[0], trans[1], trans[2]};
68
- return createFromQuat(r, t * r * T(0.5));
69
- }
70
-
71
- template <typename T>
72
- DualQuat<T> DualQuat<T>::createFromMat(InputArray _R)
73
- {
74
- CV_CheckTypeEQ(_R.type(), cv::traits::Type<T>::value, "");
75
- if (_R.size() != Size(4, 4))
76
- {
77
- CV_Error(Error::StsBadArg, "The input matrix must have 4 columns and 4 rows");
78
- }
79
- Mat R = _R.getMat();
80
- Quat<T> r = Quat<T>::createFromRotMat(R.colRange(0, 3).rowRange(0, 3));
81
- Quat<T> trans(0, R.at<T>(0, 3), R.at<T>(1, 3), R.at<T>(2, 3));
82
- return createFromQuat(r, trans * r * T(0.5));
83
- }
84
-
85
- template <typename T>
86
- DualQuat<T> DualQuat<T>::createFromAffine3(const Affine3<T> &R)
87
- {
88
- return createFromMat(R.matrix);
89
- }
90
-
91
- template <typename T>
92
- DualQuat<T> DualQuat<T>::createFromPitch(const T angle, const T d, const Vec<T, 3> &axis, const Vec<T, 3> &moment)
93
- {
94
- T half_angle = angle * T(0.5), half_d = d * T(0.5);
95
- Quat<T> qaxis = Quat<T>(0, axis[0], axis[1], axis[2]).normalize();
96
- Quat<T> qmoment = Quat<T>(0, moment[0], moment[1], moment[2]);
97
- qmoment -= qaxis * axis.dot(moment);
98
- Quat<T> dual = -half_d * std::sin(half_angle) + std::sin(half_angle) * qmoment +
99
- half_d * std::cos(half_angle) * qaxis;
100
- return createFromQuat(Quat<T>::createFromAngleAxis(angle, axis), dual);
101
- }
102
-
103
- template <typename T>
104
- inline bool DualQuat<T>::operator==(const DualQuat<T> &q) const
105
- {
106
- return (abs(w - q.w) < CV_DUAL_QUAT_EPS && abs(x - q.x) < CV_DUAL_QUAT_EPS &&
107
- abs(y - q.y) < CV_DUAL_QUAT_EPS && abs(z - q.z) < CV_DUAL_QUAT_EPS &&
108
- abs(w_ - q.w_) < CV_DUAL_QUAT_EPS && abs(x_ - q.x_) < CV_DUAL_QUAT_EPS &&
109
- abs(y_ - q.y_) < CV_DUAL_QUAT_EPS && abs(z_ - q.z_) < CV_DUAL_QUAT_EPS);
110
- }
111
-
112
- template <typename T>
113
- inline Quat<T> DualQuat<T>::getRealPart() const
114
- {
115
- return Quat<T>(w, x, y, z);
116
- }
117
-
118
- template <typename T>
119
- inline Quat<T> DualQuat<T>::getDualPart() const
120
- {
121
- return Quat<T>(w_, x_, y_, z_);
122
- }
123
-
124
- template <typename T>
125
- inline DualQuat<T> conjugate(const DualQuat<T> &dq)
126
- {
127
- return dq.conjugate();
128
- }
129
-
130
- template <typename T>
131
- inline DualQuat<T> DualQuat<T>::conjugate() const
132
- {
133
- return DualQuat<T>(w, -x, -y, -z, w_, -x_, -y_, -z_);
134
- }
135
-
136
- template <typename T>
137
- DualQuat<T> DualQuat<T>::norm() const
138
- {
139
- Quat<T> real = getRealPart();
140
- T realNorm = real.norm();
141
- Quat<T> dual = getDualPart();
142
- if (realNorm < CV_DUAL_QUAT_EPS){
143
- return DualQuat<T>(0, 0, 0, 0, 0, 0, 0, 0);
144
- }
145
- return DualQuat<T>(realNorm, 0, 0, 0, real.dot(dual) / realNorm, 0, 0, 0);
146
- }
147
-
148
- template <typename T>
149
- inline Quat<T> DualQuat<T>::getRotation(QuatAssumeType assumeUnit) const
150
- {
151
- if (assumeUnit)
152
- {
153
- return getRealPart();
154
- }
155
- return getRealPart().normalize();
156
- }
157
-
158
- template <typename T>
159
- inline Vec<T, 3> DualQuat<T>::getTranslation(QuatAssumeType assumeUnit) const
160
- {
161
- Quat<T> trans = T(2.0) * (getDualPart() * getRealPart().inv(assumeUnit));
162
- return Vec<T, 3>{trans[1], trans[2], trans[3]};
163
- }
164
-
165
- template <typename T>
166
- DualQuat<T> DualQuat<T>::normalize() const
167
- {
168
- Quat<T> p = getRealPart();
169
- Quat<T> q = getDualPart();
170
- T p_norm = p.norm();
171
- if (p_norm < CV_DUAL_QUAT_EPS)
172
- {
173
- CV_Error(Error::StsBadArg, "Cannot normalize this dual quaternion: the norm is too small.");
174
- }
175
- Quat<T> p_nr = p / p_norm;
176
- Quat<T> q_nr = q / p_norm;
177
- return createFromQuat(p_nr, q_nr - p_nr * p_nr.dot(q_nr));
178
- }
179
-
180
- template <typename T>
181
- inline T DualQuat<T>::dot(DualQuat<T> q) const
182
- {
183
- return q.w * w + q.x * x + q.y * y + q.z * z + q.w_ * w_ + q.x_ * x_ + q.y_ * y_ + q.z_ * z_;
184
- }
185
-
186
- template <typename T>
187
- inline DualQuat<T> inv(const DualQuat<T> &dq, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
188
- {
189
- return dq.inv(assumeUnit);
190
- }
191
-
192
- template <typename T>
193
- inline DualQuat<T> DualQuat<T>::inv(QuatAssumeType assumeUnit) const
194
- {
195
- Quat<T> real = getRealPart();
196
- Quat<T> dual = getDualPart();
197
- return createFromQuat(real.inv(assumeUnit), -real.inv(assumeUnit) * dual * real.inv(assumeUnit));
198
- }
199
-
200
- template <typename T>
201
- inline DualQuat<T> DualQuat<T>::operator-(const DualQuat<T> &q) const
202
- {
203
- return DualQuat<T>(w - q.w, x - q.x, y - q.y, z - q.z, w_ - q.w_, x_ - q.x_, y_ - q.y_, z_ - q.z_);
204
- }
205
-
206
- template <typename T>
207
- inline DualQuat<T> DualQuat<T>::operator-() const
208
- {
209
- return DualQuat<T>(-w, -x, -y, -z, -w_, -x_, -y_, -z_);
210
- }
211
-
212
- template <typename T>
213
- inline DualQuat<T> DualQuat<T>::operator+(const DualQuat<T> &q) const
214
- {
215
- return DualQuat<T>(w + q.w, x + q.x, y + q.y, z + q.z, w_ + q.w_, x_ + q.x_, y_ + q.y_, z_ + q.z_);
216
- }
217
-
218
- template <typename T>
219
- inline DualQuat<T>& DualQuat<T>::operator+=(const DualQuat<T> &q)
220
- {
221
- *this = *this + q;
222
- return *this;
223
- }
224
-
225
- template <typename T>
226
- inline DualQuat<T> DualQuat<T>::operator*(const DualQuat<T> &q) const
227
- {
228
- Quat<T> A = getRealPart();
229
- Quat<T> B = getDualPart();
230
- Quat<T> C = q.getRealPart();
231
- Quat<T> D = q.getDualPart();
232
- return DualQuat<T>::createFromQuat(A * C, A * D + B * C);
233
- }
234
-
235
- template <typename T>
236
- inline DualQuat<T>& DualQuat<T>::operator*=(const DualQuat<T> &q)
237
- {
238
- *this = *this * q;
239
- return *this;
240
- }
241
-
242
- template <typename T>
243
- inline DualQuat<T> operator+(const T a, const DualQuat<T> &q)
244
- {
245
- return DualQuat<T>(a + q.w, q.x, q.y, q.z, q.w_, q.x_, q.y_, q.z_);
246
- }
247
-
248
- template <typename T>
249
- inline DualQuat<T> operator+(const DualQuat<T> &q, const T a)
250
- {
251
- return DualQuat<T>(a + q.w, q.x, q.y, q.z, q.w_, q.x_, q.y_, q.z_);
252
- }
253
-
254
- template <typename T>
255
- inline DualQuat<T> operator-(const DualQuat<T> &q, const T a)
256
- {
257
- return DualQuat<T>(q.w - a, q.x, q.y, q.z, q.w_, q.x_, q.y_, q.z_);
258
- }
259
-
260
- template <typename T>
261
- inline DualQuat<T>& DualQuat<T>::operator-=(const DualQuat<T> &q)
262
- {
263
- *this = *this - q;
264
- return *this;
265
- }
266
-
267
- template <typename T>
268
- inline DualQuat<T> operator-(const T a, const DualQuat<T> &q)
269
- {
270
- return DualQuat<T>(a - q.w, -q.x, -q.y, -q.z, -q.w_, -q.x_, -q.y_, -q.z_);
271
- }
272
-
273
- template <typename T>
274
- inline DualQuat<T> operator*(const T a, const DualQuat<T> &q)
275
- {
276
- return DualQuat<T>(q.w * a, q.x * a, q.y * a, q.z * a, q.w_ * a, q.x_ * a, q.y_ * a, q.z_ * a);
277
- }
278
-
279
- template <typename T>
280
- inline DualQuat<T> operator*(const DualQuat<T> &q, const T a)
281
- {
282
- return DualQuat<T>(q.w * a, q.x * a, q.y * a, q.z * a, q.w_ * a, q.x_ * a, q.y_ * a, q.z_ * a);
283
- }
284
-
285
- template <typename T>
286
- inline DualQuat<T> DualQuat<T>::operator/(const T a) const
287
- {
288
- return DualQuat<T>(w / a, x / a, y / a, z / a, w_ / a, x_ / a, y_ / a, z_ / a);
289
- }
290
-
291
- template <typename T>
292
- inline DualQuat<T> DualQuat<T>::operator/(const DualQuat<T> &q) const
293
- {
294
- return *this * q.inv();
295
- }
296
-
297
- template <typename T>
298
- inline DualQuat<T>& DualQuat<T>::operator/=(const DualQuat<T> &q)
299
- {
300
- *this = *this / q;
301
- return *this;
302
- }
303
-
304
- template <typename T>
305
- std::ostream & operator<<(std::ostream &os, const DualQuat<T> &q)
306
- {
307
- os << "DualQuat " << Vec<T, 8>{q.w, q.x, q.y, q.z, q.w_, q.x_, q.y_, q.z_};
308
- return os;
309
- }
310
-
311
- template <typename T>
312
- inline DualQuat<T> exp(const DualQuat<T> &dq)
313
- {
314
- return dq.exp();
315
- }
316
-
317
- namespace detail {
318
-
319
- template <typename _Tp>
320
- Matx<_Tp, 4, 4> jacob_exp(const Quat<_Tp> &q)
321
- {
322
- _Tp nv = std::sqrt(q.x * q.x + q.y * q.y + q.z * q.z);
323
- _Tp sinc_nv = abs(nv) < cv::DualQuat<_Tp>::CV_DUAL_QUAT_EPS ? _Tp(1.0) - nv * nv * _Tp(1.0/6.0) : std::sin(nv) / nv;
324
- _Tp csiii_nv = abs(nv) < cv::DualQuat<_Tp>::CV_DUAL_QUAT_EPS ? -_Tp(1.0/3.0) : (std::cos(nv) - sinc_nv) / nv / nv;
325
- Matx<_Tp, 4, 4> J_exp_quat {
326
- std::cos(nv), -sinc_nv * q.x, -sinc_nv * q.y, -sinc_nv * q.z,
327
- sinc_nv * q.x, csiii_nv * q.x * q.x + sinc_nv, csiii_nv * q.x * q.y, csiii_nv * q.x * q.z,
328
- sinc_nv * q.y, csiii_nv * q.y * q.x, csiii_nv * q.y * q.y + sinc_nv, csiii_nv * q.y * q.z,
329
- sinc_nv * q.z, csiii_nv * q.z * q.x, csiii_nv * q.z * q.y, csiii_nv * q.z * q.z + sinc_nv
330
- };
331
- return std::exp(q.w) * J_exp_quat;
332
- }
333
-
334
- } // namespace detail
335
-
336
- template <typename T>
337
- DualQuat<T> DualQuat<T>::exp() const
338
- {
339
- Quat<T> real = getRealPart();
340
- return createFromQuat(real.exp(), Quat<T>(detail::jacob_exp(real) * getDualPart().toVec()));
341
- }
342
-
343
- template <typename T>
344
- DualQuat<T> log(const DualQuat<T> &dq, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
345
- {
346
- return dq.log(assumeUnit);
347
- }
348
-
349
- template <typename T>
350
- DualQuat<T> DualQuat<T>::log(QuatAssumeType assumeUnit) const
351
- {
352
- Quat<T> plog = getRealPart().log(assumeUnit);
353
- Matx<T, 4, 4> jacob = detail::jacob_exp(plog);
354
- return createFromQuat(plog, Quat<T>(jacob.inv() * getDualPart().toVec()));
355
- }
356
-
357
- template <typename T>
358
- inline DualQuat<T> power(const DualQuat<T> &dq, const T t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
359
- {
360
- return dq.power(t, assumeUnit);
361
- }
362
-
363
- template <typename T>
364
- inline DualQuat<T> DualQuat<T>::power(const T t, QuatAssumeType assumeUnit) const
365
- {
366
- return (t * log(assumeUnit)).exp();
367
- }
368
-
369
- template <typename T>
370
- inline DualQuat<T> power(const DualQuat<T> &p, const DualQuat<T> &q, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
371
- {
372
- return p.power(q, assumeUnit);
373
- }
374
-
375
- template <typename T>
376
- inline DualQuat<T> DualQuat<T>::power(const DualQuat<T> &q, QuatAssumeType assumeUnit) const
377
- {
378
- return (q * log(assumeUnit)).exp();
379
- }
380
-
381
- template <typename T>
382
- inline Vec<T, 8> DualQuat<T>::toVec() const
383
- {
384
- return Vec<T, 8>(w, x, y, z, w_, x_, y_, z_);
385
- }
386
-
387
- template <typename T>
388
- Affine3<T> DualQuat<T>::toAffine3(QuatAssumeType assumeUnit) const
389
- {
390
- return Affine3<T>(toMat(assumeUnit));
391
- }
392
-
393
- template <typename T>
394
- Matx<T, 4, 4> DualQuat<T>::toMat(QuatAssumeType assumeUnit) const
395
- {
396
- Matx<T, 4, 4> rot44 = getRotation(assumeUnit).toRotMat4x4();
397
- Vec<T, 3> translation = getTranslation(assumeUnit);
398
- rot44(0, 3) = translation[0];
399
- rot44(1, 3) = translation[1];
400
- rot44(2, 3) = translation[2];
401
- return rot44;
402
- }
403
-
404
- template <typename T>
405
- DualQuat<T> DualQuat<T>::sclerp(const DualQuat<T> &q0, const DualQuat<T> &q1, const T t, bool directChange, QuatAssumeType assumeUnit)
406
- {
407
- DualQuat<T> v0(q0), v1(q1);
408
- if (!assumeUnit)
409
- {
410
- v0 = v0.normalize();
411
- v1 = v1.normalize();
412
- }
413
- Quat<T> v0Real = v0.getRealPart();
414
- Quat<T> v1Real = v1.getRealPart();
415
- if (directChange && v1Real.dot(v0Real) < 0)
416
- {
417
- v0 = -v0;
418
- }
419
- DualQuat<T> v0inv1 = v0.inv() * v1;
420
- return v0 * v0inv1.power(t, QUAT_ASSUME_UNIT);
421
- }
422
-
423
- template <typename T>
424
- DualQuat<T> DualQuat<T>::dqblend(const DualQuat<T> &q1, const DualQuat<T> &q2, const T t, QuatAssumeType assumeUnit)
425
- {
426
- DualQuat<T> v1(q1), v2(q2);
427
- if (!assumeUnit)
428
- {
429
- v1 = v1.normalize();
430
- v2 = v2.normalize();
431
- }
432
- if (v1.getRotation(assumeUnit).dot(v2.getRotation(assumeUnit)) < 0)
433
- {
434
- return ((1 - t) * v1 - t * v2).normalize();
435
- }
436
- return ((1 - t) * v1 + t * v2).normalize();
437
- }
438
-
439
- template <typename T>
440
- DualQuat<T> DualQuat<T>::gdqblend(InputArray _dualquat, InputArray _weight, QuatAssumeType assumeUnit)
441
- {
442
- CV_CheckTypeEQ(_weight.type(), cv::traits::Type<T>::value, "");
443
- CV_CheckTypeEQ(_dualquat.type(), CV_MAKETYPE(CV_MAT_DEPTH(cv::traits::Type<T>::value), 8), "");
444
- Size dq_s = _dualquat.size();
445
- if (dq_s != _weight.size() || (dq_s.height != 1 && dq_s.width != 1))
446
- {
447
- CV_Error(Error::StsBadArg, "The size of weight must be the same as dualquat, both of them should be (1, n) or (n, 1)");
448
- }
449
- Mat dualquat = _dualquat.getMat(), weight = _weight.getMat();
450
- const int cn = std::max(dq_s.width, dq_s.height);
451
- if (!assumeUnit)
452
- {
453
- for (int i = 0; i < cn; ++i)
454
- {
455
- dualquat.at<Vec<T, 8>>(i) = DualQuat<T>{dualquat.at<Vec<T, 8>>(i)}.normalize().toVec();
456
- }
457
- }
458
- Vec<T, 8> dq_blend = dualquat.at<Vec<T, 8>>(0) * weight.at<T>(0);
459
- Quat<T> q0 = DualQuat<T> {dualquat.at<Vec<T, 8>>(0)}.getRotation(assumeUnit);
460
- for (int i = 1; i < cn; ++i)
461
- {
462
- T k = q0.dot(DualQuat<T>{dualquat.at<Vec<T, 8>>(i)}.getRotation(assumeUnit)) < 0 ? -1: 1;
463
- dq_blend = dq_blend + dualquat.at<Vec<T, 8>>(i) * k * weight.at<T>(i);
464
- }
465
- return DualQuat<T>{dq_blend}.normalize();
466
- }
467
-
468
- template <typename T>
469
- template <int cn>
470
- DualQuat<T> DualQuat<T>::gdqblend(const Vec<DualQuat<T>, cn> &_dualquat, InputArray _weight, QuatAssumeType assumeUnit)
471
- {
472
- Vec<DualQuat<T>, cn> dualquat(_dualquat);
473
- if (cn == 0)
474
- {
475
- return DualQuat<T>(1, 0, 0, 0, 0, 0, 0, 0);
476
- }
477
- Mat dualquat_mat(cn, 1, CV_64FC(8));
478
- for (int i = 0; i < cn ; ++i)
479
- {
480
- dualquat_mat.at<Vec<T, 8>>(i) = dualquat[i].toVec();
481
- }
482
- return gdqblend(dualquat_mat, _weight, assumeUnit);
483
- }
484
-
485
- } //namespace cv
486
-
487
- #endif /*OPENCV_CORE_DUALQUATERNION_INL_HPP*/