typedef struct _SPATIALFLT
{
L_UINT uStructSize;
L_INT fltDivisor; /* sum divisor */
L_INT fltBias; /* sum bias */
L_UINT fltDim; /* filter dimensions */
L_INT fltMatrix[1]; /* array of filter coefficients */
} SPATIALFLT, * pSPATIALFLT;
The SPATIALFLT structure lets you design your own filter to use with the LBitmap::SpatialFilter function. Click here to view a diagram in a separate window that shows how the weights are applied in a typical Prewitt gradient directional edge enhancement operation.
Size of this structure, in bytes. Use the sizeof operator to calculate this value.
Number used to divide the sum of weighted values.
Number added to the weighted average.
Number of pixels on one side of the square (neighborhood) used for averaging. Usually an odd number such as 3 or 5 is used. If you specify an even number, the target pixel is the one northwest of the midpoint.
The array of weighting factors. The factors apply to pixels in the neighborhood read left to right and top to bottom (in the ABC order shown in the diagram). The weighting factors in the diagram would be specified as follows:
MyPrewitt.fltMatrix[ ] = {1, 1, 1, 1, -2, -1, 1, -1, -1} Note that the array size is initialized as a placeholder with a value of 1. You must allocate space to hold your filter. Otherwise, you will get a stack fault.
LPSPATIALFLT is a pointer to a SPATIALFLT structure. Where the function parameter type is LPSPATIALFLT, you can declare a SPATIALFLT variable, update the structure's fields, and pass the variable's address in the parameter. Declaring an LPSPATIALFLT variable is necessary only if your program requires a pointer.
It is beyond the scope of this documentation to explain how applying various weighting factors affects an image. If you specify your own filter, you should refer to a textbook on image processing. For example, Digital Image Processing: Principles and Applications, by Gregory A. Baxes.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document