开发者

How to detect if a frame is odd or even on an interlaced image?

I have a device tha开发者_运维知识库t is taking TV screenshots at precise times (it doesn't take incomplete frames).

Still this screenshot is an interlace image made from two different original frames.

Now, the question is if/how is possible to identify which of the lines are newer/older.

I have to mention that I can take several sequential screenshots if needed.

How to detect if a frame is odd or even on an interlaced image?


Take two screenshots one after another, yielding a sequence of two images (1,2). Split each screenshot into two fields (odd and even) and treat each field as a separate image. If you assume that the images are interlaced consistently (pretty safe assumption, otherwise they would look horrible), then there are two possibilities: (1e, 1o, 2e, 2o) or (1o, 1e, 2o, 2e). So at the moment it's 50-50.

What you could then do is use optical flow to improve your chances. Say you go with the first option: (1e, 1o, 2e, 2o). Calculate the optical flow f1 between (1e, 2e). Then calculate the flow f2 between (1e, 1o) and f3 between (1o,2e). If f1 is approximately the same as f2 + f3, then things are moving in the right direction and you've picked the right arrangement. Otherwise, try the other arrangement.

Optical flow is a pretty general approach and can be difficult to compute for the entire image. If you want to do things in a hurry, replace optical flow with video tracking.

EDIT

I've been playing around with some code that can do this cheaply. I've noticed that if 3 fields are consecutive and in the correct order, the absolute error due to smooth, constant motion will be minimized. On the contrary, if they are out of order (or not consecutive), this error will be greater. So one way to do this is two take groups of 3 fields and check the error for each of the two orderings described above, and go with the ordering that yielded the lower error.

I've only got a handful of interlaced videos here to test with but it seems to work. The only down-side is its not very effective unless there is substantial smooth motion or the number of used frames is low (less than 20-30).

Here's an interlaced frame:

How to detect if a frame is odd or even on an interlaced image?

Here's some sample output from my method (same frame):

How to detect if a frame is odd or even on an interlaced image?

The top image is the odd-numbered rows. The bottom image is the even-numbered rows. The number in the brackets is the number of times that image was picked as the most recent. The number to the right of that is the error. The odd rows are labeled as the most recent in this case because the error is lower than for the even-numbered rows. You can see that out of 100 frames, it (correctly) judged the odd-numbered rows to be the most recent 80 times.


You have several fields, F1, F2, F3, F4, etc. Weave F1-F2 for the hypothesis that F1 is an even field. Weave F2-F3 for the hypothesis that F2 is an even field. Now measure the amount of combing in each frame. Assuming that there is motion, there will be some combing with the correct interlacing but more combing with the wrong interlacing. You will have to do this at several times in order to find some fields when there is motion.


I'm a little late to answering here, but I found this while googling a similar question. FWIW if your capture device has access to de sync signals (H and V) then you can check those. There are differences for odd and even frames as I understand it. One of the frames starts at the middle of the screen. http://martin.hinner.info/vga/pal.html and the like for more info. Maybe this answer still helps someone another 11 years in the future :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜