47 const core::Dtype &dtype,
48 const core::Device &device,
49 const registration::RobustKernel &kernel);
61 const core::Dtype &dtype,
62 const core::Device &device,
63 const registration::RobustKernel &kernel,
64 const double &lambda_geometric);
66 #ifdef BUILD_CUDA_MODULE 67 void ComputePosePointToPlaneCUDA(
const core::Tensor &source_points,
74 const core::Dtype &dtype,
75 const core::Device &device,
76 const registration::RobustKernel &kernel);
78 void ComputePoseColoredICPCUDA(
const core::Tensor &source_points,
88 const core::Dtype &dtype,
89 const core::Device &device,
90 const registration::RobustKernel &kernel,
91 const double &lambda_geometric);
100 const core::Dtype &dtype,
101 const core::Device &device);
106 const core::Dtype &dtype,
107 const core::Device &device);
109 #ifdef BUILD_CUDA_MODULE 110 void ComputeInformationMatrixCUDA(
const core::Tensor &target_points,
113 const core::Dtype &dtype,
114 const core::Device &device);
117 template <
typename scalar_t>
119 int64_t workload_idx,
120 const scalar_t *source_points_ptr,
121 const scalar_t *target_points_ptr,
122 const scalar_t *target_normals_ptr,
123 const int64_t *correspondence_indices,
126 if (correspondence_indices[workload_idx] == -1) {
130 const int64_t target_idx = 3 * correspondence_indices[workload_idx];
131 const int64_t source_idx = 3 * workload_idx;
133 const scalar_t &sx = source_points_ptr[source_idx + 0];
134 const scalar_t &sy = source_points_ptr[source_idx + 1];
135 const scalar_t &sz = source_points_ptr[source_idx + 2];
136 const scalar_t &tx = target_points_ptr[target_idx + 0];
137 const scalar_t &ty = target_points_ptr[target_idx + 1];
138 const scalar_t &tz = target_points_ptr[target_idx + 2];
139 const scalar_t &nx = target_normals_ptr[target_idx + 0];
140 const scalar_t &ny = target_normals_ptr[target_idx + 1];
141 const scalar_t &nz = target_normals_ptr[target_idx + 2];
143 r = (sx - tx) * nx + (sy - ty) * ny + (sz - tz) * nz;
145 J_ij[0] = nz * sy - ny * sz;
146 J_ij[1] = nx * sz - nz * sx;
147 J_ij[2] = ny * sx - nx * sy;
156 const float *source_points_ptr,
157 const float *target_points_ptr,
158 const float *target_normals_ptr,
159 const int64_t *correspondence_indices,
164 const double *source_points_ptr,
165 const double *target_points_ptr,
166 const double *target_normals_ptr,
167 const int64_t *correspondence_indices,
171 template <
typename scalar_t>
173 const int64_t workload_idx,
174 const scalar_t *source_points_ptr,
175 const scalar_t *source_colors_ptr,
176 const scalar_t *target_points_ptr,
177 const scalar_t *target_normals_ptr,
178 const scalar_t *target_colors_ptr,
179 const scalar_t *target_color_gradients_ptr,
180 const int64_t *correspondence_indices,
181 const scalar_t &sqrt_lambda_geometric,
182 const scalar_t &sqrt_lambda_photometric,
187 if (correspondence_indices[workload_idx] == -1) {
191 const int64_t target_idx = 3 * correspondence_indices[workload_idx];
192 const int64_t source_idx = 3 * workload_idx;
194 const scalar_t vs[3] = {source_points_ptr[source_idx],
195 source_points_ptr[source_idx + 1],
196 source_points_ptr[source_idx + 2]};
198 const scalar_t vt[3] = {target_points_ptr[target_idx],
199 target_points_ptr[target_idx + 1],
200 target_points_ptr[target_idx + 2]};
202 const scalar_t nt[3] = {target_normals_ptr[target_idx],
203 target_normals_ptr[target_idx + 1],
204 target_normals_ptr[target_idx + 2]};
206 const scalar_t d = (vs[0] - vt[0]) * nt[0] + (vs[1] - vt[1]) * nt[1] +
207 (vs[2] - vt[2]) * nt[2];
209 J_G[0] = sqrt_lambda_geometric * (-vs[2] * nt[1] + vs[1] * nt[2]);
210 J_G[1] = sqrt_lambda_geometric * (vs[2] * nt[0] - vs[0] * nt[2]);
211 J_G[2] = sqrt_lambda_geometric * (-vs[1] * nt[0] + vs[0] * nt[1]);
212 J_G[3] = sqrt_lambda_geometric * nt[0];
213 J_G[4] = sqrt_lambda_geometric * nt[1];
214 J_G[5] = sqrt_lambda_geometric * nt[2];
215 r_G = sqrt_lambda_geometric * d;
217 const scalar_t vs_proj[3] = {vs[0] - d * nt[0], vs[1] - d * nt[1],
220 const scalar_t intensity_source =
221 (source_colors_ptr[source_idx] + source_colors_ptr[source_idx + 1] +
222 source_colors_ptr[source_idx + 2]) /
225 const scalar_t intensity_target =
226 (target_colors_ptr[target_idx] + target_colors_ptr[target_idx + 1] +
227 target_colors_ptr[target_idx + 2]) /
230 const scalar_t dit[3] = {target_color_gradients_ptr[target_idx],
231 target_color_gradients_ptr[target_idx + 1],
232 target_color_gradients_ptr[target_idx + 2]};
234 const scalar_t is_proj = dit[0] * (vs_proj[0] - vt[0]) +
235 dit[1] * (vs_proj[1] - vt[1]) +
236 dit[2] * (vs_proj[2] - vt[2]) + intensity_target;
238 const scalar_t s = dit[0] * nt[0] + dit[1] * nt[1] + dit[2] * nt[2];
239 const scalar_t ditM[3] = {s * nt[0] - dit[0], s * nt[1] - dit[1],
242 J_I[0] = sqrt_lambda_photometric * (-vs[2] * ditM[1] + vs[1] * ditM[2]);
243 J_I[1] = sqrt_lambda_photometric * (vs[2] * ditM[0] - vs[0] * ditM[2]);
244 J_I[2] = sqrt_lambda_photometric * (-vs[1] * ditM[0] + vs[0] * ditM[1]);
245 J_I[3] = sqrt_lambda_photometric * ditM[0];
246 J_I[4] = sqrt_lambda_photometric * ditM[1];
247 J_I[5] = sqrt_lambda_photometric * ditM[2];
248 r_I = sqrt_lambda_photometric * (intensity_source - is_proj);
254 const float *source_points_ptr,
255 const float *source_colors_ptr,
256 const float *target_points_ptr,
257 const float *target_normals_ptr,
258 const float *target_colors_ptr,
259 const float *target_color_gradients_ptr,
260 const int64_t *correspondence_indices,
261 const float &sqrt_lambda_geometric,
262 const float &sqrt_lambda_photometric,
269 const double *source_points_ptr,
270 const double *source_colors_ptr,
271 const double *target_points_ptr,
272 const double *target_normals_ptr,
273 const double *target_colors_ptr,
274 const double *target_color_gradients_ptr,
275 const int64_t *correspondence_indices,
276 const double &sqrt_lambda_geometric,
277 const double &sqrt_lambda_photometric,
283 template <
typename scalar_t>
285 int64_t workload_idx,
286 const scalar_t *target_points_ptr,
287 const int64_t *correspondence_indices,
288 scalar_t *jacobian_x,
289 scalar_t *jacobian_y,
290 scalar_t *jacobian_z) {
291 if (correspondence_indices[workload_idx] == -1) {
295 const int64_t target_idx = 3 * correspondence_indices[workload_idx];
297 jacobian_x[0] = jacobian_x[4] = jacobian_x[5] = 0.0;
298 jacobian_x[1] = target_points_ptr[target_idx + 2];
299 jacobian_x[2] = -target_points_ptr[target_idx + 1];
302 jacobian_y[1] = jacobian_y[3] = jacobian_y[5] = 0.0;
303 jacobian_y[0] = -target_points_ptr[target_idx + 2];
304 jacobian_y[2] = target_points_ptr[target_idx];
307 jacobian_z[2] = jacobian_z[3] = jacobian_z[4] = 0.0;
308 jacobian_z[0] = target_points_ptr[target_idx + 1];
309 jacobian_z[1] = -target_points_ptr[target_idx];
316 const float *target_points_ptr,
317 const int64_t *correspondence_indices,
323 const double *target_points_ptr,
324 const int64_t *correspondence_indices,
void ComputePosePointToPlaneCPU(const core::Tensor &source_points, const core::Tensor &target_points, const core::Tensor &target_normals, const core::Tensor &correspondence_indices, core::Tensor &pose, float &residual, int &inlier_count, const core::Dtype &dtype, const core::Device &device, const registration::RobustKernel &kernel)
Definition: RegistrationCPU.cpp:117
OPEN3D_HOST_DEVICE bool GetJacobianPointToPlane(int64_t workload_idx, const scalar_t *source_points_ptr, const scalar_t *target_points_ptr, const scalar_t *target_normals_ptr, const int64_t *correspondence_indices, scalar_t *J_ij, scalar_t &r)
Definition: RegistrationImpl.h:118
void ComputeInformationMatrixCPU(const core::Tensor &target_points, const core::Tensor &correspondence_indices, core::Tensor &information_matrix, const core::Dtype &dtype, const core::Device &device)
Definition: RegistrationCPU.cpp:487
void ComputePoseColoredICPCPU(const core::Tensor &source_points, const core::Tensor &source_colors, const core::Tensor &target_points, const core::Tensor &target_normals, const core::Tensor &target_colors, const core::Tensor &target_color_gradients, const core::Tensor &correspondence_indices, core::Tensor &pose, float &residual, int &inlier_count, const core::Dtype &dtype, const core::Device &device, const registration::RobustKernel &kernel, const double &lambda_geometric)
Definition: RegistrationCPU.cpp:228
#define OPEN3D_HOST_DEVICE
Definition: CUDAUtils.h:63
OPEN3D_HOST_DEVICE bool GetJacobianColoredICP(const int64_t workload_idx, const scalar_t *source_points_ptr, const scalar_t *source_colors_ptr, const scalar_t *target_points_ptr, const scalar_t *target_normals_ptr, const scalar_t *target_colors_ptr, const scalar_t *target_color_gradients_ptr, const int64_t *correspondence_indices, const scalar_t &sqrt_lambda_geometric, const scalar_t &sqrt_lambda_photometric, scalar_t *J_G, scalar_t *J_I, scalar_t &r_G, scalar_t &r_I)
Definition: RegistrationImpl.h:172
void ComputeRtPointToPointCPU(const core::Tensor &source_points, const core::Tensor &target_points, const core::Tensor &corres, core::Tensor &R, core::Tensor &t, int &inlier_count, const core::Dtype &dtype, const core::Device &device)
Definition: RegistrationCPU.cpp:395
Definition: PinholeCameraIntrinsic.cpp:35
OPEN3D_HOST_DEVICE bool GetInformationJacobians(int64_t workload_idx, const scalar_t *target_points_ptr, const int64_t *correspondence_indices, scalar_t *jacobian_x, scalar_t *jacobian_y, scalar_t *jacobian_z)
Definition: RegistrationImpl.h:284