Class: FaceDetect::Face

Inherits:
Object
  • Object
show all
Defined in:
lib/face_detect/face.rb

Constant Summary collapse

LANDMARK_NAMES =
i(
  left_eye
  right_eye
  left_of_left_eyebrow
  right_of_left_eyebrow
  left_of_right_eyebrow
  right_of_right_eyebrow
  midpoint_between_eyes
  nose_tip
  upper_lip
  lower_lip
  mouth_left
  mouth_right
  mouth_center
  nose_bottom_right
  nose_bottom_left
  nose_bottom_center
  left_eye_top_boundary
  left_eye_right_corner
  left_eye_bottom_boundary
  left_eye_left_corner
  right_eye_top_boundary
  right_eye_right_corner
  right_eye_bottom_boundary
  right_eye_left_corner
  left_eyebrow_upper_midpoint
  right_eyebrow_upper_midpoint
  left_ear_tragion
  right_ear_tragion
  left_eye_pupil
  right_eye_pupil
  forehead_glabella
  chin_gnathion
  chin_left_gonion
  chin_right_gonion
).to_set.freeze

Instance Method Summary collapse

Constructor Details

#initialize(landmarks_by_name = {}) ⇒ Face



45
46
47
48
49
50
51
52
# File 'lib/face_detect/face.rb', line 45

def initialize(landmarks_by_name={})
  landmarks_by_name.each do |name, landmark|
    unless LANDMARK_NAMES.include?(name.to_sym)
      raise "'#{name}' not a valid landmark name."
    end
    instance_variable_set("@#{name}", landmark)
  end
end