ImageGear for C and C++ on Windows v19.3 - Updated
IG_IP_find_tilt
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_find_tilt

This function computes the least-squares best fit plane for an image.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_find_tilt(
        HIGEAR hIGear, 
        const LPAT_RECT lpRect,
        LPAT_DOUBLE lpSlopeX, 
        LPAT_DOUBLE lpSlopeY, 
        LPAT_DOUBLE lpPiston
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image to be processed.
lpRect const LPAT_RECT Far pointer to an AT_RECT structure specifying the rectangular portion of the image on which to operate. If NULL, this operation will be performed on the entire image. Before ImageGear performs this operation it will check to see if an internal flag has been set to TRUE to make a mask active for this HIGEAR image. If a mask is active, and a valid pointer to a mask can be found, ImageGear will override the settings passed to this structure in favor of the non-rectangular ROI defined by the mask.
lpSlopeX LPAT_DOUBLE Returns the slope in the X direction of the tilt plane.
lpSlopeY LPAT_DOUBLE Returns the slope in the Y direction of the tilt plane.
lpPiston LPAT_DOUBLE Returns the piston of the tilt plane.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

Grayscale - 8, 16, 32 bpp.

Sample:

Image Processing

Example:

 
Copy Code
HIGEAR   hIGear;         /* HIGEAR handle of image */
AT_RECT lpRect;         /* rectangle to process */
LPAT_DOUBLE lpSlopeX, lpSlopeY, lpPiston;
...
IG_IP_find_tilt(hIGear, lpRect, lpSlopeX, lpSlopeY, lpPiston);
...

Remarks:

The plane will be given by formula f(x, y) = SlopeX * x + SlopeY * y + Piston.

This function, like other ImageGear Image Processing and Clipboard API calls, takes an AT_RECT structure as an argument, so that you can process a rectangular sub-region of an image. However, before ImageGear performs the operation specified by this function, it will check to see if an internal flag has been set to TRUE, indicating that a mask HIGEAR should be used with the image. If the flag is set to TRUE, and a valid pointer to a mask image has been assigned, ImageGear will override the settings passed to the AT_RECT structure and use the non-rectangular ROI defined by the mask HIGEAR. To create a non-rectangular region of interest, call IG_IP_NR_ROI_to_HIGEAR_mask().

Please see the descriptions of IG_IP_NR_ROI_mask_associate() and IG_IP_NR_ROI_to_HIGEAR_mask() functions for more details.