Sha256: 8da3d2ea9540c4100fa2ed924f8b2942fb6c56dab506a10bc9ebd671f0c50539

Contents?: true

Size: 403 Bytes

Versions: 1

Compression:

Stored size: 403 Bytes

Contents

require "findaface/version"
require "opencv"

module Findaface
  def self.has_face?(path)
    include OpenCV

    config = File.join(File.dirname(File.expand_path(__FILE__)),
                       '../lib/haarcascades/haarcascade_frontalface_alt.xml')
    detector = CvHaarClassifierCascade::load(config)
    image = IplImage::load(path)
    return detector.detect_objects(image).length == 1
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
findaface-0.0.1 lib/findaface.rb