Skip to content

Latest commit

ย 

History

History
65 lines (45 loc) ยท 2.97 KB

File metadata and controls

65 lines (45 loc) ยท 2.97 KB

Sobel Edge Detection Hardware Accelerator ๐Ÿ–ผ๏ธ

EE587 Digital System and Design Synthesis | Milestone 1

Verilog Tool Status

๐Ÿ“Œ Project Overview

This project implements a Sobel Edge Detection Accelerator in Verilog. Milestone 1 focuses on the behavioral simulation and functional verification of the Sobel operator, ensuring accurate gradient computation before moving toward RTL synthesis and hardware implementation.

๐Ÿง  How the Sobel Filter Works

The Sobel operator detects edges by calculating the image intensity gradient at each pixel. It uses two 3x3 kernels to convolve with the original image:

  1. Horizontal Gradient ($G_x$): Detects vertical edges.
  2. Vertical Gradient ($G_y$): Detects horizontal edges.
  3. Gradient Magnitude: Calculated as $|G| = \sqrt{G_x^2 + G_y^2}$ (often approximated as $|G_x| + |G_y|$ in FPGA hardware to save resources).
  4. Thresholding: The result is clipped to an 8-bit value for final display.

๐Ÿ”Œ Inputs and Outputs

  • Input: Grayscale Image (8-bit pixels, .hex format).
  • Output: Edge-detected Image (8-bit pixels, .hex format).

๐Ÿš€ Simulation Workflow

The verification process involves a hybrid approach using Python/MATLAB for pre-processing and Verilog for core computation:

  1. Pre-processing: Convert input.png to input01_image.hex (Verilog readable format) using a high-level script.
  2. Verilog Simulation:
    • The Testbench loads the .hex file into memory.
    • Pixels are fed into the conv_test.v module.
    • Processed pixels are written back to output.hex.
  3. Post-processing: Convert the resulting output.hex back into a .png file to visualize the edges.

๐Ÿ›  How to Run

  1. Prepare Data: Generate the grayscale .hex file from your source image.
  2. Setup Simulation: Save the reference image in the simulation directory:
    Edge Detection Algorithm/Edge Detection Algorithm.sim/sim_1/behav/x_sim
  3. Execute: Run the behavioral simulation in Vivado or ModelSim.
  4. Verify: Convert the generated output.hex back into an image and compare it with your high-level reference model.

๐Ÿ“‚ Repository Structure

  • /Source code: Verilog source files (Sobel core, convolution logic).
  • /Test code: Testbench for behavioral simulation.
  • /scripts: Python scripts for image-to-hex conversion.
  • /Summary: Simulation results and waveforms.

๐Ÿ“š References

  • Implementation based on the hardware architectures discussed in:
    usmanwardag, โ€œImplementation of Sobel Filter in Verilog,โ€ GitHub, 2025.

Developed for EE587: Digital System and Design Synthesis.