This is how I am using cropbox:
Vector4f minVec;
Vector4f maxVec;
getMinMax3D<PointT>(*input_, minVec, maxVec);
PointCloudPtr filteredCloud(new PointCloud<PointT>());
vector<int> filteredIndices;
CropBox<PointT> cropper;
cropper.setMax(maxVec);
cropper.setMin(minVec);
cropper.setInputCloud(input_);
cropper.filter(*filteredCloud);
cropper.filter(filteredIndices);
This produces very strange behaviour, which is when I only filter with a pointcloud it works, but when I use the indices vector both cases fail and when I remove the indices case the pointcloud case also fails!
I'm no sure what could cause this. I am using pcl 1.8.0 on ubuntu.
When I use CropBox<PointT> cropper(true); instead this works, Although I'm not sure why should extract_removed_indices be set to true here since I didn't remove any indices previously.
But this still doesn't work when I use it on a cloud that's been transformed before.
I am facing exact the same problem .
pcl::CropBox<PointNT> cropBox;
cropBox.setInputCloud(scene);
cropBox.setTranslation(averageV);
cropBox.setMin(minV);
cropBox.setMax(maxV);
cropBox.filter(*cropedPC);
CropedPC result is not as expected
Any cloud with any indices? Can you construct a small hand crafted point cloud in which you verify the behavior, so we can have a look at it later?
Hi I figure out the reason.
I removed setTranslation(averageV). I have already calculated the cropBox translation in min vector and max vector.
Thanks for your support!
When I use CropBox
cropper(true); instead this works,
This does not work for me either. I am still getting 0 points if I check the indices that have been generated. Any other possibility?
I had same problem with both 16.04+PCL1.8.0 and 16.04+PCL1.8.1.
I solved this issue by -DPCL_ENABLE_SSE:BOOL=FALSE flag for PCL build.
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DPCL_ENABLE_SSE:BOOL=FALSE ..
make -j $(nproc)
sudo make install
I am using the PCL that comes with ROS Kinetic. It still has this problem.
If you are using PCL debian package in Kinetic, it must be PCL 1.7 version, so you may not have this issue.
If you are using PCL 1.8 from source, you should carefully build it with sse flag as above.
@knorth55
Thanks for the reply. I am using the 1.7 version (PCL_VERSION gives me 100702) that comes with ROS. I never built PCL from source.
@TixiaoShan In that case, I have no idea, sorry.
Most helpful comment
I had same problem with both
16.04+PCL1.8.0and16.04+PCL1.8.1.I solved this issue by
-DPCL_ENABLE_SSE:BOOL=FALSEflag forPCLbuild.