简体   繁体   English

从网络摄像头捕获图像

[英]Capturing image from webcam

I'm trying to capture images by using webcam in an applet.我正在尝试通过在小程序中使用网络摄像头来捕获图像。 The applet makes use of JMF.该小程序使用 JMF。 But I managed to run applet without actually installing JMF.但我设法在没有实际安装 JMF 的情况下运行小程序。 I kept a button in HTML webpage so that when the button gets clicked, the applet should capture the image.我在 HTML 网页中保留了一个按钮,以便在单击该按钮时,小程序应捕获图像。

But for me it is giving a java.lang.RuntimeException: No permission to capture from applets .但对我来说,它给出了java.lang.RuntimeException: No permission to capture from applets How can this exception be resolved so an applet can capture image using webcam in HTML page?如何解决此异常,以便小程序可以使用 HTML 页面中的网络摄像头捕获图像?

In order to capture images in an applet, it is necessary:为了在小程序中捕获图像,有必要:

  1. For you to digitally sign the code.让您对代码进行数字签名。
  2. For the user to click "OK" when prompted to run the signed code.当提示运行签名代码时,用户单击“确定”。
  3. If the functionality is being called from a button using JavaScript, wrap the Java code in one of the AccessController.doPrivileged(PrivilegedAction) variants.如果使用 JavaScript 从按钮调用功能,请将 Java 代码包装在AccessController.doPrivileged(PrivilegedAction)变体之一中。
  4. AFAIR the installer for JMF does not have the 'allow capture from applets' checked by default. AFAIR 默认情况下,JMF 的安装程序没有选中“允许从小程序捕获”。 That needs to be reconfigured in the JMF options.这需要在 JMF 选项中重新配置。 I forget how.我忘了怎么做。

Update更新

I dont want to give client package to extra overhead of the installation of JMF.我不想给客户 package 额外的安装 JMF 的开销。

That is just silly.那只是愚蠢的。

  1. The components of the JMF must be available on the run-time class-path of the applet, for it to function. JMF 的组件必须在 applet 的运行时类路径上可用,以便 function。 If they are downloaded by the JRE using the applet element (or whatever), then the user has incurred that 'overhead'.如果它们是由 JRE 使用 applet 元素(或其他)下载的,那么用户已经产生了“开销”。
  2. But perhaps you mean you don't want to make the end user run the installer that advises to 'reboot' at the end.但也许您的意思是您不想让最终用户运行建议在最后“重新启动”的安装程序。 In that case, you are missing my point while avoiding answering my question.在这种情况下,您在避免回答我的问题的同时忽略了我的观点。 That question, again, is "How did you get the DLL?"这个问题“你是如何得到 DLL 的?” . .

This question asked Too many times in this forum.. Anyways..Here is the solution: Java swing Program to capture webcam images you have to modify it for applet which takes only 30 minutes这个问题在这个论坛上问了太多次了..无论如何..这是解决方案: Java swing 捕获网络摄像头图像的程序,您必须为小程序修改它,只需 30 分钟

Applets run with very limited permissions and that might be causing the issue.. Here is an old post which has information about signing an applet to get the necessary permissions..hope this helps小程序以非常有限的权限运行,这可能会导致问题.. 这是一篇旧帖子,其中包含有关签署小程序以获得必要权限的信息..希望这会有所帮助

I think flash is a much better option.我认为 flash 是一个更好的选择。 There are really easy solutions for that even using Javascript + Flash.即使使用 Javascript + Flash,也有非常简单的解决方案。 Take a look at this: http://www.xarg.org/project/jquery-webcam-plugin/看看这个: http://www.xarg.org/project/jquery-webcam-plugin/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM