docs: def from_points(points, box_type='bb'):
          """
          Interpret a given point cloud as a RotatedBox, using PCA to determine the potential orientation (the longest component becomes width)
          This is basically an approximate version of a min-area-rectangle algorithm.
          TODO: Test whether using a true min-area-rectangle algorithm would be more precise or faster.
  
          :param points: An n x 2 numpy array of coordinates.
          :param box_type: The kind of method used to estimate the "box".
              Possible values:
                  - `'bb'`, denoting the "bounding box" approach (min/max coordinates of the points correspond to box limits)
                  - `'mrz`, denoting a slightly modified technique, suited for MRZ zone detection from contour images.
                            Here the assumption is that the upper and lower bounds of the box are better estimated as the
                            10% and 90% quantile of the corresponding coordinates (rather than 0% and 100%, i.e. min and max).
                            This helps against accidental noise in the contour.
                            The `'mrz'` correction is only applied when there are at least 10 points in the set.
          :returns: a RotatedBox, bounding the given set of points, oriented according to the principal components.
  
          >>> RotatedBox.from_points([[0,0]])
          RotatedBox(cx=0.0, cy=0.0, width=0.0, height=0.0, angle=0.0)
          >>> assert RotatedBox.from_points([[0,0], [1,1], [2,2]]).approx_equal([1, 1], np.sqrt(8), 0, np.pi/4)
          >>> assert RotatedBox.from_points([[0,0], [1,1], [0,1], [1,0]]).approx_equal([0.5, 0.5], 1, 1, 0.0) # The angle is rather arbitrary here
          >>> assert RotatedBox.from_points([[0,0], [2,1], [0,1], [2,0]]).approx_equal([1, 0.5], 2, 1, 0)
          >>> assert RotatedBox.from_points([[0,0], [2,4], [0,4], [2,0]]).approx_equal([1, 2], 4, 2, np.pi/2)
          >>> assert RotatedBox.from_points([[0,0], [1,1.5], [2,0]]).approx_equal([1, 0.75], 2, 1.5, 0)
          >>> assert RotatedBox.from_points([[0,0], [0,1], [1,1]]).approx_equal([0.25, 0.75], np.sqrt(2), np.sqrt(2)/2, np.pi/4)
          """
          points = np.asfarray(points)
          if points.shape[0] == 1:
              return RotatedBox(points[0], width=0.0, height=0.0, angle=0.0, points=points)
  
          m = PCA(2).fit(points)
          # Find the angle
          angle = (np.arctan2(m.components_[0,1], m.components_[0,0]) % np.pi)
          if abs(angle - np.pi) < angle:
              # Here the angle is always between -pi and pi
              # If the principal component happened to be oriented so that the angle happens to be > pi/2 by absolute value,
              # we flip the direction
              angle = angle - np.pi if angle > 0 else angle + np.pi
          points_transformed = m.transform(points)
          ll = np.min(points_transformed, 0)
          ur = np.max(points_transformed, 0)
          wh = ur - ll
  
          # Now compute and return the bounding box
          if box_type == 'bb' or (box_type == 'mrz' and points.shape[0] < 10):
              # We know that if we rotate the points around m.mean_, we get a box with bounds ur and ll
              # The center of this box is (ur+ll)/2 + mean, which is not the same as the mean,
              # hence to get the center of the original box we need to "unrotate" this box back.
              return RotatedBox(np.dot(m.components_.T, (ll+ur)/2) + m.mean_, width=wh[0], height=wh[1], angle=angle, points=points)
          elif box_type == 'mrz':
              # When working with MRZ detection from contours, we may have minor "bumps" in the contour,
              # that should be ignored at least along the long ("horizontal") side.
              # To do that, we will use 10% and 90% quantiles as the bounds of the box instead of the max and min.
              # We drop all points which lie beyond and simply repeat the estimation (now 'bb-style') without them.
              h_coord = sorted(points_transformed[:,1])
              n = len(h_coord)
              bottom, top = h_coord[n/10], h_coord[n*9/10]
              valid_points = np.logical_and(points_transformed[:,1]>=bottom, points_transformed[:,1]<=top)
              rb = RotatedBox.from_points(points[valid_points, :], 'bb')
              rb.points = points
              return rb
          else:
              raise ValueError("Unknown parameter value: box_type=%s" % box_type)