{"id":28484066,"url":"https://github.com/rapidai/rapidundistort","last_synced_at":"2025-09-10T02:44:57.099Z","repository":{"id":263077973,"uuid":"883521083","full_name":"RapidAI/RapidUnDistort","owner":"RapidAI","description":"修正文档扭曲/模糊/阴影等情况，使用onnx模型简单轻量部署，未来持续跟进最新最好的文档矫正方案和模型,Correct document distortion using a lightweight ONNX model for easy deployment. We will continue to follow and integrate the latest and best document correction solutions and models in the future.","archived":false,"fork":false,"pushed_at":"2024-12-15T09:16:30.000Z","size":35773,"stargazers_count":56,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-07T22:06:19.341Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RapidAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2024-11-05T05:32:22.000Z","updated_at":"2025-05-30T09:16:13.000Z","dependencies_parsed_at":"2025-06-07T22:06:22.021Z","dependency_job_id":"2b99917a-a873-4ea1-93bb-b31f38231ca8","html_url":"https://github.com/RapidAI/RapidUnDistort","commit_stats":null,"previous_names":["joker1212/rapidunwrap","rapidai/rapidunwrap","rapidai/rapidundistort"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/RapidAI/RapidUnDistort","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RapidAI%2FRapidUnDistort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RapidAI%2FRapidUnDistort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RapidAI%2FRapidUnDistort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RapidAI%2FRapidUnDistort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RapidAI","download_url":"https://codeload.github.com/RapidAI/RapidUnDistort/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RapidAI%2FRapidUnDistort/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274402845,"owners_count":25278349,"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","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-06-07T22:06:20.805Z","updated_at":"2025-09-10T02:44:57.089Z","avatar_url":"https://github.com/RapidAI.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cdiv align=\"center\"\u003e\n    \u003ch1\u003e\u003cb\u003e📊RapidUndistort\u003c/b\u003e\u003c/h1\u003e\n  \u003c/div\u003e\n  \u003ca href=\"\"\u003e\u003cimg src=\"https://img.shields.io/badge/Python-\u003e=3.8,\u003c3.13-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://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/RapidAI/TableStructureRec/blob/c41bbd23898cb27a957ed962b0ffee3c74dfeff1/LICENSE\"\u003e\u003cimg alt=\"GitHub\" src=\"https://img.shields.io/badge/license-Apache 2.0-blue\"\u003e\u003c/a\u003e\n\n[English](README_en.md) | 简体中文 \n\u003c/div\u003e\n\n### 最近更新\n\n- **2024.11.15**\n    - 完成初版代码，转换 [UVDoc](https://github.com/tanguymagne/UVDoc) 模型为onnx,完善前后处理\n- **2024.12.15**\n  - 补充去模糊/去阴影/二值化的功能和模型，重新升级为 RapidUndistort\n\n\n### 简介\n\n本仓库用于进行文档扭曲的修正/文档去模糊/文档去阴影/文档二值化等问题 \\ \n提供多种模型和自由组合选择task，支持模型自动下载 \\\n原始pytorch模型来源参考 [致谢](#致谢) \\\n[快速使用](#快速使用) [使用建议](#使用建议) [参数说明](#参数说明) [模型地址](https://www.modelscope.cn/studios/jockerK/DocUnwrap/files)\n\n### 在线体验\n[modelscope](https://www.modelscope.cn/studios/jockerK/DocUnwrap) [huggingface](https://huggingface.co/spaces/Joker1212/RapidUnwrap)\n### 效果展示\n![res_show.jpg](preview1.gif)\n![res_show1.jpg](preview2.gif)\n\n### 安装\n``` python {linenos=table}\n# 建议使用清华源安装 https://pypi.tuna.tsinghua.edu.cn/simple\npip install rapid-undistorted\n```\n\n### 快速使用\n\n``` python {linenos=table}\nimport cv2\n\nfrom rapid_undistorted.inference import InferenceEngine\nimg_path = \"img/demo.jpg\"\nengine = InferenceEngine()\n# 扭曲修正-\u003e去阴影-\u003e去模糊 (指定去模糊模型)\noutput_img, elapse = engine(img_path, [\"unwrap\", \"unshadow\", (\"unblur\", \"OpenCvBilateral\")])\n# 去阴影-\u003e去模糊 (指定去模糊模型)\n#output_img, elapse = engine(img_path, [\"unshadow\", (\"unblur\", \"OpenCvBilateral\")])\n# 默认选择yaml配置文件中第一个unblur模型\n#output_img, elapse = engine(img_path, [\"unshadow\", \"unblur\"])\n# 二值化替代去阴影方法\n#output_img, elapse = engine(img_path, [\"unwrap\", \"binarize\", \"unblur\"])\nprint(f\"doc unwrap elapse:{elapse}\")\ncv2.imwrite(\"result.png\", output_img)\n\n```\n\n### 使用建议\n- 去模糊 NAFDPM 模型和直接使用opencv方法都有适用的情况,最好还是在线实际测试为准\n- 去阴影模型相对于二值化功能更丰富，效果更好，不建议直接使用二值化方法\n\n\n### 参数说明\n#### 初始化参数\n支持传入一个config配置文件，声明需要的task类型和对应的模型，以及model path\n```python\nconfig_path = \"configs/config.yaml\"\nengine = InferenceEngine(config_path)\n```\n```yaml\ntasks:\n  unwrap:\n    models:\n      - type: \"UVDoc\"\n        path:\n        use_cuda: false\n        \n  unshadow:\n    models:\n      - type: \"GCDnet\"\n        sub_models:\n          - type: \"GCDnet\"\n            path:\n            use_cuda: false\n            use_dml: false\n          - type: \"DRnet\"\n            path:\n            use_cuda: false\n\n  binarize:\n    models:\n      - type: \"UnetCnn\"\n        path:\n        use_cuda: false\n\n  unblur:\n    models:\n      - type: \"OpenCvBilateral\"\n        path:\n      - type: \"NAFDPM\"\n        path:\n        use_cuda: false\n\n```\n#### 执行参数\n```python\nengine(img_path, task_list)\nengine(img_path, [\"unwrap\", \"unshadow\", (\"unblur\", \"OpenCvBilateral\")])\n```\n\n### 致谢\n\nunwrap: [UVDoc](https://github.com/tanguymagne/UVDoc)\nunshadow: [GCDnet](https://github.com/ZZZHANG-jx/GCDRNet)\nunblur: [NAFDPM](https://github.com/ispamm/NAF-DPM)\nbinarize: [UnetCnn](https://github.com/sajjanvsl/U-Net-CNN-for-binarization-of-Historical-Kannada-Handwritten-Palm-Leaf-Manuscripts)\n\n### 贡献指南\n\n欢迎提交请求。对于重大更改，请先打开issue讨论您想要改变的内容。\n\n有其他的好建议和集成场景，作者也会积极响应支持\n\n### 开源许可证\n\n该项目采用[Apache 2.0](https://github.com/RapidAI/TableStructureRec/blob/c41bbd23898cb27a957ed962b0ffee3c74dfeff1/LICENSE)\n开源许可证。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapidai%2Frapidundistort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frapidai%2Frapidundistort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapidai%2Frapidundistort/lists"}