MIL_ID DeinterlaceContextImId, | //in |
const MIL_ID *SrcImageArrayPtr, | //in |
const MIL_ID *DstImageArrayPtr, | //in |
MIL_INT SrcImageCount, | //in |
MIL_INT DstImageCount, | //in |
MIL_INT64 ControlFlag | //in |
This function produces a sequence of deinterlaced images from a sequence of images grabbed from an interlaced camera. When an image is acquired using an interlaced camera, the even and odd fields are not taken at the exact same moment in time. If the object in the image was in motion, there is an offset between the position of the object in one field and its position in the other. Simply combining these two fields to produce a deinterlaced image results in noticeable deformities in moving objects, called interlacing artifacts. MimDeinterlace() uses averaging techniques to reduce or remove these interlacing artifacts and produce a higher quality deinterlaced image. To perform the deinterlacing operation, you can select one of several deinterlacing algorithms using MimControl() with M_DEINTERLACE_TYPE. They can be applied to the entire image or only to the pixels that are considered part of a moving object. To apply the algorithm to the latter, select the adaptive version of the algorithm (for example, M_ADAPTIVE_DISCARD).
Often, the order in which the fields are grabbed will depend on the camera being used. When using an algorithm that produces two output frames (for example, M_BOB or M_ADAPTIVE_BOB), it is important to set the field that is grabbed first using MimControl() with M_FIRST_FIELD. This will ensure that the sequence of output frames occur in chronological order and that the video stream is fluid.
The adaptive algorithms apply a motion detection algorithm to dynamically determine which pixels are part of an object in motion and which pixels are part of the background, prior to performing the deinterlacing algorithm. Using MimControl(), you can set the number of neighboring frames used for motion detection (M_MOTION_DETECT_NUM_FRAMES), the location of the frame to be processed within this group of frames (M_MOTION_DETECT_REFERENCE_FRAME), and the threshold value used to differentiate between pixels of objects in motion and pixels of background objects (M_MOTION_DETECT_THRESHOLD). To visualize which pixels are affected, you can have MimDeinterlace() output an image of these pixels, using MimControl() with M_MOTION_DETECT_OUTPUT; pixels that are part of an object in motion are set to the maximum value (0xFF for an a bit image), while the other pixels are set to 0. In this case, the deinterlacing part of the adaptive algorithm is not executed.
Specifies the identifier of the image processing context to be used for deinterlacing. The image processing context must have been previously allocated on the system using MimAlloc().
Specifies an array containing the identifiers of the buffers of the images to deinterlace. Only 8-bit and 16-bit buffers are supported. All source images must be of the same type, same format, and on the same system. Note that all source and destination images must have the same size.
These images must not have a region of interest (ROI) associated with them. Using images with an ROI will cause an error.
Specifies an array containing the identifiers of the buffers of the images in which to save the deinterlaced images. Only 8-bit and 16-bit buffers are supported. All destination images must be of the same type, same format, and on the same system. Note that all source and destination images must have the same size.
These images must not have a region of interest (ROI) associated with them. Using images with an ROI will cause an error.
Header | Include mil.h. |
Library | Use mil.lib; milim.lib. |
DLL | Requires mil.dll; milim.dll. |