MRPT / mrpt

:zap: The Mobile Robot Programming Toolkit (MRPT)
https://docs.mrpt.org/reference/latest/
BSD 3-Clause "New" or "Revised" License
1.95k stars 631 forks source link

GridMap Aligner Issue #1098

Closed brunoeducsantos closed 4 years ago

brunoeducsantos commented 4 years ago

Hi @jlblancoc , I have two COccupancyGrid having the following metrics: _MAP1

XMIN= -19.4; YMIN= -19.1
XMAX= -0.9; YMIN= -6.4

_MAP2

XMIN= -19.4; YMIN= -19.1
XMAX= -0.9; YMAX =-6.4

And I am getting the following error:

OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp, line 538
/tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp:538: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat
==== MRPT exception backtrace ====
[5] /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp:538: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat
[4] /home/bruno/tools/mrpt/libs/vision/src/CFeatureExtraction_logPolarImg.cpp:85: [void mrpt::vision::CFeatureExtraction::internal_computeLogPolarImageDescriptors(const mrpt::img::CImage&, mrpt::vision::CFeatureList&)] Called from here.
[3] /home/bruno/tools/mrpt/libs/vision/src/CFeatureExtraction_common.cpp:141: [void mrpt::vision::CFeatureExtraction::computeDescriptors(const mrpt::img::CImage&, mrpt::vision::CFeatureList&, mrpt::vision::TDescriptorType)] Called from here.
[2] /home/bruno/tools/mrpt/libs/slam/src/slam/COccupancyGridMapFeatureExtractor.cpp:74: [static void mrpt::slam::COccupancyGridMapFeatureExtractor::uncached_extractFeatures(const mrpt::maps::COccupancyGridMap2D&, mrpt::maps::CLandmarksMap&, size_t, mrpt::vision::TDescriptorType, const mrpt::vision::CFeatureExtraction::TOptions&)] Called from here.
[1] /home/bruno/tools/mrpt/libs/slam/src/slam/CGridMapAligner.cpp:952: [mrpt::poses::CPosePDF::Ptr mrpt::slam::CGridMapAligner::AlignPDF_robustMatch(const mrpt::maps::CMetricMap*, const mrpt::maps::CMetricMap*, const mrpt::poses::CPosePDFGaussian&, mrpt::slam::CGridMapAligner::TReturnInfo&)] Called from here.
[0] /home/bruno/tools/mrpt/libs/slam/src/slam/CGridMapAligner.cpp:73: [virtual mrpt::poses::CPosePDF::Ptr mrpt::slam::CGridMapAligner::AlignPDF(const mrpt::maps::CMetricMap*, const mrpt::maps::CMetricMap*, const mrpt::poses::CPosePDFGaussian&, mrpt::optional_ref<mrpt::slam::TMetricMapAlignmentResult>)] Called from here.

I can understand why we can't have negativate coordinates. Or is another error?

Thanks, Bruno

brunoeducsantos commented 4 years ago

I am loading the map as follows:

map_grid->loadFromBitmap(*map_image, resolution, origin);