This project demonstrates line detection using the Hough Transform with Canny edge detection in MATLAB.
It detects and visualizes the 4 longest lines in sample images.
- ACV_ASSIGNMENT - 3.pdf – Detailed assignment report
- darshan_ACVassignment3.m – MATLAB script for line detection
- jigalachannareddy_darshan.m – Alternative MATLAB implementation
- Input Images:
cameramanoriginal.pngriceoriginal.png
- Outputs:
cameraoutput.png– Cameraman with detected linesriceoutput.png– Rice image with detected linescameramanoutput.fig&riceoutput.fig– MATLAB figure files
- Load Image → Convert to Grayscale
- Canny Edge Detection → Extract edges
- Hough Transform → Compute accumulator array for lines
- Hough Peaks → Detect potential line segments
- Draw Lines → Visualize the longest 4 lines per image
| Original | Detected Lines |
|---|---|
![]() |
![]() |
| Original | Detected Lines |
|---|---|
![]() |
![]() |
- Open MATLAB.
- Place all files in the same folder.
- Run either script:......



