赛派号

压力表25和16的区别 Metadata

coordinates

Some document types support location data for the elements, usually in the form of bounding boxes. If it exists, an element’s location data is ailable with elementadata.coordinates.

The coordinates property of an ElementMetadata stores:

points : These specify the corners of the bounding box starting from the top left corner and proceeding counter-clockwise. The points represent pixels, the origin is in the top left and the y coordinate increases in the downward direction.

system: The points he an associated coordinate system. A typical example of a coordinate system is PixelSpace, which is used for representing the coordinates of images. The coordinate system has a name, orientation, layout width, and layout height.

Information about the element’s coordinates (including the coordinate system name, coordinate points, the layout width, and the layout height) can be accessed with element.to_dict()[“metadata”][“coordinates”].

The coordinates of an element can be changed to a new coordinate system by using the Element.convert_coordinates_to_new_system method. If the in_place flag is True, the coordinate system and points of the element are updated in place and the new coordinates are returned. If the in_place flag is False, only the altered coordinates are returned.

from unstructured.documents.elements import Element from unstructured.documents.coordinates import PixelSpace, RelativeCoordinateSystem coordinates = ((10, 10), (10, 100), (200, 100), (200, 10)) coordinate_system = PixelSpace(width=850, height=1100) element = Element(coordinates=coordinates, coordinate_system=coordinate_system) print(elementadata.coordinates.to_dict()) print(elementadata.coordinates.system.orientation) print(elementadata.coordinates.system.width) print(elementadata.coordinates.system.height) element.convert_coordinates_to_new_system(RelativeCoordinateSystem(), in_place=True) # Should now be in terms of new coordinate system print(elementadata.coordinates.to_dict()) print(elementadata.coordinates.system.orientation) print(elementadata.coordinates.system.width) print(elementadata.coordinates.system.height)

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至lsinopec@gmail.com举报,一经查实,本站将立刻删除。

上一篇 没有了

下一篇没有了