Skip to content

Calculate the area and volume by segmenting the map generated by SLAM.

Notifications You must be signed in to change notification settings

zhenzhenxiang/calculate_map_freespace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Map Processing package for ROS

Description

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.

Details

Space volume calculator

  • Aim

To calculate the area and volume by segmenting the map generated by SLAM.

  • Pipelines
    • Input map

      Input map

    • Median blur

      Use cv::medianBlur to smooth the image, remove small holes and measurement errors.

      Median blur

    • Threshold

      Use cv::inRange to keep freespace and obstacles.

      Threshold

    • Morphology operation: open

      Use cv::morphologyEx with cv::MORPH_OPEN to ignore seperated freespace.

      White open

    • Morphology operation: close

      Use cv::morphologyEx with cv::MORPH_CLOSE to fill holes.

      White close

    • Find contour

      Use cv::findContours with cv::RETR_TREE to find all contours. Then traverse all the contours to find the largest one by cv::contourArea.

      Contour

    • Decide possible freespace

      Use cv::approxPolyDP to fit the largest contour. Then generate the space by cv::fillPoly.

      Freespace

    • Exclude non-accessible area

      Use cv::drawContours to fill those contours larger than the INNER_AREA_THRESH.

      Freespace without non-accessible

    • Calculate area and volume

      Traverse the freespace image to count the green pixels. Then calculate the space area and volume with the given RESOLUTION of the map and the argument floor_height.

    • Show merged results

      Use cv::addWeighted to add freespace image to the map.

      Merged

About

Calculate the area and volume by segmenting the map generated by SLAM.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published