README
Name
Ruby Dlib
Description
Ruby Dlib is a Ruby bindings of Dlib. Ruby Dlib is based on GObject Introspection.
Dlib is a computer vision library.
GObject Introspection is a middleware for language bindings of C library. GObject Introspection can generate language bindings automatically at runtime.
Ruby Dlib uses Dlib GLib and gobject-introspection gem to generate Ruby bindings of Dlib.
Dlib GLib is a C wrapper for Dlib. GObject Introspection can't use Dlib directly because Dlib uses C++. Dlib GLib is a bridge between Dlib and GObject Introspection.
gobject-introspection gem is a Ruby bindings of GObject Introspection. Ruby Dlib uses GObject Introspection via gobject-introspection gem.
Install
Install Dlib GLib before install Ruby Dlib.
Install Ruby Dlib after you install Dlib GLib:
% gem install ruby-dlib
Usage
require 'dlib'
require 'pathname'
image_file = ARGV[0]
image = Dlib::Image.new(Pathname(image_file))
detector = Dlib::FrontalFaceDetector.new
rectangles = detector.detect(image)
rectangles.each do |rectangle|
image.draw_rectangle(rectangle, 0, 0, 255)
end
image.save_jpeg('output.jpg')
Dependencies
License
Boost Software License. See LICENSE for details.