Class: Yearbook::Classifier
- Inherits:
-
Object
- Object
- Yearbook::Classifier
- Defined in:
- lib/yearbook/classifier.rb
Constant Summary collapse
- DATA_DIR =
File.('../../../data/classifiers', __FILE__ )
- DATA_FILES =
{ faces: File.join(DATA_DIR, 'haarcascade_frontalface_default.xml') }
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Class Method Summary collapse
-
.of(object_type) ⇒ Object
convenience will also pluralize anything.
Instance Method Summary collapse
- #detect_objects(cvimg) ⇒ Object
-
#initialize(fname) ⇒ Classifier
constructor
A new instance of Classifier.
Constructor Details
#initialize(fname) ⇒ Classifier
Returns a new instance of Classifier.
14 15 16 17 18 |
# File 'lib/yearbook/classifier.rb', line 14 def initialize(fname) @filename = fname @classifier = load_classifier(@filename) end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
12 13 14 |
# File 'lib/yearbook/classifier.rb', line 12 def filename @filename end |
Class Method Details
.of(object_type) ⇒ Object
convenience will also pluralize anything
29 30 31 32 33 |
# File 'lib/yearbook/classifier.rb', line 29 def self.of(object_type) object_name = object_type.to_s.pluralize.to_sym return self.new DATA_FILES[object_name] end |
Instance Method Details
#detect_objects(cvimg) ⇒ Object
20 21 22 |
# File 'lib/yearbook/classifier.rb', line 20 def detect_objects(cvimg) @classifier.detect_objects(cvimg) end |