47 cv::Vec3f targetPoint(0,0, distance_camera_target);
48 targetPoint = cam_pose * targetPoint;
49 targetPoint[1] = cam_pose.translation()[1];
54 double dist =
norm(targetPoint, center_cube, cv::NORM_L2);
60 if (result || last_shift || perform_shift)
62 performShift (volume, targetPoint, cam_pose, last_shift, record_mode);
89 minBounds[0] = minBounds[1] = minBounds[2] = 0;
90 maxBounds[0] = maxBounds[1] = maxBounds[2] = 512;
107 std::cout <<
"#### Performing slice number: " <<
slice_count_ <<
" with " << cloud.
size() <<
" TSDF values ####" << std::endl;
110 for(
int i = 0; i < 3; i++)
112 if(minBounds[i] == 1 && !last_shift)
114 fusionShift[i] += maxBounds[i];
115 fusionBackShift[i] += minBounds[i];
119 fusionShift[i] -= 1000000000;
120 fusionBackShift[i] += maxBounds[i];
124 fusionShift[i] += minBounds[i];
125 fusionBackShift[i] += maxBounds[i];
140 volume->clearSlice(&
buffer_, offset);
153 float3 new_cube_origin_meters;
168 volume->setPose(
Affine3f().translate(
Vec3f(new_cube_origin_meters.x, new_cube_origin_meters.y, new_cube_origin_meters.z)));
191 if (minBounds[0] > maxBounds[0])
206 if(minBounds[1] > maxBounds[1])
221 if (minBounds[2] > maxBounds[2])
233 if (minBounds[0] < 0)
240 if (minBounds[1] < 0)
246 if (minBounds[2] < 0)
251 for(
int i = 0; i < 3; i++)
255 if(minBounds[i] == 0)
261 if(maxBounds[i] == 512)
std::vector< ImgPose * > imgPoses_
size_t size() const
Returns size in elements.
double distance_threshold_
distance threshold (cube's center to target point) to trigger shift
void shiftOrigin(cv::Ptr< cuda::TsdfVolume > tsdf_volume, Vec3i offset)
updates cyclical buffer origins given offsets on X, Y and Z
DeviceArray< Point > cloud_buffer_device_
buffer used to extract XYZ values from GPU
int calcIndex(float f) const
__kf_hdevice__ void swap(T &a, T &b)
int3 voxels_size
Number of voxels in the volume, per axis.
std::vector< ImgPose * > imgposes_
void addTSDFSlice(TSDFSlice slice, const bool last_shift)
void computeAndSetNewCubeMetricOrigin(cv::Ptr< cuda::TsdfVolume > volume, const cv::Vec3f &target_point, Vec3i &offset)
Computes and set the origin of the new cube (relative to the world), centered around a the target poi...
bool checkForShift(cv::Ptr< cuda::TsdfVolume > volume, const Affine3f &cam_pose, const double distance_camera_target, const bool perform_shift=true, const bool last_shift=false, const bool record_mode=false)
Check if shifting needs to be performed, returns true if so. Shifting is considered needed if the tar...
void calcBounds(Vec3i &offset, Vec3i &minBounds, Vec3i &maxBounds)
tsdf_buffer buffer_
structure that contains all TSDF buffer's addresses
void download(T *host_ptr) const
Downloads data from internal buffer to CPU memory.
int3 origin_GRID
Internal cube origin for rollign buffer.
float3 volume_size
Size of the volume, in meters.
float3 origin_metric
Current metric origin of the cube, in world coordinates.
void performShift(cv::Ptr< cuda::TsdfVolume > volume, const cv::Vec3f &target_point, const Affine3f &cam_pose, const bool last_shift=false, const bool record_mode=false)
Perform shifting operations: Compute offsets. Extract current slice from TSDF buffer. Extract existing data from world. Clear shifted slice in TSDF buffer. Push existing data into TSDF buffer. Update rolling buffer Update world model.
__kf_device__ float norm(const float3 &v)