Module: FaceCounter

Defined in:
lib/face_counter.rb,
lib/face_counter/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/face_counter.rb', line 5

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