Layout Segmentation Simplifier
Project description
LSS (Layout Segmentation Simplifier)
Install
pip install https://github.com/PonteIneptique/lss/archive/refs/heads/main.zip
Use
Generic use
from lss.parsers import PageXML
file = PageXML(
# Path to your file
"data/0029_Main_frame.xml",
# Optional: set-up the namespace, as they tend to change a lot
namespace="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"
)
# Simplify your baseline: things within 10% of your line height will be discarded (Seems to be a good number)
file.simplify_lines(ratio=.10)
# Simplify your baseline: things within 15% of your mask height will be discarded (Seems to be a good number)
file.simplify_masks(ratio=.15)
# Write the new file
file.write(suffix="simple")
# A new file named 00029_Main_frame.simple.xml is born
# You can also retrieve the modified xml in
file.xml
Qualitatively search for best parameters
You can also get it to make multiple simulation, to chose the best value (highest ratio = bigger simplification)
from lss.parsers import PageXML
page = PageXML("./data/0002_Main_frame.xml")
page.find_namespace()
page.test_values([(.05, .05), (.1, .1), (.15, .15), (.20, .20)], image_path="./data/0002_Main_frame.jpg")
In this context, lines will be simplified by a ratio of 0.05, 0.10, 0.15 and 0.20. Mask will be as well. Few files will be saved. Each test will create test files with overlays (cf. folder data for all examples):
Original | 15% ratio on both line and masks |
---|---|
10% | 20% |
---|---|
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file layouts-segmentation-simplifier-0.0.1.tar.gz
.
File metadata
- Download URL: layouts-segmentation-simplifier-0.0.1.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67793de4f3647fc109277a81cd319100ec0bc6b0c870d33f1718bc1041c6bc5b |
|
MD5 | 475ff8220156904df0e5dafa3871f93f |
|
BLAKE2b-256 | 856157ac98093b04de2700d005dd8793799de9bcb8f4ec1e3cdd5179b3bc3ff0 |
File details
Details for the file layouts_segmentation_simplifier-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: layouts_segmentation_simplifier-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | adf4b814a764067366820bbf7eda78c1c5aa1398fb5386ac82bce27066ab175d |
|
MD5 | 4927d191f6ffc4f49d127e8348a8d0e2 |
|
BLAKE2b-256 | 4634607b8c01021503be0dd82b915fdeba20817ce5f0de7d0c3fbb0d5cc30651 |