mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
cloudFromDisparity(): adjusting decimation if not valid with current image size. Standalone: ask user to set other parameters to default if some were set on command line.
This commit is contained in:
@@ -595,10 +595,26 @@ pcl::PointCloud<pcl::PointXYZ>::Ptr cloudFromDisparity(
|
||||
std::vector<int> * validIndices)
|
||||
{
|
||||
UASSERT(imageDisparity.type() == CV_32FC1 || imageDisparity.type()==CV_16SC1);
|
||||
UASSERT(imageDisparity.rows % decimation == 0);
|
||||
UASSERT(imageDisparity.cols % decimation == 0);
|
||||
UASSERT(decimation >= 1);
|
||||
|
||||
if(imageDisparity.rows % decimation != 0 || imageDisparity.cols % decimation != 0)
|
||||
{
|
||||
int oldDecimation = decimation;
|
||||
while(decimation >= 1)
|
||||
{
|
||||
if(imageDisparity.rows % decimation == 0 && imageDisparity.cols % decimation == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
--decimation;
|
||||
}
|
||||
|
||||
if(imageDisparity.rows % oldDecimation != 0 || imageDisparity.cols % oldDecimation != 0)
|
||||
{
|
||||
UWARN("Decimation (%d) is not valid for current image size (depth=%dx%d). Highest compatible decimation used=%d.", oldDecimation, imageDisparity.cols, imageDisparity.rows, decimation);
|
||||
}
|
||||
}
|
||||
|
||||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
|
||||
|
||||
//cloud.header = cameraInfo.header;
|
||||
@@ -686,7 +702,24 @@ pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudFromDisparityRGB(
|
||||
(imageDisparity.type() == CV_32FC1 || imageDisparity.type()==CV_16SC1));
|
||||
UASSERT(imageRgb.channels() == 3 || imageRgb.channels() == 1);
|
||||
UASSERT(decimation >= 1);
|
||||
UASSERT(imageDisparity.rows % decimation == 0 && imageDisparity.cols % decimation == 0);
|
||||
|
||||
if(imageDisparity.rows % decimation != 0 || imageDisparity.cols % decimation != 0)
|
||||
{
|
||||
int oldDecimation = decimation;
|
||||
while(decimation >= 1)
|
||||
{
|
||||
if(imageDisparity.rows % decimation == 0 && imageDisparity.cols % decimation == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
--decimation;
|
||||
}
|
||||
|
||||
if(imageDisparity.rows % oldDecimation != 0 || imageDisparity.cols % oldDecimation != 0)
|
||||
{
|
||||
UWARN("Decimation (%d) is not valid for current image size (depth=%dx%d). Highest compatible decimation used=%d.", oldDecimation, imageDisparity.cols, imageDisparity.rows, decimation);
|
||||
}
|
||||
}
|
||||
|
||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGB>);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user