Process of my line-detection based bounding box extraction:

1.      Input: the point cloud of the tea box (extracted from Euclidian clustering, which is placed on the x-y plane after rotation)

‍2.      Using RANSAC line detection to detect one line from the box (which seems always being an edge. Here I have checked all the documents or descriptions of the RANSAC line detection from point cloud library (PCL), very little theoretical information is given. If it is the normal RANSAC line detection algorithm (https://en.wikipedia.org/wiki/RANSAC ), we could not conclude that the checked line is always an edge of the box). The function of the detected line can be got.

3.      Rotating the tea box, in order to make the detected edge parallel to x-axis. Rotation matrix was calculated from the line parameter.

‍4.      Using the function getMinMax3D of the PCL library to calculate the extreme coordinates of the tea box (minimum and maximum x, y, z value of the tea box, from which the L-W-H and the 8 corners can be calculated).

5.    Applying the inverse rotation to the tea box. We can get the coordinates of the 8 corners and the size of the bounding box.