This is a ROS package for map processing. It is used to process the map image file or ROS map topic.
The package currently includes:
- [space volume calculator] (src/calculate_space.cpp): calculate the space volume by extract the acceptable area in the map
The pipelines of each part above will be introduced in the following.
- Aim
To calculate the area and volume by segmenting the map generated by SLAM.
- Pipelines
-
Input map
-
Median blur
Use
cv::medianBlurto smooth the image, remove small holes and measurement errors. -
Threshold
Use
cv::inRangeto keep freespace and obstacles. -
Morphology operation: open
Use
cv::morphologyExwithcv::MORPH_OPENto ignore seperated freespace. -
Morphology operation: close
Use
cv::morphologyExwithcv::MORPH_CLOSEto fill holes. -
Find contour
Use
cv::findContourswithcv::RETR_TREEto find all contours. Then traverse all the contours to find the largest one bycv::contourArea. -
Decide possible freespace
Use
cv::approxPolyDPto fit the largest contour. Then generate the space bycv::fillPoly. -
Exclude non-accessible area
Use
cv::drawContoursto fill those contours larger than theINNER_AREA_THRESH. -
Calculate area and volume
Traverse the freespace image to count the green pixels. Then calculate the space area and volume with the given
RESOLUTIONof the map and the argumentfloor_height. -
Show merged results
Use
cv::addWeightedto add freespace image to the map.
-








