# 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.com/teklia/line_image_extractor",
"name": "teklia-line-image-extractor",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "line transformation image extraction",
"author": "Martin Maarand",
"author_email": "maarand@teklia.com",
"download_url": "https://files.pythonhosted.org/packages/7f/90/6a5e1dc45add8825182a44250c17b3e7fb56b640ba4b158dc56c4054b215/teklia-line-image-extractor-0.2.7.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": "",
"summary": "A tool for extracting a text line image from the contour with different methods",
"version": "0.2.7",
"project_urls": {
"Homepage": "https://gitlab.com/teklia/line_image_extractor"
},
"split_keywords": [
"line",
"transformation",
"image",
"extraction"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "98da4e0fc3f5768aea722a8a23c7eea3bd3e49b31c926c26aee5824f29ccd420",
"md5": "00df0c8c95b690a6a4086734d37fd876",
"sha256": "b6c0605e7939d6d7d433373fb5372ecbb0573cd6e42dce81c93cf5fed9c9c0d2"
},
"downloads": -1,
"filename": "teklia_line_image_extractor-0.2.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "00df0c8c95b690a6a4086734d37fd876",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8866,
"upload_time": "2022-11-30T10:28:04",
"upload_time_iso_8601": "2022-11-30T10:28:04.379022Z",
"url": "https://files.pythonhosted.org/packages/98/da/4e0fc3f5768aea722a8a23c7eea3bd3e49b31c926c26aee5824f29ccd420/teklia_line_image_extractor-0.2.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7f906a5e1dc45add8825182a44250c17b3e7fb56b640ba4b158dc56c4054b215",
"md5": "d863b67bdc6e57aea70f56ade5545393",
"sha256": "a78b5d350bcef87448fb647959f1573914083e214cc6816a67908706bd712245"
},
"downloads": -1,
"filename": "teklia-line-image-extractor-0.2.7.tar.gz",
"has_sig": false,
"md5_digest": "d863b67bdc6e57aea70f56ade5545393",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8250,
"upload_time": "2022-11-30T10:28:05",
"upload_time_iso_8601": "2022-11-30T10:28:05.666518Z",
"url": "https://files.pythonhosted.org/packages/7f/90/6a5e1dc45add8825182a44250c17b3e7fb56b640ba4b158dc56c4054b215/teklia-line-image-extractor-0.2.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-11-30 10:28:05",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "teklia",
"gitlab_project": "line_image_extractor",
"lcname": "teklia-line-image-extractor"
}