Class: FaceCropper

Inherits:
Object
  • Object
show all
Defined in:
lib/face_cropper.rb,
lib/face_cropper/version.rb,
lib/face_cropper/face_box.rb,
lib/face_cropper/aws_rekognition_face_detector.rb

Defined Under Namespace

Classes: AwsRekognitionFaceDetector, FaceBox

Constant Summary collapse

VERSION =
"0.3.0"

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ FaceCropper

Returns a new instance of FaceCropper.



7
8
9
10
11
12
13
# File 'lib/face_cropper.rb', line 7

def initialize(params)
  @from_bucket = params[:from_bucket]
  @to_bucket   = params[:to_bucket]
  @image_key   = params[:image_key]
  @face_boxis  = params[:face_details]
  @region      = params[:region] || 'us-east-1'
end

Instance Method Details

#crop!Object



15
16
17
18
19
20
# File 'lib/face_cropper.rb', line 15

def crop!
  faces = @face_boxis || detect_faces!

  tmp_original_image_path = download_original_image!
  crop_faces!(faces, tmp_original_image_path)
end