Computes the Curvature Scale Space representation of a 2D closed contour.
This involves progressively smoothing the contour with Gaussian kernels and
identifying curvature zero-crossings (inflection points) at each scale.
Usage
calculate_css(contour, n_points = 200, sigma_max = 10, sigma_step = 0.5)
Arguments
- contour
A matrix or data.frame with 'X' and 'Y' columns representing the contour.
- n_points
Integer. Number of points to resample the contour to (for uniform arc length).
- sigma_max
Numeric. Maximum smoothing scale (standard deviation of Gaussian).
- sigma_step
Numeric. Increment for the smoothing scale.
Value
A list of class `css` containing:
css_matrix: A data.frame with columns `arc_length` and `sigma` for each zero-crossing.
n_points: Number of points used in resampling.
contour_original: The original contour.
Examples
# Example with a simple shape
theta <- seq(0, 2 * pi, length.out = 100)
x <- cos(theta) + 0.1 * cos(3 * theta)
y <- sin(theta) + 0.1 * sin(3 * theta)
contour <- data.frame(X = x, Y = y)
css_res <- calculate_css(contour)
# plot(css_res)