Sha256: b597b3fc671e2e62e288175ee4d2264835fc84e6183e2da2460807257481e7d2

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require_relative '../lib/findaface.rb'

describe Findaface, "has_face?" do

  it "finds faces" do
    Dir['spec/test_photos/has_face/*'].each do |path|
      Findaface.has_face?(path).should be_true
    end
  end

  it "doesn't give false positives" do
    Dir['spec/test_photos/no_face/*'].each do |path|
      Findaface.has_face?(path).should be_false
    end
  end

  it "returns false for photos with small faces" do
    Dir['spec/test_photos/small_faces/*'].each do |path|
      Findaface.has_face?(path).should be_false
    end
  end

	context "with multiple cascades" do
		it "can detect a nose, eye, and face" do
			Findaface.add_cascade(
				{
					cascade:'haarcascades/haarcascade_mcs_nose.xml',
					fussyness:7,
					scale_factor: 1.044,
					min_size: 100,
			  }
			)
			Findaface.add_cascade(
				{
					cascade:'haarcascades/haarcascade_eye.xml',
					fussyness:7,
					scale_factor: 1.05,
					min_size: 100,
			  }
			)
			Findaface.add_cascade(
				{
					cascade:'haarcascades/haarcascade_frontalface_detault.xml',
					fussyness:7,
					scale_factor: 1.05,
					min_size: 100,
			  }
			)
			Dir['spec/test_photos/eye_nose_face/*'].each do |path|
				Findaface.has_face?(path).should be_true
			end
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
findaface-0.0.6 spec/findaface_spec.rb
findaface-0.0.5 spec/findaface_spec.rb