{"id":16556555,"url":"https://github.com/asadullah-dal17/utils","last_synced_at":"2026-04-18T09:31:40.691Z","repository":{"id":158761378,"uuid":"392864980","full_name":"Asadullah-Dal17/utils","owner":"Asadullah-Dal17","description":"draw text with better readability OpenCV python (backgrounded text), Draw shapes with controlled transparency using OpenCV-python only, like rectangle, :green_square: custom shape fillPoly :small_red_triangle: , with opacity  ","archived":false,"fork":false,"pushed_at":"2021-08-10T10:16:12.000Z","size":135,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T22:22:32.865Z","etag":null,"topics":["opencv"],"latest_commit_sha":null,"homepage":"","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/Asadullah-Dal17.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-08-05T01:10:32.000Z","updated_at":"2023-05-16T07:24:04.000Z","dependencies_parsed_at":"2023-08-25T03:46:04.840Z","dependency_job_id":null,"html_url":"https://github.com/Asadullah-Dal17/utils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Asadullah-Dal17/utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asadullah-Dal17%2Futils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asadullah-Dal17%2Futils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asadullah-Dal17%2Futils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asadullah-Dal17%2Futils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Asadullah-Dal17","download_url":"https://codeload.github.com/Asadullah-Dal17/utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asadullah-Dal17%2Futils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268636401,"owners_count":24282084,"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-08-03T02:00:12.545Z","response_time":2577,"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":["opencv"],"created_at":"2024-10-11T20:05:01.665Z","updated_at":"2026-04-18T09:31:35.671Z","avatar_url":"https://github.com/Asadullah-Dal17.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# utils\n\u003e These are the helping function, which will help to avoid reparation of code, this it will allow to draw shapes, text, with more prettier way, since we don't have many option opencv, to control the transparency of shape, or draw text with background, just use this, function, and you are good to go. \n\n#### [Blog Post for more details](https://aiphile.blogspot.com/2021/08/draw-transparent-shape-text-with.html)\n---\n## Opencv Text Beautification\n---\n### textWithBackground\n\nThis function Calculates the size of text, using opencv Function, getTextSize, on the base of height and width, we add here the extra padding(x,y) to increase the background, to look it more decent.\n\n\n```Python\n#Call the function\nimg=textWithBackground(img, 'Colored Background Texts', cv.FONT_HERSHEY_COMPLEX, 1.6, (60,70), textThickness=3, bgColor=(0,255,0), textColor=(0,0, 0), bgOpacity=0.5, pad_x=10, pad_y=10)\n\n\n```\n---\n###  textBlurBackground\n\nThe function, calculates the size of input Text and apply some padding (x,y), which is decidable, apply blur to the ROI, and Draws Text upon the blurred background.\n\n```Python\n#Call the function\n textBlurBackground(img, 'Blured Background Text', cv.FONT_HERSHEY_COMPLEX, 1.4, (60, 140),3, (0,255, 0), (71,71), 13, 13)\n\n```\n---\n### *Results of Above Function*\n---\n\n![output](https://user-images.githubusercontent.com/66181793/128294567-046e6fca-3c59-4104-882e-52499cb9d871.png)\n\n\n---\n\n###  Different colors \n----\n|BLACK|WHITE|BLUE|RED|CYAN|YELLOW|MAGENTA|GRAY|GREEN| PURPLE|ORANGE|PINK|\n|-------|--------|------|-----|------|--------|---------|-------|-------|--------|--------|-\n\n\u003cimg src='/images/color_image.png' width='800'\u003e\n\n## Draw shapes with Transparency\n\n### fillPolyTrans\nDraw any Shape with Transparency, the function is similar to Opencv PolyFill, just it takes a list of tuples, instead of numpy array,\nhere you have option to control the Transparency of shape as well, \n\n```python\n# call the function\nimg =fillPolyTrans(img=img, points=points_list, color=(0,255,0), opacity=.5)\n\n```\n\n### rectTrans \n\nThis function allows to draw a rectangle with transparency, similar to opencv rectangle it has opacity \n\n```python\n    # call the function.\n        img=rectTrans(img, pt1=(30, 320), pt2=(160, 260), color=(0,255,255),thickness=-1, opacity=0.6)\n\n```\n\nthis Repository will be updated on regular interval, here I have write code to avoid repeating of code, so I thought it would be great to share with other people, I have blog as will, you get more details of this, blog post.\n\nI have youtube Channel with subscribers ![YouTube Channel Subscribers](https://img.shields.io/youtube/channel/subscribers/UCc8Lx22a5OX4XMxrCykzjbA?style=social), If you can increase that counter, go a head do this for me 😃, just kidding as always ;-)  [AiPhle](https://youtube.come/c/aiphle) is all about Computer Vision, AI and Electronics.\n\nhope you found this helpful,  if you want to ask me any thing then here are my social medias. \n\n## :green_heart: Join Me on Social Media :green_heart:\n\n\u003ca href=\"https://www.youtube.com/c/aiphile\"\u003e \u003cimg alt=\"AiPhile Youtube\" src=\"/icons/youtube-icon.png\"  width=\"40\" height=\"40\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.facebook.com/AIPhile17\"\u003e\n\u003cimg alt=\"AiPhile Facebook\" src=\"icons/face-book-icon.png\"  width=\"40\" height=\"40\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.instagram.com/aiphile17/\"\u003e \u003cimg alt=\"AiPhile Insta\" src=\"icons/instagram-icon.png\"  width=\"40\" height=\"40\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/Asadullah-Dal17\"\u003e \u003cimg alt=\"Github\" src=\"icons/github-icon.png\"  width=\"40\" height=\"40\"\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasadullah-dal17%2Futils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasadullah-dal17%2Futils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasadullah-dal17%2Futils/lists"}