File tree 3 files changed +16
-1
lines changed
dedocutils/data_structures
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1
1
Changelog
2
2
=========
3
+
4
+ v0.2.3 (2023-09-01)
5
+ -------------------
6
+ * Add ` to_relative_dict ` method to ` BBox `
7
+
3
8
v0.2.2 (2023-08-17)
4
9
-------------------
5
10
* Bugfix in ` TesseractDetectorRecognizer `
Original file line number Diff line number Diff line change 1
- 0.2.2
1
+ 0.2.3
Original file line number Diff line number Diff line change @@ -70,6 +70,16 @@ def to_dict(self) -> dict:
70
70
res ["height" ] = self .height
71
71
return res
72
72
73
+ def to_relative_dict (self , page_width : int , page_height : int ) -> dict :
74
+ res = OrderedDict ()
75
+ res ["x_top_left" ] = self .x_top_left / page_width
76
+ res ["y_top_left" ] = self .y_top_left / page_height
77
+ res ["width" ] = self .width / page_width
78
+ res ["height" ] = self .height / page_height
79
+ res ["page_width" ] = page_width
80
+ res ["page_height" ] = page_height
81
+ return res
82
+
73
83
@staticmethod
74
84
def from_dict (some_dict : Dict [str , int ]) -> "BBox" :
75
85
return BBox (** some_dict )
You can’t perform that action at this time.
0 commit comments