ocmath_dilate_matrix_with_strel
Description
Dilates grayscale and binary image.
Syntax
int ocmath_dilate_matrix_with_strel( int nRows, int nCols, double * pMat, StrelResult * pStrel )
Parameters
- nRows
- [input] row number of the matrix
- nCols
- [input] column number of the matrix
- pMat
- [modify] on input, pointer to the matrix that will be dilated; on output, pointer to the matrix after dilated.
- pStrel
- [input] pointer to the object of structure StrelResult. StrelResult defines a morphological structuring element.
- It has 4 elements:
- pNHoodMat: pointer to neighborhood matrix. The neighborhood matrix specifies the neighborhood.
- pHeightMat: pointer to height matrix. The height matrix must be real and finite valued and same size as the neighborhood matrix. When it is NULL or all cells of it equals 0, se is flat structuring element, or else nonflat.
- nRows: the row number of matrix;
- nCols: the column number of matrix;
Return
Returns 0 on success and a non-zero error code on failure.
Examples
EX1
void ocmath_dilate_matrix_with_strel_ex1()
{
matrix matData = {{0,0,0,0,0},
{0,1,2,3,0},
{0,2,3,4,0},
{0,3,4,5,0},
{0,0,0,0,0}};
matrix matHood = {{0,1,0},{1,2,1},{0,1,0}};
matrix matHeight;
matHeight = matHood;
StrelResult se;
se.nRows = 3;
se.nCols = 3;
se.pNHoodMat = matHood;
se.pHeightMat = matHeight;
int nRet = ocmath_dilate_matrix_with_strel(5, 5, matData, &se);
if(nRet != OE_NOERROR)
printf(" Error: ocmath_dilate_matrix_with_strel failed. Error Code=%d\n", nRet);
}
Remark
See Also
ocmath_erode_matrix_with_strel, ocmath_make_strel
header to Include
origin.h
Reference
|