{"id":23047803,"url":"https://github.com/aman9026/custom-filters","last_synced_at":"2026-05-05T12:32:36.818Z","repository":{"id":101248944,"uuid":"254310864","full_name":"Aman9026/Custom-Filters","owner":"Aman9026","description":"Simple guide with code snippets for creating Custom-Filters by Image-Processing","archived":false,"fork":false,"pushed_at":"2020-04-19T07:05:32.000Z","size":905,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T02:45:40.187Z","etag":null,"topics":["digital-image-processing","filter","filters","guide","image-processing","mlops","numpy","numpy-arrays","opencv","python3","tutorial","tutorial-code"],"latest_commit_sha":null,"homepage":"https://github.com/Aman9026/Custom-Filters","language":null,"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/Aman9026.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2020-04-09T08:12:35.000Z","updated_at":"2020-04-20T05:08:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"a29f8727-38d1-4859-9ed2-d75a7dc9ec7c","html_url":"https://github.com/Aman9026/Custom-Filters","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Aman9026/Custom-Filters","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aman9026%2FCustom-Filters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aman9026%2FCustom-Filters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aman9026%2FCustom-Filters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aman9026%2FCustom-Filters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aman9026","download_url":"https://codeload.github.com/Aman9026/Custom-Filters/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aman9026%2FCustom-Filters/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32649550,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["digital-image-processing","filter","filters","guide","image-processing","mlops","numpy","numpy-arrays","opencv","python3","tutorial","tutorial-code"],"created_at":"2024-12-15T22:37:21.791Z","updated_at":"2026-05-05T12:32:36.797Z","avatar_url":"https://github.com/Aman9026.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# ImageProcessing\n\n![](https://miro.medium.com/max/1400/1*VeUwoUU7wb2T-NDciUuo7w.jpeg)\n\n\n***You are always welcome to optimize or improve any resource in this repository by following [these](https://github.com/Aman9026/ImageProcessing/blob/master/CONTRIBUTING.md) instructions.***\n\n---\n\n**Images:** 2-D representation of the visible light spectrum\n```\nHuman visual system(eye \u0026 visual cortex) is incredibly good at image processing\n```\n\n**Color Spaces:** different method to store image in computer (eg, RGB, HSV, CMYK)\n\n\n**OpenCV:** Open source Computer Vision Software for image processing, OpenCV default color space is RGB, but stores color in BGR format, to improve processing of image operation\n\n\n**HSV:** hue, saturation and value/brightness , is a color space that attempts to represent colors the way humans perceive it, in CV we use for color segmentation\n\n\n\n## Installation\n\nInstall OpenCV by Anaconda:\n ```conda install opencv```\n\nInstall by python installer pip:\n ```pip install opencv-python```\n\n## Adding filters\nWe can add inbuilt filters or create custom filters by ourself, We'll incorporate both here.\n\n***Original Image:***\n![ogimage](https://github.com/Aman9026/Custom-Filters/blob/master/Data/Images/billu.jpeg)\n\n**Now let's add filters to it.**\n\nImport module opencv\n```\n\u003e\u003e\u003e import cv2\n```\n\nOpenCV load image from storage and convert into numpy array:\n```\n\u003e\u003e\u003e photo = cv2.imread('imagename.jpg')\n```\n**We don't need to load numpy module, opencv call its internal property.**\n\nConvert image into gray image:\n\n```\u003e\u003e\u003e gray_image = cv2.cvtColor(photo , cv2.COLOR_BGR2GRAY)```\n\nShow image, but we have use waitKey()  and destroyAllWindows() with imshow(), otherwise program will hang up\n\n```\n\u003e\u003e\u003e cv2.imshow('image title', photo)\n\u003e\u003e\u003e cv2.waitKey()\n\u003e\u003e\u003e cv2.destroyAllWindows()\n```\n\n**waitkey():** used to hold windows for some time interval, and also wait for any key input from keyword, so listen key and then go to next statement\n\n**destroyAllWindows():** close any window, open by imshow()\n\n![grayfilter](https://github.com/Aman9026/Custom-Filters/blob/master/Data/Images/grayscale.jpeg)\n\nA very faster alternative of adding filter by inbuilt functions is by doing it manually in an optimized way. \nWe can convert the image to gray while reading only by a simple trick given below.\n```\n\u003e\u003e\u003e grey_photo = cv2.imread('image.jpg' , 0)\n\n```\n\n## Remove or Amplify a color from image\n\nSplit Color from colorful image:\n\n```\u003e\u003e\u003e B, G, R = cv2.split(photo)```\n\n```\n\u003e\u003e\u003e import numpy as np\n\u003e\u003e\u003e height = photo.shape[0]\n\u003e\u003e\u003e width = photo.shape[1]\n\u003e\u003e\u003e zero = np.zeros((height, width))\n\n\u003e\u003e\u003e cv2.merge([zero, G, R])\n```\n\nIt give error because, array of image require datatype “**unit8**” but zero function create datatype float\n\n```\n\u003e\u003e\u003eB.dtype\ndtype('uint8')\n```\n\nWhat is uint, 8-bit unsigned, here 8 is 8 bit, means 2^8 = 0-255 number we can store in it.\n\nSo if u store “1000”, it won't store this:\n```\u003e\u003e\u003e photo[0][0][0] = \"1000\"```\n\n```\n\u003e\u003e\u003e zero.dtype\ndtype('float64')\n```\n```\n\u003e\u003e\u003e zero_unit8 = zero.astype('uint8')\n\u003e\u003e\u003e new_photo_B_removed = cv2.merge([zero_unit8, G, R])\n```\n```\n\u003e\u003e\u003e cv2.imshow('image title', new_photo_B_removed)\n\u003e\u003e\u003e cv2.waitKey()\n\u003e\u003e\u003e cv2.destroyAllWindows()\n```\n\n**If we want to amplify any color in image, let say green color :**\n```\n\u003e\u003e\u003e new_photo_B_removed = cv2.merge([zero_unit8, G+100, R])\n```\n\n**Same thing done by the code explained above can be done in one line like this:**\n\nIf we want to remove all the colour except **Red**\n\n```\u003e\u003e\u003e photo[:,:,0:2] = 0```\n\n![redblast](https://github.com/Aman9026/Custom-Filters/blob/master/Data/Images/redblast.jpeg)\n\n## Custom filters\nI created a custom filter similar to \"**ambience**\" in popular photo editing applications.\n\nJust amplified BLUE and GREEN by 100 without changing RED.\n\n![ambience](https://github.com/Aman9026/Custom-Filters/blob/master/Data/Images/ambience.jpeg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faman9026%2Fcustom-filters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faman9026%2Fcustom-filters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faman9026%2Fcustom-filters/lists"}