fit_surface_first_order — Calculate gray value moments and approximation by a first order surface (plane).
The operator fit_surface_first_order calculates the gray value moments and the parameters of the approximation of the gray values by a first order surface. The calculation is done by minimizing the distance between the gray values and the surface. A first order surface is described by the following formula:
Image(r,c) = Alpha(r - r_center) + Beta(c - c_center) + Gamma
r_center and c_center are the center coordinates of intersection of the input region with the full image domain. By the minimization process the parameters from Alpha to Gamma is calculated.
The algorithm used for the fitting can be selected via Algorithm:
Standard 'least squares' line fitting.
Weighted 'least squares' fitting, where the impact of outliers is decreased based on the approach of Huber.
Weighted 'least squares' fitting, where outliers are ignored based on the approach of Tukey.
The parameter ClippingFactor (a scaling factor for the standard deviation) controls the amount of damping outliers: The smaller the value chosen for ClippingFactor the more outliers are detected. The detection of outliers is repeated. The parameter Iterations specifies the number of iterations. In the modus 'regression' this value is ignored.
Note that the operator fit_surface_first_order only considers the given Regions and ignores any previously set domain of the input image Image.
Regions to be checked.
Corresponding gray values.
Algorithm for the fitting.
Default value: 'regression'
List of values: 'huber', 'regression', 'tukey'
Maximum number of iterations (unused for 'regression').
Default value: 5
Restriction: Iterations >= 0
Clipping factor for the elimination of outliers.
Default value: 2.0
List of values: 1.0, 1.5, 2.0, 2.5, 3.0
Restriction: ClippingFactor > 0
Parameter Alpha of the approximating surface.
Parameter Beta of the approximating surface.
Parameter Gamma of the approximating surface.
The operator fit_surface_first_order returns the value 2 (H_MSG_TRUE) if an image with the defined gray values ('byte') is entered and the parameters are correct. If necessary an exception is raised.