Generalized Hough Transform Algorithm for Shape Detection With Multi-Scale and Multi-Shift Detection (Algorithm 3)
--Output Using Algorithm 3
This advanced algorithm detects shapes using the Generalized Hough Transform with added multi-scale and multi-shift detection capabilities.
- Canny Edge Detection:
- Uses the
canny
function to detect edges effectively.
- Uses the
- Gradient Orientation Calculation:
- Computes gradient orientation using the Sobel filter.
- Building the R-Table:
- Constructs an R-Table based on detected edges and orientations.
- Accumulate Gradients Using R-Table:
- Accumulates votes in an accumulator array.
- Generate Shifts:
- Creates a list of possible shifts for the reference image.
- Multi-Scale Detection:
- Tests different scales of the reference image to detect size variations.
- Multi-Shift Detection:
- Tests various shifts to find the best alignment.
- Overlay the Reference Image:
- Overlays the reference image on the query image at the detected position.
- Visualization:
- Visualizes the results including the reference image, query image with detected points, and the final overlay.
- Shape-to-Image Conversion:
- Converts shapes to binary images.
- Testing:
- Reads shape data from CSV files, converts them to images, and applies the Generalized Hough Transform.
-
Read and Convert Shape Data:
- Read and convert shape data from CSV files to binary images.
-
Apply Generalized Hough Transform:
- Apply the Generalized Hough Transform with multi-scale and multi-shift detection.
-
Visualize Results:
- Visualize the best match and overlayed reference image.
- Edge Detection: Uses Canny edge detection and Sobel filter.
- R-Table Construction: Creates a lookup table for edge points.
- Gradient Accumulation: Accumulates votes in an accumulator array.
- Multi-Scale and Multi-Shift Detection: Tests different scales and shifts.
- Overlay and Visualization: Displays the detected shapes and overlays the reference image. .