Synopsis
Change the value of an operation flag associated with a custom kernel or structuring element.
Format
void MbufControlNeighborhood(BufId, OperationFlag, OperationValue)
MIL_ID BufId; | Kernel or structuring element buffer identifier |
long OperationFlag; | Operation flag |
long OperationValue; | Operation value |
Description
This function changes the value of an operation flag associated with a custom kernel or structuring element. Neighborhood operations not specifically altered by this function use the default values. After calling this function, any neighborhood operation using the specified kernel or structuring element will apply the specified change. Call this function for each operation flag you want to modify.
The BufId parameter specifies the identifier of the custom-kernel buffer or structuring-element buffer. You must have already allocated this buffer, using MbufAlloc1d or MbufAlloc2d.
The OperationFlag parameter specifies the action to perform on a neighborhood operation when using the specified buffer.
The OperationValue parameter specifies the value associated with the operation flag.
The following table lists the possible values that can be specified for each operation flag:
Operation flag | Operation value | Description |
M_NORMALIZATION_FACTOR | Any numerical value | The result is normalized by the specified value (factor). |
M_DEFAULT | The result is normalized by a factor of 1. | |
M_ABSOLUTE_VALUE | M_ENABLE | The absolute value of the result is taken. |
M_DISABLE | The absolute value of the result is not taken. | |
M_DEFAULT | Same as M_DISABLE. | |
M_SATURATION | M_ENABLE | Saturation is performed on the result. That is, a result that overflows or underflows will be set to the maximum or minimum value (respectively) that can be represented in the destination buffer. |
M_DISABLE | Saturation is not performed on the result. Therefore, the results that overflow are undefined. | |
M_DEFAULT | Same as M_DISABLE. | |
M_OVERSCAN | M_DEFAULT | MIL-selected method to optimize speed and logic in function of both the operation required and the current processing system. |
M_MIRROR | Operations will be performed on the bordering pixels of the source buffer with the source buffer pixel values mirroring the overscan neighborhood pixel values. That is, the overscan neighborhood pixel values will be a mirror copy of the source buffer’s borders. | |
M_REPLACE | Operations will be performed on the bordering pixels of the source buffer with the overscan neighborhood pixel values set to the overscan replace value. | |
M_TRANSPARENT | Operations will be performed on the bordering pixels of the source buffer using transparent overscan neighborhood pixel values. That is, the overscan neighborhood pixel values will be those of the parent buffer. If they are not available, a mirror type overscan is used instead. | |
M_DISABLE | Overscan is disabled. | |
M_OVERSCAN_REPLACE_VALUE | Any numerical value | Value of the overscan neighborhood pixels. |
M_REPLACE_MAX | The overscan neighborhood pixel values will be set to the maximum value of the source buffer. | |
M_REPLACE_MIN | The overscan neighborhood pixel values will be set to the minimum value of the source buffer | |
M_DEFAULT | Zero will be used as the value of the overscan neighborhood pixels. | |
M_OFFSET_CENTER_X | Any value from 0…(sizeX-1) | Position X of the center of the kernel or structuring element from the top left corner. |
M_DEFAULT | The top left pixel of the central element in a neighborhood. | |
M_OFFSET_CENTER_Y | Any value from 0…(sizeY-1) | Position Y of the center of the kernel or structuring element from the top left corner. |
M_DEFAULT | The top left pixel of the central element in a neighborhood. | |
M_DEFAULT | M_NULL | Default values (as indicated above for each operation flag) will be used. |
Note, for a structuring element buffer, you cannot specify a normalization factor, enable saturation or take the absolute value of a result. If all three are specified for a kernel buffer, however, the saturation is performed after the normalization factor and the absolute values have been applied.
The M_OVERSCAN_REPLACE_VALUE flag is only applicable if associating an M_OVERSCAN with an M_REPLACE value to a buffer.
See also
MimConvolve, MimMorphic, MimRank, MbufAlloc1d, MbufAlloc2d, MbufPut