如何在 Swing 中为视频制作叠加层
我想为国外项目制作一个透明的叠加层来显示实时视频。下面的图像链接中给出了叠加示例。在图像中,您可以看到右下角的覆盖层显示人脸,我也想使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您刚刚开始该项目并且尚未真正启动并运行 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, andWindow.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.