Skip to main content

Line image extractor

This is a tool and a library to be used for extracting line images. Built by Teklia and freely available as open-source under the MIT licence.

It supports different extraction methods:

  • boundingRect - bounding rectangle of the line polygon
  • polygon - exact polygon
  • min_area_rect - minimum area rectangle containing the polygon
  • deskew_polygon - deskew the polygon
  • deskew_min_area_rect - deskew the minimum area rectangle
  • skew_polygon - skew the polygon (rotate by some angle)
  • skew_min_area_rect - skew the minimum area rectangle (rotate by some angle)

Install the library using stable version from Pypi:

pip install teklia-line-image-extractor

Install the library in development mode:

pip install -e .

Test extraction:

line-image-extractor -i tests/data/page_img.jpg -o out.jpg -p tests/data/line_polygon.json -e deskew_min_area_rect --color

How to use it?:

from pathlib import Path
import numpy as np
from line_image_extractor.extractor import extract, read_img, save_img
from line_image_extractor.image_utils import polygon_to_bbox
from line_image_extractor.image_utils import Extraction

page_img = read_img(Path("tests/data/page_img.jpg"))
polygon = np.asarray([[241, 1169], [2287, 1251], [2252, 1190], [244, 1091], [241, 1169]])
bbox = polygon_to_bbox(polygon)
extracted_img = extract(
    page_img, polygon, bbox, Extraction.polygon
)
save_img("line_output.jpg", extracted_img)

Release files for teklia-line-image-extractor 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for teklia-line-image-extractor 0.8.0
File Size Uploaded
teklia_line_image_extractor-0.8.0.tar.gz 10.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for teklia-line-image-extractor 0.8.0
File Interpreter ABI Platform
teklia_line_image_extractor-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.0 kB

Release files / teklia_line_image_extractor-0.8.0.tar.gz

Download URL teklia_line_image_extractor-0.8.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e613108ad7cca041e6d79d20a84069c65dbd5c276178a69e4cc8ce03e7778862
BLAKE2b-256 checksum
How to use checksums
03eedbb8859cbc244561312aaa77202ec78508d8f900883d1a23988a71892b6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / teklia_line_image_extractor-0.8.0-py3-none-any.whl

Download URL teklia_line_image_extractor-0.8.0-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b05dbf02fb580728738e147ea4f48312485b0f6e1a3f09ba12cdb4712ef77509
BLAKE2b-256 checksum
How to use checksums
ab1f30ea80b895640dede5d5a01b65e2a9551d7dd02d8e3b53819951f210cf4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page