Point to Hough Space
Implement a function to transform a point from image coordinates to its representation in Hough space for line detection. The Hough transform is a feature extraction technique used in image processing to detect lines, circles, and other shapes. In the context of line detection, the Hough space is a 2D parameter space where lines are represented by their distance from the origin and the angle of the perpendicular line to the x-axis.
To achieve this transformation, we need to compute for each value, which forms a sinusoidal curve in Hough space.
- Start with a point in image coordinates .
- For each angle , calculate the corresponding value using the formula.
This technique is widely used in computer vision applications, such as edge detection and object recognition.
Example
point = (10, 10) theta_values = [0, 45, 90]
[10.0, 14.14, 10.0]
- Input:
pointis a single pixel location, andtheta_valuesare angles in degrees of the normal to each candidate line through it. The trig in the formula expects radians, so these are , and . - : , , so . This is the vertical line .
- : and both equal , so , which rounds to . That is , the full distance from the origin to .
- : , a horizontal line at height .
- Output: one per angle, in the same order, each rounded to 2 decimal places:
[10.0, 14.14, 10.0]. - Notice that gives the largest here because that normal points straight at the pixel. Across all angles, the values trace a sinusoid in space.
Constraints
- point is (x, y) in image coordinates
- theta_values is a list of angles in degrees
- Return list of ρ values rounded to 2 decimal places