Documentation of 'boofcv.alg.shapes.ShapeFittingOps' Java class
ShapeFittingOps
boofcv.alg.shapes

Class ShapeFittingOps

    • Constructor Detail

      • ShapeFittingOps

        public ShapeFittingOps()
    • Method Detail

      • fitPolygon

        public static java.util.List<PointIndex_I32> fitPolygon(java.util.List<Point2D_I32> sequence,
                                                                boolean loop,
                                                                double splitFraction,
                                                                double minimumSideFraction,
                                                                int iterations)

        Fits a polygon to the provided sequence of connected points. The found polygon is returned as a list of vertices. Each point in the original sequence is guaranteed to be within "toleranceDist' of a line segment.

        Internally a split-and-merge algorithm is used. See referenced classes for more information. Consider using internal algorithms directly if this function is a performance bottleneck.

        Parameters:
        sequence - Ordered and connected list of points.
        loop - If true the sequence is a connected at both ends, otherwise it is assumed to not be.
        splitFraction - A line will be split if a point is more than this fraction of its length away from the line. Try 0.05
        minimumSideFraction - The minimum allowed side length as a function of contour length.
        iterations - Maximum number of iterations done to improve the fit. Can be 0. Try 50.
        Returns:
        Vertexes in the fit polygon.
        See Also:
        SplitMergeLineFitLoop, SplitMergeLineFitSegment
      • fitEllipse_F64

        public static FitData<EllipseRotated_F64> fitEllipse_F64(java.util.List<Point2D_F64> points,
                                                                 int iterations,
                                                                 boolean computeError,
                                                                 FitData<EllipseRotated_F64> outputStorage)
        Computes the best fit ellipse based on minimizing Euclidean distance. An estimate is initially provided using algebraic algorithm which is then refined using non-linear optimization. The amount of non-linear optimization can be controlled using 'iterations' parameter. Will work with partial and complete contours of objects.

        NOTE: To improve speed, make calls directly to classes in Georegression. Look at the code for details.

        Parameters:
        points - (Input) Set of unordered points. Not modified.
        iterations - Number of iterations used to refine the fit. If set to zero then an algebraic solution is returned.
        computeError - If true it will compute the average Euclidean distance error
        outputStorage - (Output/Optional) Storage for the ellipse. Can be null.
        Returns:
        Found ellipse.
      • fitEllipse_I32

        public static FitData<EllipseRotated_F64> fitEllipse_I32(java.util.List<Point2D_I32> points,
                                                                 int iterations,
                                                                 boolean computeError,
                                                                 FitData<EllipseRotated_F64> outputStorage)
        Convenience function. Same as fitEllipse_F64(java.util.List, int, boolean,FitData), but converts the set of integer points into floating point points.
        Parameters:
        points - (Input) Set of unordered points. Not modified.
        iterations - Number of iterations used to refine the fit. If set to zero then an algebraic solution is returned.
        computeError - If true it will compute the average Euclidean distance error
        outputStorage - (Output/Optional) Storage for the ellipse. Can be null
        Returns:
        Found ellipse.
      • averageCircle_I32

        public static FitData<Circle2D_F64> averageCircle_I32(java.util.List<Point2D_I32> points,
                                                              GrowQueue_F64 optional,
                                                              FitData<Circle2D_F64> outputStorage)
        Computes a circle which has it's center at the mean position of the provided points and radius is equal to the average distance of each point from the center. While fast to compute the provided circle is not a best fit circle by any reasonable metric, except for special cases.
        Parameters:
        points - (Input) Set of unordered points. Not modified.
        optional - (Optional) Used internally to store the distance of each point from the center. Can be null.
        outputStorage - (Output/Optional) Storage for results. If null then a new circle instance will be returned.
        Returns:
        The found circle fit.
      • averageCircle_F64

        public static FitData<Circle2D_F64> averageCircle_F64(java.util.List<Point2D_F64> points,
                                                              GrowQueue_F64 optional,
                                                              FitData<Circle2D_F64> outputStorage)
        Computes a circle which has it's center at the mean position of the provided points and radius is equal to the average distance of each point from the center. While fast to compute the provided circle is not a best fit circle by any reasonable metric, except for special cases.
        Parameters:
        points - (Input) Set of unordered points. Not modified.
        optional - (Optional) Used internally to store the distance of each point from the center. Can be null.
        outputStorage - (Output/Optional) Storage for results. If null then a new circle instance will be returned.
        Returns:
        The found circle fit.

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.