# Line image extractor
This is a tool and a library to be used for extracting line images. Built by [Teklia](https://teklia.com) 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:
```bash
pip install teklia-line-image-extractor
```
Install the library in development mode:
```bash
pip install -e .
```
Test extraction:
```bash
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?:
```python
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)
```
Raw data
{
"_id": null,
"home_page": "https://gitlab.teklia.com/atr/line_image_extractor",
"name": "teklia-line-image-extractor",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "line transformation image extraction",
"author": "Martin Maarand",
"author_email": "maarand@teklia.com",
"download_url": "https://files.pythonhosted.org/packages/ee/92/e4eca272f8018d2fdfe90e9b1253785847551980cc64e3c153f5ad5282e5/teklia_line_image_extractor-0.4.0.tar.gz",
"platform": null,
"description": "# Line image extractor\n\nThis is a tool and a library to be used for extracting line images. Built by [Teklia](https://teklia.com) and freely available as open-source under the MIT licence.\n\nIt supports different extraction methods:\n* boundingRect - bounding rectangle of the line polygon\n* polygon - exact polygon\n* min_area_rect - minimum area rectangle containing the polygon\n* deskew_polygon - deskew the polygon\n* deskew_min_area_rect - deskew the minimum area rectangle\n* skew_polygon - skew the polygon (rotate by some angle)\n* skew_min_area_rect - skew the minimum area rectangle (rotate by some angle)\n\nInstall the library using stable version from Pypi:\n\n```bash\npip install teklia-line-image-extractor\n```\n\nInstall the library in development mode:\n\n```bash\npip install -e .\n```\n\nTest extraction:\n\n```bash\nline-image-extractor -i tests/data/page_img.jpg -o out.jpg -p tests/data/line_polygon.json -e deskew_min_area_rect --color\n```\n\nHow to use it?:\n\n```python\nfrom pathlib import Path\nimport numpy as np\nfrom line_image_extractor.extractor import extract, read_img, save_img\nfrom line_image_extractor.image_utils import polygon_to_bbox\nfrom line_image_extractor.image_utils import Extraction\n\npage_img = read_img(Path(\"tests/data/page_img.jpg\"))\npolygon = np.asarray([[241, 1169], [2287, 1251], [2252, 1190], [244, 1091], [241, 1169]])\nbbox = polygon_to_bbox(polygon)\nextracted_img = extract(\n page_img, polygon, bbox, Extraction.polygon\n)\nsave_img(\"line_output.jpg\", extracted_img)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "A tool for extracting a text line image from the contour with different methods",
"version": "0.4.0",
"project_urls": {
"Homepage": "https://gitlab.teklia.com/atr/line_image_extractor"
},
"split_keywords": [
"line",
"transformation",
"image",
"extraction"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "29b19f25742e7feca596bbfface7be676f65b73bcb553159083151038306760c",
"md5": "42ab5dbba66b6d532f3fdfc7497479b4",
"sha256": "18d25f33cbc8e482153bc7ebcbe262c6117948f0a29872be53c85ec0bf839254"
},
"downloads": -1,
"filename": "teklia_line_image_extractor-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "42ab5dbba66b6d532f3fdfc7497479b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8866,
"upload_time": "2024-08-06T08:14:57",
"upload_time_iso_8601": "2024-08-06T08:14:57.023096Z",
"url": "https://files.pythonhosted.org/packages/29/b1/9f25742e7feca596bbfface7be676f65b73bcb553159083151038306760c/teklia_line_image_extractor-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ee92e4eca272f8018d2fdfe90e9b1253785847551980cc64e3c153f5ad5282e5",
"md5": "d5559d2ad9076f3b2ff838b8c3a73741",
"sha256": "e573d097baad0c22410f37f3f780de8061554eb16fa2839f9e68c0f384987053"
},
"downloads": -1,
"filename": "teklia_line_image_extractor-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "d5559d2ad9076f3b2ff838b8c3a73741",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9837,
"upload_time": "2024-08-06T08:14:58",
"upload_time_iso_8601": "2024-08-06T08:14:58.563462Z",
"url": "https://files.pythonhosted.org/packages/ee/92/e4eca272f8018d2fdfe90e9b1253785847551980cc64e3c153f5ad5282e5/teklia_line_image_extractor-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-06 08:14:58",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "teklia-line-image-extractor"
}