{"id":17691717,"url":"https://github.com/heet9022/real-time-filtering","last_synced_at":"2025-03-30T22:43:45.889Z","repository":{"id":127954626,"uuid":"454197607","full_name":"heet9022/Real-time-filtering","owner":"heet9022","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-13T06:08:49.000Z","size":5319,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T04:11:13.264Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/heet9022.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":"2022-01-31T22:58:29.000Z","updated_at":"2022-02-13T02:54:56.000Z","dependencies_parsed_at":"2023-03-31T12:17:34.462Z","dependency_job_id":null,"html_url":"https://github.com/heet9022/Real-time-filtering","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/heet9022%2FReal-time-filtering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heet9022%2FReal-time-filtering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heet9022%2FReal-time-filtering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heet9022%2FReal-time-filtering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heet9022","download_url":"https://codeload.github.com/heet9022/Real-time-filtering/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246390857,"owners_count":20769476,"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":[],"created_at":"2024-10-24T12:41:56.425Z","updated_at":"2025-03-30T22:43:45.868Z","avatar_url":"https://github.com/heet9022.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Real-time-filtering\n\n# Summary\n\nThis project is based on C++. It is set up so that it accesses the computer's webcam and applies a series of filters to it. The user has a choice about which filter they want to use by pressing keyboard keys like 'b', 'g' etc. \n\n# Grayscale Filter\nThe grayscale filter was produced using the OpenCV function `cvtColor`. The most accurate method to convert a color image is by doing a weighted sum of the RGB channels, also known as channel-dependent luminance perception. However, this method is computationally expensive, so OpenCV uses a linear approximation instead. The formula used for linear approximation is `Y = 0.299R + 0.587G + 0.114B`.\n\nAn alternative grayscale method was also implemented, using the formula `Y = 0.0722B + 0.7152G + 0.2126R`. This conversion method is based on channel-dependent luminance perception, taking into account the perceived brightness of red, green, and blue channels.\n\n# Gaussian Blur\nThe Gaussian blur filter was implemented using two separable filters of size 5x1 and 1x5, which were applied successively to achieve the same result as a 5x5 Gaussian blur filter matrix. Using separable filters is more computationally efficient.\n\n# Sobel Filter for Edge Detection\nThe Sobel filter for edge detection was created by first defining two base filters (SobelX and SobelY) and then calculating the magnitude of these base filters.\n\n# Quantized Gaussian Filter\nThe quantized Gaussian filter was created by first applying a Gaussian filter, and then quantizing the filter into 15 levels.\n\n# Cartoon Filter\nThe cartoon filter was created by creating a pipeline of the Sobel filter for edge detection and the quantized Gaussian filter. The Sobel filter was used to detect edges, and the corresponding pixels in the Gaussian-quantized image were made black, which created a border-like effect.\n\n# Negative Filter\nThe negative filter was implemented by subtracting each pixel value from 255, creating a bitwise inversion effect.\n\n# Effects on Still Image\nThe filters were also applied to still images, as a video is essentially a collection of frames.\n\n# Save Video with Special Effects\nA function was implemented that allows users to record video with the special effects applied.\n\n## Key Takeaways\n- As a Python user, this project was challenging, as it required a deeper understanding of variable storage in OpenCV and the importance of considering data types.\n- Implementing the filters reinforced the concept of convolving filters over images.\n- Applying filters in separable form is more efficient than applying the entire matrix.\n- It was learned that assigning a matrix `A` to another matrix `B` (i.e. `Mat A = B`) creates a reference to the same matrix, and changes in one will affect all others.\n\n## Acknowledgement\nThe following websites were consulted in the development of this project:\n- https://docs.opencv.org/3.4/index.html\n- https://www.learnpythonwithrune.org/opencv-python-webcam-create-a-ghost-effect/\n- https://www.geeksforgeeks.org/negative-transformation-of-an-image-using-python-and-opencv/\n- https://stackoverflow.com/questions/53111837/align-text-in-the-puttext-in-opencv\n- https://learnopencv.com/read-write-and-display-a-video-using-opencv-cpp-python/\n- https://docs.opencv.org/3.4/de/d25/imgproc_color_conversions.html#color_con\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheet9022%2Freal-time-filtering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheet9022%2Freal-time-filtering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheet9022%2Freal-time-filtering/lists"}