0

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?

Mateusgf
  • 889
  • 1
  • 8
  • 14

2 Answers2

0

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...

Marnen Laibow-Koser
  • 5,959
  • 1
  • 28
  • 33
-3

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.

Mike Dinescu
  • 54,171
  • 16
  • 118
  • 151
  • So, it's better do that in C++ rather than Ruby, right? Wich other languages would you recomend? I heard that java has a framework called JMF (Java Media Framework) that helps me to do that. Is it better do that in java? Actualy I'd like to do a system that streams a video from a webcam in a computer wich runs my system. – Mateusgf Nov 29 '11 at 16:38
  • You're sort of confusing Ruby with Rails, I think. Ruby is used for desktop applications too. – Marnen Laibow-Koser Nov 29 '11 at 17:18
  • This in an extremely ignorant answer. – Constant Meiring Dec 05 '12 at 12:02
  • 1
    Constant M - can you elaborate on your comment? If you have a better answer feel free to add it. The question is not closed and so answers can still be added. Otherwise, if you just have a pertinent and justifiable comment please include it here.. – Mike Dinescu Dec 05 '12 at 21:09
  • There are endless ways to work with Ruby and peripherals. For webcams, there are gems like Hornetseye. There are libraries for GPIO and the lot, really. – Constant Meiring Dec 05 '12 at 21:35
  • 1
    That doesn't really contradict my answer.. But as I said, feel free to add an answer and include a guide for how to accomplish what the OP was looking for, maybe with links to the specific gems that you're familiar with for accessing the web-cam. – Mike Dinescu Dec 05 '12 at 21:42