Sha256: edafa233aeb0121a34238e68e43d62fc579a91ca5376db9656c8abd0c65a921c

Contents?: true

Size: 498 Bytes

Versions: 1

Compression:

Stored size: 498 Bytes

Contents

require "opencv"

module FaceCounter
  class << self
    def run
      if ARGV.size < 1
        STDERR.puts " $ #{$0} input.jpg"
        exit 1
      end

      input_filename = ARGV.shift

      image = OpenCV::IplImage::load input_filename
      haar_xml_file = File.join(File.dirname(__FILE__), 'haarcascade_frontalface_alt.xml')
      detector = OpenCV::CvHaarClassifierCascade::load haar_xml_file

      p detector.detect_objects(image).count
    end
  end
end

require "face_counter/version"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
face_counter-0.1.0 lib/face_counter.rb