Comments (4)
Very interesting. I recall someone finding an off-by-one indexing error in older code; perhaps the "fix" for that wound up breaking the reconstructed surface. Let me take a look!
from cpu_tsdf.
Indeed. I did manage to fix it recently.
I do not have the diff handy, but these are the changes I had to make
In tsdf_volume_octree.cpp(Note the additional + 0.5):
pcl::PointXYZ
cpu_tsdf::TSDFVolumeOctree::getVoxelCenter (size_t x, size_t y, size_t z) const
{
// return voxel_centers_->at (x*(yres_*zres_) + y*zres_ + z);
float xoff = xsize_/2.0;
float yoff = ysize_/2.0;
float zoff = zsize_/2.0;
return pcl::PointXYZ ((x + 0.5)*xsize_/(double)xres_ - xoff, (y + 0.5)*ysize_/(double)yres_ - yoff, (z + 0.5)*zsize_/(double)zres_ - zoff);
}
bool
cpu_tsdf::TSDFVolumeOctree::getVoxelIndex (float x, float y, float z, int &x_i, int &y_i, int &z_i) const
{
double xoff = (double)xsize_/2.0;
double yoff = (double)ysize_/2.0;
double zoff = (double)zsize_/2.0;
x_i = std::floor(((double)x + xoff)/((double)xsize_/(double)xres_));
y_i = std::floor(((double)y + yoff)/((double)ysize_/(double)yres_));
z_i = std::floor(((double)z + zoff)/((double)zsize_/(double)zres_));
bool has_voxel = (x_i >= 0 && y_i >= 0 && z_i >= 0
&& x_i < xres_ && y_i < yres_ && z_i < zres_);
return (has_voxel);
}
In here, the pcl cloud point cloud corners have to be pushed outside by half a voxel width
In marching_cubes_tsdf_octree.cpp :
// into voxelizing it the same
pcl::PointCloud<pcl::PointXYZ>::Ptr corner_cloud (new pcl::PointCloud<pcl::PointXYZ>);
for (int x_i = 0; x_i <= res_x; x_i += res_x)
{
for (int y_i = 0; y_i <= res_y; y_i += res_y)
{
for (int z_i = 0; z_i <= res_z; z_i += res_z)
{
pcl::PointXYZ center = tsdf_volume_->getVoxelCenter (x_i, y_i, z_i);
// Go from center to corner
center.x += (x_i == 0 ? -1 : 1) * 0.5 * size_x / res_x + (x_i == 0 ? 1 : -1)*(0.5*tsdf_volume_->xsize_/(double)tsdf_volume_->xres_);
center.y += (y_i == 0 ? -1 : 1) * 0.5 * size_y / res_y + (y_i == 0 ? 1 : -1)*(0.5*tsdf_volume_->xsize_/(double)tsdf_volume_->xres_);
center.z += (z_i == 0 ? -1 : 1) * 0.5 * size_z / res_z + (z_i == 0 ? 1 : -1)*(0.5*tsdf_volume_->xsize_/(double)tsdf_volume_->xres_);
corner_cloud->points.push_back (center);
}
}
}
Additionally, I noticed that voxels which are not leafs were making their way into the updateVoxel() function, which should also be corrected! Cheers
from cpu_tsdf.
Ah, very interesting! Yes, I am 90% sure those "+0.5"s were removed elsewhere, due to some boundary condition. I'll hunt for that; but if you'd like to make a PR for this, I'd be much obliged :).
P.S. apologies for the slow response -- it's been a while since I looked at this codebase, and I don't always notice these github alerts.
from cpu_tsdf.
Related Issues (20)
- Question about tsdf HOT 3
- Reprojection yielded 0 valid points :( HOT 5
- Coordinate frame of point cloud expected HOT 1
- Example data for tests HOT 9
- integrateCloud segmentation faullt HOT 10
- cpu_tsdf cannot compile with pcl 1.8.1 HOT 8
- How to get the pose.txt.... HOT 2
- wrong include path HOT 2
- pcd file format HOT 8
- use of normal vectors HOT 3
- Linker Error with boost::program_options (Boost 1.57.0 & PCL 1.9.0) HOT 1
- build with pcl 1.8.1 failure HOT 6
- is the hpp file:tsdf_volume_octree.hpp any useful in this project? HOT 1
- complied error with pcl1.10
- This project depend on which version of pcl HOT 1
- Can't generate tsdf2mesh executable when I switch pcl version to pcl 1.10 HOT 1
- Core dumped when I run integrate HOT 1
- rtabmap+cputsdf+pcl1.8.1 HOT 2
- How to run my local data? HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpu_tsdf.