Hello, dear Tuesday Tip friends! This week we are talking about interlaced videos and how to deal with them with Amped FIVE. Wait! Don’t hit the “X” button yet! Even if you think you know everything about deinterlacing, stay with us! We’re not only going to see good rules, but we’ll also see an interesting exception that makes the rule. 😉
Those of you who attended Amped FIVE training classes know very well that when you load a video in FIVE and you see those “jagged lines”, you’re likely dealing with an interlaced video.
Video interlacing (whose origins date back to 1930!) was invented to overcome a limitation of legacy analog TVs: they could not draw a full frame sufficiently fast to avoid a disturbing “flickering effect”. Therefore, engineers decided to update alternatively even lines and odd lines on the screen. They coined the term field to define this “halved frame” containing either even or odd lines. With this “trick”, they managed to double the refresh rate without having to increase the amount of transmitted data. You are basically trading in spatial resolution on temporal resolution: instead of transferring the full frames, you only send the even field for frame 0, the odd field for frame 1, and you keep repeating this alternation for the whole length of the video. Then, at the receiver side, even and odd fields can be interleaved to build a frame (thus going back to the full number of rows of the original video) but drawn independently.
This idea has a significant drawback: if the video depicts a rapidly moving subject, the fact that even and odd lines belonged to different moments in time becomes a problem. In fact, two consecutive fields will capture the object in different positions, but during play, they will form, together, the same picture! This “temporal inconsistency” manifests itself through the “jagged lines” effect.
The easiest way to overcome this problem is to simply split even- and odd- fields and generate a video which has half the original height but twice the number of frames. Then, we fill the missing rows either by replication or by interpolation of available rows. This is precisely what Amped FIVE’s Deinterlace filter does.
By comparing the image below with the one at the beginning of this post, you’ll be able to see that, after Deinterlacing, the jagged lines effect disappears, while the number of frames doubles.
Now, two questions are in order:
- Where should we place the Deinterlace filter in the chain?
- Should we always use Deinterlace when we stumble across an interlaced video?
Answering question 1 is easy: since interlacing is introduced at the very end of the acquisition chain, it is a good idea to compensate for it immediately, at the beginning of your processing chain.
As for question 2, one may be tempted to say: ALWAYS! Why would you want to keep those jagged lines? Well, in general, it’s true: if you do see jagged lines on your target, then Deinterlace will help, as shown in the example above. But we should remember that by deinterlacing we are “splitting information” in multiple frames and replacing the missing field with replicated/interpolated data.
Now, if the object you’re interested in was still in the video, it will likely not be affected by the jagged lines artifact (because it remains in the same position in even and odd fields, no temporal inconsistency occur). Why should we then “tamper with” interpolated data, when we can avoid that? It turns out, in this special case deinterlacing could be even counter-productive!
Let’s consider this poor resolution, interleaved video. We would like to get a more intelligible image of the leftmost “Oxford” binder label.
Except for some frames at the beginning, the video turns out to be quite static. If we use the Range Selector to keep only frames with little motion, use Local Stabilization to keep the object still and run Frame Averaging followed by a bit of Smart Resize, we get this image:
If we add the Deinterlace filter at the beginning of the chain, instead, we obtain this picture:
It’s quite evident that the result without deinterlacing is better (e.g., compare the Roman number “II” written in the second line of the label).
This Tip can be very important when you are dealing with CCTV footage, where the camera is usually well fixed on a wall. If you’re trying to enhance the license plate of a parked vehicle, probably there is no need to deinterlace, you would only throw in “extraneous” pixel values computed by interpolating real values. If the vehicle is moving, instead, the jagged-line artifact needs to be compensated for. You can do that by using the Deinterlace filter or, in case you’re dealing with a few frames, you can use the Field Shift filter to manually compensate for the object displacement across different fields (the Field Shift simply allows that: shifting one field over the other to find the best match).
This week’s takeaway is: every good rule comes with an exception! We’ve learned that sometimes it’s not wise to deinterlace an interlaced video.
We hope you enjoyed this Tuesday tip! Stay tuned and don’t miss the next ones. You can also follow us on LinkedIn, Twitter, Facebook or YouTube: we’ll post a link to every new Tip Tuesday so you won’t miss any!