Object shape recognition using rectangle fitting

This is an object shape recognition using rectangle fitting.

https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/Mapping/rectangle_fitting/animation.gif

This example code is based on this paper algorithm:

The algorithm consists of 2 steps as below.

Step1: Adaptive range segmentation

In the first step, all range data points are segmented into some clusters.

We calculate the distance between each range data and the nearest range data, and if this distance is below a certain threshold, it is judged to be in the same cluster. This distance threshold is determined in proportion to the distance from the sensor. This is taking advantage of the general model of distance sensors, which tends to have sparser data distribution as the distance from the sensor increases.

The threshold range is calculated by:

\[r_{th} = R_0 + R_d * r_{origin}\]

where

  • \(r_{th}\): Threashold range

  • \(R_0, R_d\): Constant parameters

  • \(r_{origin}\): Distance from the sensor for a range data.

References