Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCv and Ruby on Rails

Can I use OpenCV with Ruby on Rails? If so, how can I do that? Or, what resources do you recommend for that?

Thanks.

like image 774
Simplicity Avatar asked Dec 16 '22 11:12

Simplicity


2 Answers

There is also an open CV gem, fwiw -- https://github.com/ruby-opencv/ruby-opencv.

like image 58
ipd Avatar answered Dec 30 '22 16:12

ipd


Sure you can! It just depends on what do you need as there is no "one" silver bullet.

If you want to create an online home surveillance, for example, then you would probably have least effort by writing:

  1. C++ image-processing command-line application on top of OpenCV that would write the surveillance events and/or images to SQLite database.
  2. Read the database directly from Rails.

For anything more complex, you'd need a more complex architecture.

Whatever you do, pick the best tools for the purpose:

  1. Let OpenCV do what it is best at (image processing)
  2. Let Rails to it's magic (simple, less demanding online access to some resources)

In order to link OpenCV and Ruby together, you could create a dedicated Ruby-to-C++ bridge because none of the existing ones can match diverse needs and most frameworks will do for a few specialized (i.e. designed by you) function-calls through your bridge.

This link would be a good start to pick a framework for a bridge - just go for one and see what comes out.

like image 30
andruso Avatar answered Dec 30 '22 16:12

andruso