如何在 Swing 中为视频制作叠加层

发布于 2024-10-26 02:42:16 字数 288 浏览 6 评论 0原文

我想为国外项目制作一个透明的叠加层来显示实时视频。下面的图像链接中给出了叠加示例。在图像中,您可以看到右下角的覆盖层显示人脸,我也想使用 JMF 来实现相同的功能来显示面部,然后使用 swing 在覆盖层中显示面部。

示例 Overley Imahe:http://www.ovostudios.com/images/vidsamsolo.jpg

有人可以帮助实现这个功能吗?

I want to make a transparent overlay for a foreign project to show live video. Sample of overlay is given in the image link below. In image you can see a overlay at right bottom corner showing face of a person, I also want to achieve same functionality using JMF to show face and then display the face in overlay using swing.

Sample Overley Imahe: http://www.ovostudios.com/images/vidsamsolo.jpg

Can someone help achieving this functionality?

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

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

发布评论

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

评论(1

滥情稳全场 2024-11-02 02:42:16

如果您刚刚开始该项目并且尚未真正启动并运行 JMF 部分,那么您可能需要在提交之前查看一些替代方案

如果您想继续使用 Swing,以获得所需的一般覆盖行为,则需要使用 Frame.setUndecorated() 来关闭窗口边框和按钮,并且 Window.setAlwaysOnTop() 确保窗口位于其他窗口之上。对于透明度,请参阅本教程。但是,我不确定透明度和视频是否能很好地结合在一起,祝你好运!

您可能还想为窗口编写一个自定义焦点处理程序,以便它无法获得焦点,尽管覆盖层可能不可能正确地“幻像”,从而单击只会通过覆盖层传递到底层桌面。这种行为可能只有通过使用低级图形技术才能实现,即根本不创建窗口,而是直接在屏幕上绘制。这可能需要一个本机库。

If you're just starting the project and haven't actually got the JMF part up and running yet, then you might want to take a look at some alternatives before committing to it.

If you want to go ahead with Swing, to get the general overlay behaviour you want, you'll need to make use of Frame.setUndecorated() to turn off window borders and buttons, and Window.setAlwaysOnTop() to make sure the window stays on top of other windows. For the transparency, see this tutorial. However, I'm not sure whether transparency and video will work nicely together, so good luck!

You might also want to write a custom focus handler for the window so that it cannot be focused, although it is probably impossible for the overlay to be properly 'phantom' whereby clicks just pass through the overlay to the underlying desktop. That kind of behaviour might only be possible by using low-level graphics techniques i.e. by not creating a window at all, but by drawing directly onto the screen. That might require a native library.

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