Project

ruby-dlib

0.0
No commit activity in last 3 years
No release in over 3 years
You can use computer vision features in Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

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.