{"id":18295401,"url":"https://github.com/gorkhali125/image-processing-algorithms","last_synced_at":"2025-04-09T08:27:43.333Z","repository":{"id":120191819,"uuid":"284696954","full_name":"gorkhali125/image-processing-algorithms","owner":"gorkhali125","description":"Some image processing algorithms written in python from scratch.","archived":false,"fork":false,"pushed_at":"2020-08-08T14:54:49.000Z","size":2991,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T02:42:44.456Z","etag":null,"topics":["image","image-processing","imagemagick","pillow"],"latest_commit_sha":null,"homepage":"https://github.com/gorkhali125/image-processing-algorithms","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/gorkhali125.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}},"created_at":"2020-08-03T12:41:56.000Z","updated_at":"2020-08-08T14:54:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"55ce04da-8570-4874-9ec6-392ce2aeb271","html_url":"https://github.com/gorkhali125/image-processing-algorithms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorkhali125%2Fimage-processing-algorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorkhali125%2Fimage-processing-algorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorkhali125%2Fimage-processing-algorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorkhali125%2Fimage-processing-algorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gorkhali125","download_url":"https://codeload.github.com/gorkhali125/image-processing-algorithms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248002260,"owners_count":21031563,"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":["image","image-processing","imagemagick","pillow"],"created_at":"2024-11-05T14:35:06.270Z","updated_at":"2025-04-09T08:27:43.307Z","avatar_url":"https://github.com/gorkhali125.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image Processing Algorithms\n\nImage processing is a method to perform some operations on an image, in order to get an enhanced image or to extract some useful information from it. Various image processing algorithms are implemented in python3 from scratch. Standard images are used for the implementation.\n\n# Requirement\n\n1. Python3\n2. Pillow\n\n# Installation\n\nInstall PILLOW using pip3\n``` \npip3 install pillow\n```\n\n# Running Algorithms\n\nTo run the algorithms, navigate to the corresponding directory and run the file. Example:\n\n```\npython3 algorithm.py\n```\n\n# Algorithms\n\n## Negative of Image\n\nNegative of an image is a total inversion of original image calculated by simply subtracting each pixel value of an image from the maximum pixel value. For grayscale images, only one band calculation is necessary while for color images, three different bands \"R\", \"G\" and \"B\" needs to be separately negated.\n\nGo to the 'negative_grayscale' or 'negative_color' directory and run:\n```\npython3 negative_grayscale.py OR python3 negative_color.py\n```\n\n## Bit Plane Slicing\n\nEvery pixel of an image has certain gray level represented in bits. For 8-bit image, 0 is represented by 00000000 and 255 by 11111111. The bit in the leftmost side is referred as the MSB (most significant bit) and the one in the rightmost side is referred as the LSB (least significant bit). MSB carries most significant part of the image while LSB has least information of the image.\n\nGo to the 'bit_plane_slicing' directory and run:\n```\npython3 bit_plane_slicing.py\n```\n\n## Contrast Stretching \n\nContrast Stretching also known as Normalization is a method to correct the contrast of an image by stretching the range of contrast values in that image. An image might have gray levels accumulated at some ranges between 0-255, suppose say 40-150 and thus the image doesn't have all the dynamic ranges needed to look sharp. Contrast Stretching aims to stretch those gray level to the whole range 0-255 and the image will look much better.\n\nGo to the 'contrast_stretching' directory and run:\n```\npython3 contrast_stretching.py\n```\nTo check another image, comment line 45 and uncomment line 46 of the file contrast_stretching.py\n\n## Masking\n\nMasking is a method to create a small mask (patch of image, say 3*3 matrix as a patch) and moving that patch throughout the image to modify the whole image. It is an image enhancement technique and this is the main process underneath a lot of image processing methods including blurring, sharpening, edge detection etc.\n\n### Blurring\n\nBlurring is a type of masking and is used to make an image smooth in which edges are not observed. For blurring, a low pass filter is used since it allows the low frequency to allow and stop high frequency.\n\nGo to the 'blurring_masking' directory and run it. To change the filter, change the 'matrix_size' value in the code.\n```\npython3 blurring_masking.py\n```\n\n### Sharpening\n\nSharpening is another type of masking which is used to enhance any image such that edges are highlighted and fine details of image is seen.\n\nGo to the 'sharpening_masking' directory and run it. To change the filter, change the 'matrix_size' value in the code.\n```\npython3 sharpening_masking.py\n```\n\n## Power Law (Gamma) Transformation\n\nPower law also known as Gamma transformation is used for contrast manipulation and gamma correction for different display devices. These are performed directly on the image pixels and thus it is a spatial domain operation.\n\nGo to the 'power_law' directory and run it. Try with different gamma values as indicated in the code. Also try both the images with their separate gamma values.\n```\npython3 power_law.py\n```\n\n## Spatial Resolution Stretching\n\nSpatial resolution stretching is an operation performed on an image to either increase it's resolution or decrease it. Once decreased, the same image cannot be converted back to the original by increasing the same image.\n\nGo to the 'spatial_resolution_stretching' directory and run it. Change the values passed to 'decrease_by' and 'increase_by' functions for more level of stretching.\n```\npython3 spatial_resolution_stretching.py\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgorkhali125%2Fimage-processing-algorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgorkhali125%2Fimage-processing-algorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgorkhali125%2Fimage-processing-algorithms/lists"}