{"id":21250912,"url":"https://github.com/natlee/blur-generator","last_synced_at":"2025-07-11T01:31:44.322Z","repository":{"id":58526728,"uuid":"367014050","full_name":"NatLee/Blur-Generator","owner":"NatLee","description":"Generate blur image with 3 types of blur `motion`, `lens`, and `gaussian` by using OpenCV.","archived":false,"fork":false,"pushed_at":"2024-05-16T08:48:29.000Z","size":19151,"stargazers_count":55,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-20T04:33:04.709Z","etag":null,"topics":["blur","blur-filter","blur-generator","blur-image","blur-image-converter","blurred-images","blurring-images","cli","cli-app","cli-tool","depth","depth-camera","depth-image","depth-map","gaussian-blur","lens-blur","motion-blur","python3"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/BlurGenerator/","language":"Python","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/NatLee.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":"2021-05-13T10:29:46.000Z","updated_at":"2024-10-18T23:46:09.000Z","dependencies_parsed_at":"2024-11-20T04:31:07.277Z","dependency_job_id":null,"html_url":"https://github.com/NatLee/Blur-Generator","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLee%2FBlur-Generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLee%2FBlur-Generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLee%2FBlur-Generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLee%2FBlur-Generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NatLee","download_url":"https://codeload.github.com/NatLee/Blur-Generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225669684,"owners_count":17505363,"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":["blur","blur-filter","blur-generator","blur-image","blur-image-converter","blurred-images","blurring-images","cli","cli-app","cli-tool","depth","depth-camera","depth-image","depth-map","gaussian-blur","lens-blur","motion-blur","python3"],"created_at":"2024-11-21T03:39:34.293Z","updated_at":"2024-11-21T03:39:34.860Z","avatar_url":"https://github.com/NatLee.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blur Generator\n\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/BlurGenerator.svg)](https://pypi.python.org/pypi/BlurGenerator/)[![PyPI implementation](https://img.shields.io/pypi/implementation/BlurGenerator.svg)](https://pypi.python.org/pypi/BlurGenerator/)\n\n[![Test](https://github.com/NatLee/Blur-Generator/actions/workflows/test.yml/badge.svg)](https://github.com/NatLee/Blur-Generator/actions/workflows/test.yml)[![Release](https://github.com/NatLee/Blur-Generator/actions/workflows/release.yml/badge.svg)](https://github.com/NatLee/Blur-Generator/actions/workflows/release.yml)\n\n[![PyPI status](https://img.shields.io/pypi/status/BlurGenerator.svg)](https://pypi.python.org/pypi/BlurGenerator/)[![PyPI license](https://img.shields.io/pypi/l/BlurGenerator.svg)](https://pypi.python.org/pypi/BlurGenerator/)\n\n[![PyPI version fury.io](https://badge.fury.io/py/BlurGenerator.svg)](https://pypi.python.org/pypi/BlurGenerator/)\n\n[![PyPI download month](https://img.shields.io/pypi/dm/BlurGenerator.svg)](https://pypi.python.org/pypi/BlurGenerator/)[![PyPI download week](https://img.shields.io/pypi/dw/BlurGenerator.svg)](https://pypi.python.org/pypi/BlurGenerator/)[![PyPI download day](https://img.shields.io/pypi/dd/BlurGenerator.svg)](https://pypi.python.org/pypi/BlurGenerator/)\n\n[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)\n\nThis tool is for generating blur on images.\n\nThere are 3 types of blur modes of `motion`, `lens`, or `gaussian`.\n\nWe can use the results on model training or something else.\n\n\u003e You can find a simply use case with deep learning in https://github.com/NatLee/simply-blur-detector\n\n## Installation\n\n```bash\npip install blurgenerator\n```\n\nCheck it on [Pypi](https://pypi.org/project/BlurGenerator/).\n\n## Usage\n\n```bash\nblurgenerator --help\n```\n\n```bash\nusage: blurgenerator [-h] [--input INPUT] [--input_depth_map INPUT_DEPTH_MAP] [--output OUTPUT] [--type TYPE] [--motion_blur_size MOTION_BLUR_SIZE] [--motion_blur_angle MOTION_BLUR_ANGLE] [--lens_radius LENS_RADIUS] [--lens_components LENS_COMPONENTS]\n                     [--lens_exposure_gamma LENS_EXPOSURE_GAMMA] [--gaussian_kernel GAUSSIAN_KERNEL] [--depth_num_layers DEPTH_NUM_LAYERS] [--depth_min_blur DEPTH_MIN_BLUR] [--depth_max_blur DEPTH_MAX_BLUR]\n                        Size for motion blur. Default is 100.\n  --motion_blur_angle MOTION_BLUR_ANGLE\n                        Angle for motion blur. Default is 30.\n  --lens_radius LENS_RADIUS\n                        Radius for lens blur. Default is 5.0.\n  --lens_components LENS_COMPONENTS\n                        Components for lens blur. Default is 4.\n  --lens_exposure_gamma LENS_EXPOSURE_GAMMA\n                        Exposure gamma for lens blur. Default is 2.\n  --gaussian_kernel GAUSSIAN_KERNEL\n                        Kernel for gaussian. Default is 100.\n  --depth_num_layers DEPTH_NUM_LAYERS\n                        Layer for depth blur. Default is 3.\n  --depth_min_blur DEPTH_MIN_BLUR\n                        Min. blur for depth blur. Default is 1.\n  --depth_max_blur DEPTH_MAX_BLUR\n                        Max. blur for depth blur. Default is 100.\n```\n\n## Example and Result\n\n### Common use\n\n- Original image\n\n![original image](https://github.com/NatLee/Blur-Generator/raw/main/doc/test.png)\n\n#### Usage\n\n- Motion blur\n\n`blurgenerator --type motion --input ./doc/test.png --output ./doc/motion.png`\n\n```python\nimport cv2\nfrom blurgenerator import motion_blur\nimg = cv2.imread('test.png')\nresult = motion_blur(img, size=100, angle=30)\ncv2.imwrite('./output.png', result)\n```\n\n![motion blur image](https://github.com/NatLee/Blur-Generator/raw/main/doc/motion.png)\n\n- Lens blur\n\n`blurgenerator --type lens --input ./doc/test.png --output ./doc/lens.png`\n\n```python\nimport cv2\nfrom blurgenerator import lens_blur\nimg = cv2.imread('test.png')\nresult = lens_blur(img, radius=5, components=4, exposure_gamma=2)\ncv2.imwrite('./output.png', result)\n```\n\n![lens blur image](https://github.com/NatLee/Blur-Generator/raw/main/doc/lens.png)\n\n- Gaussian blur\n\n`blurgenerator --type gaussian --input ./doc/test.png --output ./doc/gaussian.png`\n\n```python\nimport cv2\nfrom blurgenerator import gaussian_blur\nimg = cv2.imread('test.png')\nresult = gaussian_blur(img, 100)\ncv2.imwrite('./output.png', result)\n```\n\n![gaussian blur image](https://github.com/NatLee/Blur-Generator/raw/main/doc/gaussian.png)\n\n### With depth map\n\nFeature from this [issue](https://github.com/NatLee/Blur-Generator/issues/1).\n\n- Original image\n\n![photo](https://github.com/NatLee/Blur-Generator/raw/main/doc/depth-test.jpg)\n\n- Depth map\n\n![depth map](https://github.com/NatLee/Blur-Generator/raw/main/doc/depth-map-test.png)\n\n#### Usage\n\n- Motion blur with depth map\n\n`blurgenerator --input .\\doc\\depth-test.jpg --type motion --input_depth_map .\\doc\\depth-map-test.png --depth_num_layers 5 --depth_min_blur 1 --depth_max_blur 50 --output .\\doc\\depth-motion-output.png`\n\n```python\nimport cv2\nfrom blurgenerator import motion_blur_with_depth_map\nimg = cv2.imread('test.jpg')\ndepth_img = cv2.imread('test-depth.png')\nresult = motion_blur_with_depth_map(\n   img,\n   depth_map=depth_img,\n   angle=30,\n   num_layers=10,\n   min_blur=1,\n   max_blur=50\n)\ncv2.imwrite('./output.png', result)\n```\n\n![depth motion blur image](https://github.com/NatLee/Blur-Generator/raw/main/doc/depth-motion-output.png)\n\n- Lens blur with depth map\n\n`blurgenerator --input .\\doc\\depth-test.jpg --type lens --input_depth_map .\\doc\\depth-map-test.png --depth_num_layers 3 --depth_min_blur 1 --depth_max_blur 50 --output .\\doc\\depth-lens-output.png`\n\n```python\nimport cv2\nfrom blurgenerator import lens_blur_with_depth_map\nimg = cv2.imread('test.jpg')\ndepth_img = cv2.imread('test-depth.png')\nresult = lens_blur_with_depth_map(\n   img,\n   depth_map=depth_img,\n   components=5,\n   exposure_gamma=5,\n   num_layers=10,\n   min_blur=1,\n   max_blur=50\n)\ncv2.imwrite('./output.png', result)\n```\n\n![depth lens blur image](https://github.com/NatLee/Blur-Generator/raw/main/doc/depth-lens-output.png)\n\n- Gaussian blur with depth map\n\n`blurgenerator --input .\\doc\\depth-test.jpg --type gaussian --input_depth_map .\\doc\\depth-map-test.png --depth_num_layers 3 --depth_min_blur 1 --depth_max_blur 50 --output .\\doc\\depth-gaussian-output.png`\n\n```python\nimport cv2\nfrom blurgenerator import gaussian_blur_with_depth_map\nimg = cv2.imread('test.jpg')\ndepth_img = cv2.imread('test-depth.png')\nresult = gaussian_blur_with_depth_map(\n   img,\n   depth_map=depth_img,\n   sigma=5,\n   num_layers=10,\n   min_blur=1,\n   max_blur=50\n)\ncv2.imwrite('./output.png', result)\n```\n\n![depth gaussian blur image](https://github.com/NatLee/Blur-Generator/raw/main/doc/depth-gaussian-output.png)\n\n## Contributor\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/NatLee\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/10178964?v=3?s=100\" width=\"100px;\" alt=\"Nat Lee\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNat Lee\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n## Reference\n\n- [Circularly symmetric convolution and lens blur](http://yehar.com/blog/?p=1495)\n\n\n## LICENSE\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatlee%2Fblur-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatlee%2Fblur-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatlee%2Fblur-generator/lists"}