ruby 可以操纵和使用网络摄像头等外围设备吗?
ruby 可以操纵和使用网络摄像头等外围设备吗?我想创建一个使用网络摄像头的系统。可以用红宝石做吗?
Can ruby manipulate and work with peripherals like webcams? I would like to create a system that uses a webcam. Is it possible to do with ruby?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够使用 Ruby 控制网络摄像头。至少,您可以与 Java 或本机库交互以进行网络摄像头控制——Ruby 可以轻松地与 Java、C、C++、Objective-C 进行交互...
You should be able to control a webcam with Ruby. At the very least, you can interface with a Java or native library for the webcam control -- Ruby can easily talk to Java, C, C++, Objective-C...
Ruby 一般用在服务器端。因此,如果您正在寻找一种解决方案来通过在网络服务器上运行的 Ruby 与客户端网络摄像头进行交互,那么答案是否定的。
另一方面,如果您想与连接到执行 Ruby 代码的服务器的网络摄像头进行交互(或者只是在本地执行 Ruby 代码),那么答案可能是肯定的。我不是 Ruby 程序员,但据我所知,虽然 Ruby 很可能不直接支持与网络摄像头对话,但它确实支持 C 风格 dll 的绑定,您应该能够为其制作绑定以提供与网络摄像头交互的界面。
我不知道这样的绑定是否已经存在,但万一不存在,假设您了解 C/C++ 或其他一些可以导出 Ruby 绑定的语言,您应该能够自己构建一个。
Ruby is a generally used on the server-side. As such, if you're looking for a solution to interface with a client's webcam from Ruby running on a webserver then the answer is no.
On the other hand, if you'd like to interact with a webcam connected to the server executing Ruby code (or just to execute Ruby code locally) then the answer is potentially yes. I'm not a Ruby programmer but as far as I know while Ruby most probably doesn't have direct support for talking to a webcam, it does support bindings as C-style dlls and you should be able to craft a binding for it to provide an interface for interacting with webcams.
I don't know if such bindings already exist but in case they don't you should be able to build yourself one assuming you know C/C++ or some other language that can export bindings for Ruby.