<a id="easyimage-interlaced-frames"></a>

# Operations on Interlaced Video Frames

<a id="easyimage-interlaced-videos"></a>

## Operations on Interlaced Videos

When an image is interlaced, the two frames (even and odd lines) are not recorded at the same time. If there is movement in the scene, a visible artifact can result (the edges of objects exhibit a “comb” effect).

* [`EasyImage::RealignFrame`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#ac8e823bb31fbbfef48693e2fb64c8bca) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a81a3b4163b3565a088b45f46aa28fa71) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#aedf0503822c20e62834db90d909d972b) cures this problem if the movement is uniform and horizontal (objects on a conveyor belt), by shifting one of the frames horizontally. The amplitude of the shift can be estimated automatically.
* [`EasyImage::GetFrame`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a155e6464c231e3f386b97bc0f36e8363) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a4e1aca2c11cba33be0baeeb7f0ee2b8e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#a70d2aa7ea054875512613b1fd7ab3e7b) extracts the frame of given parity from an image while [`EasyImage::SetFrame`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#abda7929255b66bc0b8300336c81905c6) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#abfdafae92528be116332c1d35e00bca6) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#aba5b556da4e980eb4109fdda3503b586) replaces the frame of given parity in an image.
* [`EasyImage::MatchFrames`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a34ae26e5e071d6dd221b7572a66bd13c) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#aa3a101788efd9729e7efc5b3f3d03531) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#a371e19a6f635185911b68c93158c146d) determines the optimal shift amplitude by comparing two successive lines of the image. These lines should be chosen such that they cross some edges or non-uniform areas.
* [`EasyImage::RebuildFrame`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a432dc202761c713c9ad57bf02cd9e6e8) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#acc208eebf7c7396ecdd3be0fd4b2e9a5) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#a806b3ea3e7773d9761f4778a85cf09df) rebuilds one frame of the image by interpolation between the lines of the other frame.
* [`EasyImage::SwapFrames`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a92473be501e972f9c9853e14e786f905) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#aef25848a0e822ba316d39994dd96729e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#a89b4dc09621f57bd9da085a7721931e1): interchanges the even and odd rows of an image. This is helpful when acquisition of an interlaced image has confused even and odd frames.

The same image should be used as source and destination because only the shifted rows are copied. To use a different destination image, the source image must be copied first in the destination image object. The size of the destination image is determined as follows:

$$
dstImage_{Width} = srcImage_{Width}
$$

$$
dstImage_{Height} = \frac{srcImage_{Height} + 1 - odd}{2}
$$

<a id="easyimage-interlaced-images"></a>

## Operations on Interlaced Images

When the subject being worked on is a single interlaced images and no artifacts should be corrected, [`EasyImage::Deinterlace()`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a69be0e55e4058f2c234fd53bf6ecc95a) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a868d183ec160da7208387e2358617db9) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#aec6de0341be65ae9dea5992a25ea6750) can be used. By default, the input interlaced image is expected to have a height two times greater than the height of the two output images. An optional interpolation can be enabled so that the two output images have the same height of the output images. This interpolation is enabled by default and is using the linear interpolation algorithm.

* The first output image will contain the even lines.
* The second output image will contain the odd lines.

#### WARNING
Output images must not be void when submitted to [`EasyImage::Deinterlace()`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a69be0e55e4058f2c234fd53bf6ecc95a) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a868d183ec160da7208387e2358617db9) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#aec6de0341be65ae9dea5992a25ea6750). They must be initialized using [`SetSize`](../../../doxygen_cpp/classeVision_1_1EBaseROI.html#a8446337051c589320cfd2ea1fcbe6d16) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EBaseROI.html#a87cfe59bbf851719b3f65d6766f71dba) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EBaseROI.html#a43f0fddfd46389cc8b95d9ccb608a909)

The inverse function to [`EasyImage::Deinterlace()`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a69be0e55e4058f2c234fd53bf6ecc95a) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a868d183ec160da7208387e2358617db9) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#aec6de0341be65ae9dea5992a25ea6750) is [`EasyImage::Interlace()`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a4df387f41eb850579c28b67ddee1a097) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#aeb81b197362f599931351a0d85501dcd) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#acf025128f1da20f9c42a48140961918b) and allows to interlace two images into one.
