{"id":40491489,"url":"https://github.com/solar224/canny-edge-detector-parallel","last_synced_at":"2026-01-20T18:52:21.547Z","repository":{"id":328942884,"uuid":"1114704458","full_name":"solar224/canny-edge-detector-parallel","owner":"solar224","description":"A parallelized C++ implementation of the Canny Edge Detector using Pthreads. Features custom image processing algorithms (Gaussian blur, Sobel operator) with OpenCV used solely for I/O.","archived":false,"fork":false,"pushed_at":"2025-12-16T10:33:36.000Z","size":6423,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-19T23:48:47.088Z","etag":null,"topics":["computer-vision","image-processing","opencv-ios","parallel-computing","pthreads"],"latest_commit_sha":null,"homepage":"","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/solar224.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-11T19:03:22.000Z","updated_at":"2025-12-16T10:33:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/solar224/canny-edge-detector-parallel","commit_stats":null,"previous_names":["solar224/canny-edge-detector-parallel"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/solar224/canny-edge-detector-parallel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solar224%2Fcanny-edge-detector-parallel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solar224%2Fcanny-edge-detector-parallel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solar224%2Fcanny-edge-detector-parallel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solar224%2Fcanny-edge-detector-parallel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solar224","download_url":"https://codeload.github.com/solar224/canny-edge-detector-parallel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solar224%2Fcanny-edge-detector-parallel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28609249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: 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":["computer-vision","image-processing","opencv-ios","parallel-computing","pthreads"],"created_at":"2026-01-20T18:52:21.465Z","updated_at":"2026-01-20T18:52:21.535Z","avatar_url":"https://github.com/solar224.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Canny Edge Detector with Pthread Parallelization\n\nThis project implements a high-performance Canny Edge Detector in C++ from scratch, utilizing Pthreads for row-based parallel processing. It demonstrates manual implementation of core computer vision concepts—including Gaussian blur, gradient computation (Sobel), non-maximum suppression, and double thresholding—without relying on external libraries for the algorithms themselves. OpenCV is used strictly for reading and writing image files.\n\n---\n\n## Prerequisites\n\nBefore building, ensure you have the following installed:\n\n```bash\n# Ubuntu/Debian\nsudo apt update\nsudo apt install cmake libopencv-dev build-essential\n```\n\n---\n\n## Build Instructions\n\n### Step 1: Clone the repository\n```bash\ngit clone \u003crepository-url\u003e\ncd canny-edge-detector\n```\n\n### Step 2: Create build directory\n```bash\nmkdir build\ncd build\n```\n\n### Step 3: Configure with CMake\n```bash\ncmake ..\n```\n\n### Step 4: Build the project\n```bash\nmake -j4\n```\n\nThis will generate two executables:\n- `canny` - Main edge detection program\n- `benchmark` - Performance benchmarking tool\n\n---\n\n## Usage\n\n### Basic Usage (Single Thread)\n```bash\n./canny\n```\nThis processes `../images/Sukuna.jpg` and saves the result to `../images/SukunaCanny.jpg`.\n\n### Parallel Execution (Specify Thread Count)\n```bash\n./canny \u003cnum_threads\u003e\n```\n\n**Examples:**\n```bash\n./canny 1    # Single thread\n./canny 4    # 4 threads\n./canny 6    # 6 threads (maximum recommended)\n```\n\n### Custom Input/Output\n```bash\n./canny \u003cnum_threads\u003e \u003cinput_image\u003e \u003coutput_image\u003e\n```\n\n**Examples:**\n```bash\n./canny 6 ../images/Sukuna.jpg ../images/output.jpg\n./canny 4 /path/to/input.jpg /path/to/output.jpg\n```\n\n---\n\n## Benchmark\n\nRun the benchmark tool to measure performance across different thread counts:\n\n```bash\n./benchmark\n```\n\nThis will output three tables:\n\n### Table 1: Overall Performance\nShows total execution time and speedup for 1-6 threads.\n\n### Table 2: Per-Function Performance\nShows timing breakdown for each function:\n- Gaussian blur\n- RGB to Grayscale conversion\n- Canny filter\n\n### Table 3: Different Noise Levels\nTests performance with different noise levels:\n- `sukuna_noise0.jpg` (original)\n- `Sukuna_noise1_gauss15.jpg` (Gaussian noise σ=15)\n- `Sukuna_noise2_gauss30.jpg` (Gaussian noise σ=30)\n\n**Sample Output:**\n```\n================================================================================\nTable 1: Overall Performance\n================================================================================\n   Threads        Average time (ms)      Speedup (= T1 / Tn)\n--------------------------------------------------------------------------------\n         1                  2030.00                     1.00\n         2                   965.00                     2.10\n         3                   670.00                     3.03\n         4                   540.00                     3.76\n         5                   460.00                     4.41\n         6                   410.00                     4.95\n================================================================================\n```\n\n---\n\n## Project Structure\n\n```\ncanny-edge-detector/\n├── CMakeLists.txt          # Build configuration\n├── README.md               # This file\n├── canny.h                 # Original header (serial version)\n├── canny.cpp               # Original implementation (serial version)\n├── canny_parallel.h        # Parallel version header\n├── canny_parallel.cpp      # Pthread parallel implementation\n├── main.cpp                # Main program entry point\n├── benchmark.cpp           # Benchmarking tool\n├── images/\n│   ├── Sukuna.jpg          # Sample input image\n│   └── SukunaCanny.jpg     # Sample output image\n└── build/                  # Build directory (created after cmake)\n    ├── canny               # Main executable\n    └── benchmark           # Benchmark executable\n```\n\n---\n\n## Algorithm Overview\n\nThe Canny edge detection algorithm consists of the following steps:\n\n1. **Gaussian Blur** - Reduces noise using a 5x5 Gaussian kernel\n2. **Grayscale Conversion** - Converts RGB to grayscale\n3. **Sobel Filter** - Computes gradient magnitude and direction\n4. **Non-Maximum Suppression** - Thins edges to 1-pixel width\n5. **Double Thresholding** - Classifies edges as strong, weak, or non-edges\n6. **Hysteresis** - Connects weak edges to strong edges\n\n### Parallelization Strategy\n\nThe implementation uses **row-based parallelization** with pthread:\n\n| Function | Strategy | Scalability |\n|----------|----------|-------------|\n| Gaussian Blur | Row partitioning | Excellent (near-linear) |\n| RGB to Grayscale | Row partitioning | Good |\n| Canny Filter | Phase-based parallel | Moderate (has sequential phase) |\n\n---\n\n## Parameters\n\nYou can adjust edge detection sensitivity in `main.cpp`:\n\n```cpp\ndouble lowerThreshold = 0.03;   // Lower threshold ratio\ndouble higherThreshold = 0.1;   // Higher threshold ratio\n```\n\n- **Lower values** → More edges detected\n- **Higher values** → Fewer edges detected\n\n---\n\n## License\n\nThis project is open source. Feel free to use and modify as needed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolar224%2Fcanny-edge-detector-parallel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolar224%2Fcanny-edge-detector-parallel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolar224%2Fcanny-edge-detector-parallel/lists"}