IMVConvolution
The IMVConvolution interface is used to control the filter's image processing algorithm. Read the filter description to see how the filter is used. Read the remarks for implementation details.
| get_NumOfKernels | Returns the number of kernels used for convolution. |
| put_NumOfKernels | Sets the number of kernels used for convolution. |
| get_SelectedKernel | Returns the index of the kernel that is currently being modified. |
| put_SelectedKernel | Sets the curent kernel index to be modified. |
| get_KernelCombination | Returns the current kernel combination method. |
| put_KernelCombination | Sets the current kernel combination method. |
| get_NumOfKernelColumns | Returns the number of columns in the currently selected kernel. |
| put_NumOfKernelColumns | Sets the number of columns in the currently selected kernel. |
| get_NumOfKernelRows | Returns the number of rows in the currently selected kernel. |
| put_NumOfKernelRows | Sets the number of rows in the currently selected kernel. |
| GetKernelValue | Returns the kernel value at the specified position [X,Y]. |
| SetKernelValue | Sets the kernel value at the specified position [X,Y]. |
| get_XAnchor | Returns the horizontal anchor of the currently selected kernel. |
| put_XAnchor | Sets the horizontal anchor of the currently selected kernel. |
| get_YAnchor | Returns the vetical anchor of the currently selected kernel. |
| put_YAnchor | Sets the vertical anchor of the currently selected kernel. |
| get_RightShift | Returns the pixel right shift of the currently selected kernel. |
| put_RightShift | Sets the pixel right shift of the currently selected kernel. |
Header file: iMVConvolution.h
Interface definition language file: iMVConvolution.idl
Typelib: MVConvolution
Interface ID: IID_IMVConvolution
HRESULT get_NumOfKernels( [out, retval] int *piNumOfKernels );
Returns the number of kernels used to convolve with the video frames.
Parameter:
| piNumOfKernels | A pointer to an integer value that receives the number of kernels. |
HRESULT put_NumOfKernels( [in ] int iNumOfKernels );
Sets the number of kernels used to convolve with the video frames.
Parameter:
| iNumOfKernels | The number of kernels. |
HRESULT get_SelectedKernel( [out, retval] int *piSelectedKernel );
Returns the currently selected kernel.
Parameter:
| piSelectedChannel | A pointer to an integer value that receives the number of thel kernel that is currently selected. |
HRESULT put_SelectedKernel( [in ] int iSelectedKernel );
Sets the currently selected kernel.
Parameter:
| iSelectedChannel | The number of the kernel to be modified. |
HRESULT get_KernelCombination( [out, retval] int *piCombination );
Returns the method for kernel combination as MV_KERNEL_COMBINATION .
Parameter:
| piCombination | A pointer to an integer value that receives the combination method. |
HRESULT put_KernelCombination( [in ] int iCombination );
Sets the method for kernel combination as MV_KERNEL_COMBINATION .
Parameter:
| iCombination | The combination method. |
HRESULT get_NumOfKernelColumns( [out, retval] int *piColumns );
Returns the number of columns in the selected kernel.
Parameter:
| piColumns | A pointer to an integer value that receives the number of columns. |
HRESULT put_NumOfKernelColumns( [in ] int iColumns );
Sets the number of columns in the selected kernel.
Parameter:
| iColumns | The desired number of columns. |
HRESULT get_NumOfKernelRows( [out, retval] int *piRows );
Returns the number of rows in the selected kernel.
Parameter:
| piRows | A pointer to an integer value that receives the number of rows. |
HRESULT put_NumOfKernelRows( [in ] int iRows );
Sets the number of rows in the selected kernel.
Parameter:
| iRows | The number of rows. |
HRESULT GetKernelValue( [in ] int iColumn, [in ] int iRow, [out, retval ] int *piValue );
Returns the matrix value for the selected kernel using the position passed [iColumn, iRow].
Parameter:
| iColumn | Matrix column | |
| iRow | Matrix row | |
| piValue | A pointer to an integer value that receives the matrix value. |
HRESULT SetKernelValue( [in ] int iColumn, [in ] int iRow, [in ] int iValue );
Sets the matrix value for the selected kernel at position [iColumn, iRow].
Parameter:
| iColumn | Matrix column | |
| iRow | Matrix row | |
| iValue | Matrix value |
HRESULT get_XAnchor( [out, retval] int *piAnchor );
Returns the horizontal anchor of the selected kernel.
Parameter:
| piAnchor | A pointer to an integer value that receives the horizontal anchor. |
HRESULT put_XAnchor( [in ] int iAnchor );
Sets the horizontal anchor of the selected kernel.
Parameter:
| iAnchor | The horizontal anchor. |
HRESULT get_YAnchor( [out, retval] int *piAnchor );
Returns the vertical anchor of the selected kernel.
Parameter:
| piAnchor | A pointer to an integer value that receives the vertical anchor. |
HRESULT put_YAnchor( [in ] int iAnchor );
Sets the vertical anchor of the selected kernel.
Parameter:
| iAnchor | The vertical anchor. |
HRESULT get_RightShift( [out, retval] int *piShift );
Returns the current pixel right shift that is used to scale the convolution result of the current kernel.
Parameter:
| piShift | A pointer to an integer value that receives the pixel right shift. |
HRESULT put_RightShift( [in ] int iShift );
Sets the current pixel right shift that is used to scale the convolution result of the current kernel.
Parameter:
| iShift | The pixel right shift. |
Filter specific structures and enumerators
typedef enum _MV_KERNEL_COMBINATION
{
MV_MV_COMBINATION_SUM= 0,
MV_MV_COMBINATION_SUMSQ,
MV_MV_COMBINATION_SUMSQROOT,
MV_MV_COMBINATION_MAX,
MV_MV_COMBINATION_MIN
} MV_KERNEL_COMBINATION;
The following is an example sequence using the interface.
IMVConvolution *pIMVConvolution;
...
// Use two kernels
pIMVConvolution->put_NumOfKernels( 2
);
// Select kernel one
pIMVConvolution->put_SelectedKernel( 0
);
// Init kernel one
pIMVConvolution->put_NumOfKernelColumns( 3
);
pIMVConvolution->put_NumOfKernelRows( 3
);
pIMVConvolution->put_XAnchor( 1
);
pIMVConvolution->put_YAnchor( 1
);
pIMVConvolution->put_RightShift( 0
);
// Create vertical sobel
matrix
// 1 2
1
// 0 0
0
// -1 -2 -1
// Column 0, Row 0
pIMVConvolution->SetKernelValue( 0, 0,
1 );
// Column 0, Row 1
pIMVConvolution->SetKernelValue( 0, 1,
0 );
// Column 0, Row 2
pIMVConvolution->SetKernelValue( 0, 2,
-1 );
...
// Select kernel two
pIMVConvolution->put_SelectedKernel( 1
);
// Init kernel two
pIMVConvolution->put_NumOfKernelColumns( 3
);
pIMVConvolution->put_NumOfKernelRows( 3
);
pIMVConvolution->put_XAnchor( 1
);
pIMVConvolution->put_YAnchor( 1
);
pIMVConvolution->put_RightShift( 0
);
// Create horizontal sobel
matrix
// 1 0 -1
// 2 0 -2
// 1 0 -1
// Column 0, Row 0
pIMVConvolution->SetKernelValue( 0, 0,
1 );
// Column 0, Row 1
pIMVConvolution->SetKernelValue( 0, 1,
2 );
// Column 0, Row 2
pIMVConvolution->SetKernelValue( 0, 2,
1 );
...
pIMVConvolution->put_KernelCombination(
MV_MV_COMBINATION_SUM );