{"id":20977039,"url":"https://github.com/githubharald/deslantimg","last_synced_at":"2025-05-14T14:31:51.380Z","repository":{"id":46009235,"uuid":"118974104","full_name":"githubharald/DeslantImg","owner":"githubharald","description":"The deslanting algorithm sets text upright in images. Python, C++ and OpenCL implementations provided. ","archived":false,"fork":false,"pushed_at":"2021-11-21T11:16:46.000Z","size":605,"stargazers_count":135,"open_issues_count":0,"forks_count":39,"subscribers_count":9,"default_branch":"master","last_synced_at":"2023-11-07T18:15:18.965Z","etag":null,"topics":["c-plus-plus","gpu","handwriting-recognition","image-processing","ocr","opencl","opencv","preprocessing","python"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/githubharald.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-25T22:16:04.000Z","updated_at":"2023-11-02T20:10:56.000Z","dependencies_parsed_at":"2022-09-14T23:33:45.436Z","dependency_job_id":null,"html_url":"https://github.com/githubharald/DeslantImg","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubharald%2FDeslantImg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubharald%2FDeslantImg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubharald%2FDeslantImg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubharald%2FDeslantImg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/githubharald","download_url":"https://codeload.github.com/githubharald/DeslantImg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225297832,"owners_count":17452010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","gpu","handwriting-recognition","image-processing","ocr","opencl","opencv","preprocessing","python"],"created_at":"2024-11-19T04:57:07.772Z","updated_at":"2024-11-19T04:57:08.255Z","avatar_url":"https://github.com/githubharald.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deslanting Algorithm\n\n* **Update 2021/2: added Python package**\n* **Update 2021/1: added Python implementation**\n\nThis algorithm sets handwritten text in images upright, i.e. it removes the cursive writing style. One can use it as a\npreprocessing step for handwritten text recognition. The following illustration shows input and output of the algorithm\nfor a given image (`data/test1.png`).\n\n![deslanting](doc/example.png)\n\nThere are three implementations provided (Python, C++, OpenCL) with a focus on the Python implementation. For C++\nand OpenCL see the folder [extras](extras).\n\n## Installation\n\n* Go to the root level of the repository\n* Install by running `pip install .`\n* Run `deslant_img` (without arguments) from the command line to process the images in the `data` directory (images\n  taken from IAM and Bentham dataset)\n* This opens a window showing the input image, deslanted image and score values\n* The script can be configured via command line, see available options below, or by\n  running `deslant_img -h`\n\n![plot](doc/plot.png)\n\n## Usage\n\nCommand line options of `deslant_img`:\n\n```\nusage: deslant_img [-h] [--data DATA] [--optim_algo {grid,powell}]\n                   [--lower_bound LO] [--upper_bound HI]\n                   [--num_steps STEPS] [--bg_color BG]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --data DATA           directory containing the (.png|.jpg|.bmp) input images\n  --optim_algo {grid,powell}\n                        either do grid search, or apply Powell's derivative-\n                        free optimizer\n  --lower_bound LO      lower bound of shear values\n  --upper_bound HI      upper bound of shear values\n  --num_steps STEPS     if grid search is used, this argument defines the\n                        number if grid points\n  --bg_color BG         color to fill the gaps of the sheared image that is\n                        returned\n```\n\n## API\n\n* Import the `deslant_img` function as shown in the code snippet\n* For documentation of parameters see command line parameters above or use `help(deslant_img)`\n\n````python\nfrom deslant_img import deslant_img\nimport cv2\nimport matplotlib.pyplot as plt\n\nimg = cv2.imread('data/test1.png', cv2.IMREAD_GRAYSCALE)\nres = deslant_img(img)\n\nplt.imshow(res.img)\nplt.show()\n````\n\n## Algorithm\n\nVinciarelli and Luettin describe the algorithm in their [2001 paper](http://dx.doi.org/10.1016/S0167-8655(01)00042-3).\nHere is a short outline of the algorithm:\n\n![algo](doc/algo.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithubharald%2Fdeslantimg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithubharald%2Fdeslantimg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithubharald%2Fdeslantimg/lists"}