如何检测隔行图像上的帧是奇数还是偶数?

发布于 2024-12-07 08:12:16 字数 212 浏览 1 评论 0原文

我有一个设备可以在精确的时间截取电视屏幕截图(它不会截取不完整的帧)。

该屏幕截图仍然是由两个不同的原始帧制成的交错图像。

现在的问题是是否/如何可以识别哪些行较新/较旧。

我必须提到,如果需要,我可以连续拍摄多个屏幕截图。

在此处输入图像描述

I have a device that 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.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一江春梦 2024-12-14 08:12:16

依次截取两张屏幕截图,生成一系列两个图像 (1,2)。将每个屏幕截图分为两个字段(奇数和偶数),并将每个字段视为单独的图像。如果您假设图像一致地隔行扫描(非常安全的假设,否则它们看起来会很糟糕),那么有两种可能性:(1e, 1o, 2e, 2o)(1o, 1e, 2o, 2e)。所以目前是50-50。

然后您可以使用光流来提高您的机会。假设你和
第一个选项:(1e, 1o, 2e, 2o)。计算(1e, 2e)之间的光流f1。然后计算(1e, 1o)之间的流量f2(1o,2e)之间的f3。如果f1f2 + f3大致相同,那么事情正在朝着正确的方向发展,并且您选择了正确的安排。否则,请尝试其他安排。

光流是一种非常通用的方法,很难计算整个图像。如果您想快速完成任务,请用视频跟踪替换光流。

编辑

我一直在研究一些可以便宜地完成此操作的代码。我注意到,如果 3 个场是连续的并且顺序正确,则由于平滑、恒定的运动而产生的绝对误差将被最小化。相反,如果它们是乱序的(或者不连续的),这个误差就会更大。因此,一种方法是采用两个包含 3 个字段的组,检查上述两个排序中每一个的错误,然后选择产生较低错误的排序。

我这里只有少数交错视频可供测试,但它似乎有效。唯一的缺点是它不是很有效,除非有相当平滑的运动或使用的帧数较低(少于 20-30)。

这是一个交错帧:

在此处输入图像描述

这是我的方法的一些示例输出(同一帧):

在此处输入图像描述

顶部图像是奇数行。底部图像是偶数行。括号中的数字是该图像被选为最新图像的次数。右边的数字就是错误。在这种情况下,奇数行被标记为最新行,因为误差低于偶数行。可以看到,在 100 帧中,它(正确)判断奇数行是最近的 80 次。

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:

enter image description here

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

enter image description here

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.

愁以何悠 2024-12-14 08:12:16

您有多个字段,F1、F2、F3、F4 等。编织 F1-F2 假设 F1 是偶数字段。编织 F2-F3,假设 F2 是偶数场。现在测量每帧中的梳理量。假设有运动,将会有一些正确交错的梳理,但更多的是错误交错的梳理。您必须多次执行此操作,以便在有运动时找到一些字段。

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.

留一抹残留的笑 2024-12-14 08:12:16

我在这里回答有点晚了,但我在谷歌搜索类似问题时发现了这一点。 FWIW,如果您的捕获设备可以访问不同步信号(水平和垂直),那么您可以检查这些信号。据我了解,奇数帧和偶数帧存在差异。其中一帧从屏幕中间开始。
http://martin.hinner.info/vga/pal.html 等了解更多信息。
也许这个答案对未来 11 年的人仍然有帮助:)

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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文