10 {
throw "Not implemented"; }
13 {
throw "Not implemented"; }
19 size_(
Vec3f::all(3.f)), pose_(
Affine3f::Identity()), gradient_delta_factor_(0.75f), raycast_step_factor_(0.75f)
27 int voxels_number = dims_[0] * dims_[1] * dims_[2];
28 data_.create(voxels_number *
sizeof(
int));
29 setTruncDist(trunc_dist_);
38 return Vec3f(size_[0]/dims_[0], size_[1]/dims_[1], size_[2]/dims_[2]);
46 { size_ = size; setTruncDist(trunc_dist_); }
52 Vec3f vsz = getVoxelSize();
53 float max_coeff = std::max<float>(std::max<float>(vsz[0], vsz[1]), vsz[2]);
54 trunc_dist_ = std::max (distance, 2.1f * max_coeff);
59 return data_.ptr<ushort2>() + x + y*dim_x + z*dim_y*dim_x;
76 device::Vec3f vsz = device_cast<device::Vec3f>(getVoxelSize());
85 device::Vec3f vsz = device_cast<device::Vec3f>(getVoxelSize());
88 offset_c.x = offset[0];
89 offset_c.y = offset[1];
90 offset_c.z = offset[2];
92 device::TsdfVolume volume((ushort2*)data_.ptr<ushort2>(), dims, vsz, trunc_dist_, max_weight_);
98 Affine3f vol2cam = camera_pose.inv() * pose_;
103 device::Vec3f vsz = device_cast<device::Vec3f>(getVoxelSize());
114 Affine3f cam2vol = pose_.inv() * camera_pose;
117 device::Mat3f Rinv = device_cast<device::Mat3f>(cam2vol.rotation().inv(cv::DECOMP_SVD));
122 device::Vec3f vsz = device_cast<device::Vec3f>(getVoxelSize());
125 device::raycast(volume, buffer, aff, Rinv, reproj, depth, n, raycast_step_factor_, gradient_delta_factor_);
134 Affine3f cam2vol = pose_.inv() * camera_pose;
137 device::Mat3f Rinv = device_cast<device::Mat3f>(cam2vol.rotation().inv(cv::DECOMP_SVD));
142 device::Vec3f vsz = device_cast<device::Vec3f>(getVoxelSize());
145 device::raycast(volume, buffer, aff, Rinv, reproj,
p, n, raycast_step_factor_, gradient_delta_factor_);
150 enum { DEFAULT_CLOUD_BUFFER_SIZE = 10 * 1000 * 1000 };
152 if (cloud_buffer.
empty ())
153 cloud_buffer.
create (DEFAULT_CLOUD_BUFFER_SIZE);
158 device::Vec3f vsz = device_cast<device::Vec3f>(getVoxelSize());
161 device::TsdfVolume volume((ushort2*)data_.ptr<ushort2>(), dims, vsz, trunc_dist_, max_weight_);
173 device::Vec3f vsz = device_cast<device::Vec3f>(getVoxelSize());
175 device::Mat3f Rinv = device_cast<device::Mat3f>(pose_.rotation().inv(cv::DECOMP_SVD));
177 device::TsdfVolume volume((ushort2*)data_.ptr<ushort2>(), dims, vsz, trunc_dist_, max_weight_);
187 enum { DEFAULT_CLOUD_BUFFER_SIZE = 10 * 1000 * 1000 };
188 if (cloud_buffer.
empty ())
189 cloud_buffer.
create (DEFAULT_CLOUD_BUFFER_SIZE);
195 deviceGlobalShift.x = globalShift[0];
196 deviceGlobalShift.y = globalShift[1];
197 deviceGlobalShift.z = globalShift[2];
200 minBounds_c.x = minBounds[0];
201 minBounds_c.y = minBounds[1];
202 minBounds_c.z = minBounds[2];
205 maxBounds_c.x = maxBounds[0];
206 maxBounds_c.y = maxBounds[1];
207 maxBounds_c.z = maxBounds[2];
209 device::Vec3f vsz = device_cast<device::Vec3f>(getVoxelSize());
212 device::TsdfVolume volume((ushort2*)data_.ptr<ushort2>(), dims, vsz, trunc_dist_, max_weight_);
214 size_t size =
extractSliceAsCloud (volume, buffer, minBounds_c, maxBounds_c, deviceGlobalShift, aff, b);