MCPcopy Create free account
hub / github.com/Layout-Parser/layout-parser / pad

Method pad

src/layoutparser/elements/layout_elements.py:717–728  ·  view source on GitHub ↗
(self, left=0, right=0, top=0, bottom=0, safe_mode=True)

Source from the content-addressed store, hash-verified

715 raise Exception(f"Invalid input type {other.__class__} for other")
716
717 def pad(self, left=0, right=0, top=0, bottom=0, safe_mode=True):
718
719 x_1 = self.x_1 - left
720 y_1 = self.y_1 - top
721 x_2 = self.x_2 + right
722 y_2 = self.y_2 + bottom
723
724 if safe_mode:
725 x_1 = max(0, x_1)
726 y_1 = max(0, y_1)
727
728 return self.__class__(x_1, y_1, x_2, y_2)
729
730 def shift(self, shift_distance=0):
731

Callers 1

test_rectangleFunction · 0.95

Calls

no outgoing calls

Tested by 1

test_rectangleFunction · 0.76