{"id":16881467,"url":"https://github.com/swhl/mergetextboxes","last_synced_at":"2025-04-05T11:44:35.885Z","repository":{"id":223972507,"uuid":"762053258","full_name":"SWHL/MergeTextBoxes","owner":"SWHL","description":"Merge text boxes in the same row or column.","archived":false,"fork":false,"pushed_at":"2024-04-23T14:00:42.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-23T15:26:44.489Z","etag":null,"topics":["text-detection"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SWHL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-23T01:47:11.000Z","updated_at":"2024-04-23T14:00:46.000Z","dependencies_parsed_at":"2024-02-23T02:39:07.575Z","dependency_job_id":"52f57407-91e5-4a4e-93f5-273e7b2dc220","html_url":"https://github.com/SWHL/MergeTextBoxes","commit_stats":null,"previous_names":["swhl/mergetextboxes"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SWHL%2FMergeTextBoxes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SWHL%2FMergeTextBoxes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SWHL%2FMergeTextBoxes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SWHL%2FMergeTextBoxes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SWHL","download_url":"https://codeload.github.com/SWHL/MergeTextBoxes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332525,"owners_count":20921852,"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":["text-detection"],"created_at":"2024-10-13T16:02:40.127Z","updated_at":"2025-04-05T11:44:35.867Z","avatar_url":"https://github.com/SWHL.png","language":"Python","funding_links":["https://www.buymeacoffee.com/SWHL"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cdiv align=\"center\"\u003e\n    \u003ch1\u003e\u003cb\u003eMerge Text Boxes\u003c/b\u003e\u003c/h1\u003e\n  \u003c/div\u003e\n  \u003ca href=\"\"\u003e\u003cimg src=\"https://img.shields.io/badge/Python-\u003e=3.6,\u003c3.12-aff.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"\"\u003e\u003cimg src=\"https://img.shields.io/badge/OS-Linux%2C%20Mac%2C%20Win-pink.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/merge_text_boxes/\"\u003e\u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/merge_text_boxes\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pepy.tech/project/merge_text_boxes\"\u003e\u003cimg src=\"https://static.pepy.tech/personalized-badge/merge_text_boxes?period=total\u0026units=abbreviation\u0026left_color=grey\u0026right_color=blue\u0026left_text=Downloads\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://semver.org/\"\u003e\u003cimg alt=\"SemVer2.0\" src=\"https://img.shields.io/badge/SemVer-2.0-brightgreen\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/psf/black\"\u003e\u003cimg src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/SWHL/MergeTextBoxes/blob/8da071f678d4e3d0681fff8b213a5aa9c1a96073/LICENSE\"\u003e\u003cimg alt=\"GitHub\" src=\"https://img.shields.io/badge/license-Apache 2.0-blue\"\u003e\u003c/a\u003e\n\n  [简体中文](./docs/README_zh.md) | English\n\u003c/div\u003e\n\n### Introduction\nThis repo is mainly used to merge peer text boxes. The code is modified from the [merge_text_boxs](https://github.com/zcswdt/merge_text_boxs) project and further organized and expanded.\n\n### Installation\n```bash\npip install merge_text_boxes\n```\n\n### Usage\n```python\nimport copy\n\nimport cv2\nimport numpy as np\n\nfrom merge_text_boxes import MergeTextBoxes\n\nrects = [\n    [144, 5, 192, 25],\n    [25, 6, 64, 25],\n    [66, 6, 141, 25],\n    [193, 5, 275, 33],\n    [269, 30, 354, 50],\n    [26, 30, 182, 52],\n    [185, 28, 265, 55],\n    [25, 56, 89, 76],\n    [93, 56, 229, 78],\n    [232, 56, 262, 76],\n    [264, 52, 343, 81],\n]\n\nshow_image = np.zeros([100, 500, 3], np.uint8) + 255\n\nconnector = MergeTextBoxes(max_dist=15, overlap_threshold=0.2)\nnew_rects = connector(rects, 500)\n\ntmp_img = copy.deepcopy(show_image)\nfor rect in rects:\n    cv2.rectangle(tmp_img, (rect[0], rect[1]), (rect[2], rect[3]), (0, 0, 255), 1)\ncv2.imwrite(\"origin.png\", tmp_img)\n\nfor rect in new_rects:\n    cv2.rectangle(show_image, (rect[0], rect[1]), (rect[2], rect[3]), (255, 0, 0), 1)\n\ncv2.imwrite(\"res.png\", show_image)\n```\n\n### Visualization\nBefore merging：\n\n![alt text](./docs/origin.png)\n\nAfter merging：\n\n![alt text](./docs/res.png)\n\n\n### Acknowledgements\n- [OCR文字检测框的合并](https://blog.csdn.net/jhsignal/article/details/107840145)\n- [merge_text_boxs](https://github.com/zcswdt/merge_text_boxs)\n\n### Contributing\nPull requests are welcome. For major changes, please open an issue first\nto discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n### [Sponsor](https://rapidai.github.io/RapidOCRDocs/docs/sponsor/)\nIf you want to sponsor the project, you can directly click the **Buy me a coffee** image, please write a note (e.g. your github account name) to facilitate adding to the sponsorship list below.\n\n\u003cdiv align=\"left\"\u003e\n   \u003ca href=\"https://www.buymeacoffee.com/SWHL\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/RapidAI/.github/main/assets/buymeacoffe.png\" width=\"30%\" height=\"30%\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n### License\nThis project is released under the [Apache 2.0 license](../LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswhl%2Fmergetextboxes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswhl%2Fmergetextboxes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswhl%2Fmergetextboxes/lists"}