Synopsis
Resize an image.
Format
void MimResize(SrcImageBufId, DestImageBufId, ScaleFactorX, ScaleFactorY, InterpolationMode)
MIL_ID SrcImageBufId; | Source image buffer identifier |
MIL_ID DestImageBufId; | Destination image buffer identifier |
double ScaleFactorX; | Scaling factor in X |
double ScaleFactorY; | Scaling factor in Y |
long InterpolationMode; | Interpolation mode |
Description
This function resizes the source image by the specified factors. Results are stored in the destination buffer starting from the top-left corner.
The SrcImageBufId parameter specifies the identifier of the data source of the operation. This parameter must be given an image buffer identifier.
The DestImageBufId parameter specifies the identifier of the destination of the results. This parameter must be given an image buffer identifier.
The ScaleFactorX and ScaleFactorY parameters are used to multiply the width and height of the source image, respectively. These parameters can be independently set to either a non-null positive value or M_FILL_DESTINATION. When one of these parameters is set to M_FILL_DESTINATION, the source image is resized to fill the entire width and/or height of the destination buffer, depending on the parameter. A factor greater than 1.0 enlarges the source image, while a factor less than 1.0 reduces it.
The InterpolationMode parameter specifies the mode of interpolation. This parameter can be set to the following:
M_NEAREST_NEIGHBOR | Nearest neighbor (no interpolation). |
M_BILINEAR | Bilinear interpolation |
M_BICUBIC | Bicubic interpolation |
M_AVERAGE | Averaging. For dezooming only. |
M_INTERPOLATE | Interpolated resizing: for zooming = bilinear, for dezooming = averaging |
M_DEFAULT | Same as M_NEAREST_NEIGHBOR |
Note, M_INTERPOLATE gives the best speed/result compromise for interpolated resizing.
The following can be added to the interpolation mode to indicate how to set overscan (border) pixels:
M_OVERSCAN_ENABLE (default) |
Use nearest neighbor for overscan pixels. |
M_OVERSCAN_DISABLE | Do not set overscan pixels. |
M_OVERSCAN_CLEAR | Set overscan pixels to 0. |
Status
In-place processing is supported, but the source and destination image buffers cannot partially overlap (a situation that can only occur when using child buffers).