by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 4.7, Creation date: 2019-07-19, Last change: 2025-09-14
See Also: CPLregionsholes
, CPLremstraightAmin
, CPLremovearea
, imofimsketch
CPLN=CPLremoveregionsholes(CPL,[sline])
CPL: | Original CPL | |
sline: | minimal length (not area) |
CPLN: | CPL without removed areas |
I=rgbsketch; imshow(I); shg;
imshow(imofimsketch(I));shg
CPLremovearea(CPLofimage(I))
CPLremovearea(CPLofimage(imofimsketch(I)))
This function, CPLremoveregionsholes, is designed to process closed polygon lists (CPL) by removing regions with small areas and small holes. It utilizes the polyshape class for geometric operations.
CPLofCPS function.varargin using getfuncparams.CPL is a polyshape object. If so, convert it to a CPL using CPLofCPS.CPLregionsholes, resulting in CPLo and CPLi.CPLo and CPLi using the CPLremovearea function, with sline as the threshold.CPLo and CPLi using CPLbool with the '-' operation, resulting in CPLN.CPL and CPLN to get CPLX.CPLplot and CPSplot to visualize the changes.The function includes commented-out code that suggests an alternative method for determining the size threshold based on the bounding box of the CPL. This part is not active in the current implementation.
Algorithm explaination created using ChatGPT on 2025-08-19 07:51. (Please note: No guarantee for the correctness of this explanation)