Closing 2D Line With Interpolation

Function for interpolating pixels of binary curves (one-pixel size line with white pixels on black background) for closing gaps.

Al momento, stai seguendo questo contributo

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.

Cita come

Lorenzo Drudi (2026). Closing 2D Line With Interpolation (https://it.mathworks.com/matlabcentral/fileexchange/134951-closing-2d-line-with-interpolation), MATLAB Central File Exchange. Recuperato .

Informazioni generali

Compatibilità della release di MATLAB

  • Compatibile con R2022b e release successive

Compatibilità della piattaforma

  • Windows
  • macOS
  • Linux
Versione Pubblicato Note della release Action
1.0.0