{"id":21436901,"url":"https://github.com/willigarneau/sobel-filter-cuda","last_synced_at":"2026-04-16T03:32:18.752Z","repository":{"id":99252261,"uuid":"147559488","full_name":"willigarneau/sobel-filter-cuda","owner":"willigarneau","description":"🖼️ Assignment 1 in Intelligent Industrial System at Cégep Lévis-Lauzon. Learning Cuda and OpenCV by creating a sobel filter. 💻","archived":false,"fork":false,"pushed_at":"2018-11-19T13:57:42.000Z","size":28576,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-24T11:03:11.648Z","etag":null,"topics":["cplusplus","cuda","filter","opencv","sobel"],"latest_commit_sha":null,"homepage":"","language":"Cuda","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/willigarneau.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}},"created_at":"2018-09-05T18:04:57.000Z","updated_at":"2023-11-13T22:47:56.000Z","dependencies_parsed_at":"2023-04-21T15:16:44.077Z","dependency_job_id":null,"html_url":"https://github.com/willigarneau/sobel-filter-cuda","commit_stats":null,"previous_names":["willigarneau/sobel-filter-cuda"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/willigarneau/sobel-filter-cuda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willigarneau%2Fsobel-filter-cuda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willigarneau%2Fsobel-filter-cuda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willigarneau%2Fsobel-filter-cuda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willigarneau%2Fsobel-filter-cuda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willigarneau","download_url":"https://codeload.github.com/willigarneau/sobel-filter-cuda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willigarneau%2Fsobel-filter-cuda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"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":["cplusplus","cuda","filter","opencv","sobel"],"created_at":"2024-11-23T00:16:40.193Z","updated_at":"2026-04-16T03:32:18.702Z","avatar_url":"https://github.com/willigarneau.png","language":"Cuda","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ASSIGNMENT 1 - Industrial Intelligent System\n\n\u003e 🖼️ Laboratory 1 in Intelligent Industrial System at Cégep Lévis-Lauzon. Learning Cuda and OpenCV by creating a sobel filter. 💻\n\n## Part 1 :\n\u003e Creating a program in cuda and C++ to apply a constant increment to any image, with OpenCV and Cuda.\n\n#### Code example :\n\u003e This is the general function which will add the constant to each pixels.\n```c++\nMat SerialBlackAndWhite(Mat imgToConvert) {\n\tint rows = imgToConvert.rows;\n\tint cols = imgToConvert.cols;\n\tMat gray(rows, cols, CV_8UC1);\n\tfor (int r = 0; r \u003c rows; r++) {\n\t\tfor (int c = 0; c \u003c cols; c++) {\n\t\t\tdouble gray_val = (int)imgToConvert.at\u003cuchar\u003e(r, c) + PIXEL_INCREMENTATION;\n\t\t\tgray.at\u003cuchar\u003e(r, c) = (uchar)gray_val;\n\t\t}\n\t}\n\treturn gray;\n}\n```\n\n# Sobel Edge Detector\n\nA Sobel Edge Detection Filter written in OpenCV, Cuda and C++. Made with no external library\n\n#### Calculating vertical gradient :\n```c++\n\nint yGradient(Mat frame, Point position) {\n\tint tGradient = 0;\n\tfor (int x = 0; x \u003c 3; x++) {\n\t\tfor (int y = 0; y \u003c 3; y++) {\n\t\t\tint rows = position.y + y;\n\t\t\tint cols = position.x + x;\n\t\t\tint currentPixelValue = (int)frame.at\u003cuchar\u003e(rows, cols);\n\t\t\tint currentGradient = currentPixelValue * Gy[x][y];\n\t\t\ttGradient += currentGradient;\n\t\t\tcurrentGradient \u003e maximumGradient ? maximumGradient = currentGradient : maximumGradient;\n\t\t}\n\t}\n\treturn tGradient;\n}\n\n```\n\n#### Calculating horizontal gradient :\n```c++\nint xGradient(Mat frame, Point position) {\n\tint tGradient = 0;\n\tfor (int x = 0; x \u003c 3; x++) {\n\t\tfor (int y = 0; y \u003c 3; y++) {\n\t\t\tint rows = position.y + y;\n\t\t\tint cols = position.x + x;\n\t\t\tint currentPixelValue = (int)frame.at\u003cuchar\u003e(rows, cols);\n\t\t\tint currentGradient = currentPixelValue * Gx[x][y];\n\t\t\ttGradient += currentGradient;\n\t\t\tcurrentGradient \u003e maximumGradient ? maximumGradient = currentGradient: maximumGradient;\n\t\t}\n\t}\n\treturn tGradient;\n}\n```\n\n#### And applying them to the actual image\n```c++\nMat SerialSobel(Mat imgToConvert) {\n\tfor (int rows = 0; rows \u003c imgToConvert.rows - 2; rows++) {\n\t\tfor (int cols = 0; cols \u003c imgToConvert.cols - 2; cols++) {\n\t\t\tint currentPixel = imgToConvert.at\u003cuchar\u003e(rows, cols);\n\t\t\tPoint currentPosition = Point(cols, rows);\n\t\t\tint gradientX = xGradient(imgToConvert, currentPosition);\n\t\t\tint gradientY = yGradient(imgToConvert, currentPosition);\n\t\t\tint approxGradient = (abs(gradientX) + abs(gradientY) * 255) / maximumGradient;\n\t\t\timgToConvert.at\u003cuchar\u003e(rows, cols) = approxGradient;\n\t\t}\n\t}\n\treturn imgToConvert;\n}\n```\n\n## Example\n\nHere's what this program does:\n\n![original](https://raw.githubusercontent.com/bamcis-io/SobelFilter/master/SobelFilter/images/lena.bmp)\n![filtered](https://raw.githubusercontent.com/bamcis-io/SobelFilter/master/SobelFilter/images/sobel_lena.bmp)\n\n![original](https://raw.githubusercontent.com/bamcis-io/SobelFilter/master/SobelFilter/images/valve.png)\n![filtered](https://raw.githubusercontent.com/bamcis-io/SobelFilter/master/SobelFilter/images/sobel_valve.bmp)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilligarneau%2Fsobel-filter-cuda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilligarneau%2Fsobel-filter-cuda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilligarneau%2Fsobel-filter-cuda/lists"}