Closing 2D Line With Interpolation

版本 1.0.0 (4.6 KB) 作者: Lorenzo Drudi
Function for interpolating pixels of binary curves (one-pixel size line with white pixels on black background) for closing gaps.
8.0 次下载
更新 2023/9/7

查看许可证

Function for interpolating pixels of binary curves (one-pixel size line with white pixels on black background) for closing gaps.
PARAMETERS:
- notClosedLine (Matrix [height, width]):
The not-closed line that needs to be closed.
- method (String):
The interpolation method to use (AVAILABLE METHODS: "linear", "nearest", "next", "previous", "pchip", "cubic",
"v5cubic", "makima", "spline").
(see the available methods here https://www.mathworks.com/help/matlab/ref/interp1.html#btwp6lt-1-method).
- varargin (Vector 2 x 1):
Coordinates (x,y) of the reference point (see the description).
Optional Parameter.
OUTPUT:
- result (Matrix: [height, width]):
The resulting line after the closing process.
DESCRIPTION:
The method is composed by several step:
1. Get the reference point: the default option is the centroid of the points of the line, otherwise it is possible
to pass, as optional parameter, the (x,y) coordinates of the point. Usually, this point is the centroid of the
line to be closed, it is necessary to order the polar coordinates in its
reference and then apply the interpolation algorithm.
2. Convert the coordinates from the cartesian system to the polar one.
3. Order the polar coordinates by the reference point.
4. Apply the interpolation algorithm.
5. Re-convert to the cartesian system and compute the final closed line.

引用格式

Lorenzo Drudi (2026). Closing 2D Line With Interpolation (https://ww2.mathworks.cn/matlabcentral/fileexchange/134951-closing-2d-line-with-interpolation), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2022b
与 R2022b 及更高版本兼容
平台兼容性
Windows macOS Linux
版本 已发布 发行说明
1.0.0