The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::Kaolabo - This module call Kaolabo API (http://kaolabo.com/).

SYNOPSIS

  use WebService::Kaolabo;
  $kaolab = WebService::Kaolabo->new({
                                       target_file  => 'sample.jpg',
                                       apikey       => 'hogefuga'
                                    });

  unless ( $kaolab->scale( xpixels => 50, ypixels => 50, type => 'max') ) {
      warn "Failed scale $WebService::Kaolabo::errstr";
  }

  my $res = $kaolab->access();
  if ( $res->is_success ) {
      warn "Success ";
  }
  
  #$kaolab->unface_area();
  for my $k ( @{$kaolab->face_area()} ){
      $k->{area_number}
      $k->{min_x};
      $k->{min_y};
      $k->{max_x};
      $k->{max_y};
      $k->{point};
  }
  
  my $face_data = $kaolab->face_data;
  for my $f ( @{$face_data} ){
      $f->{face_x};
      $f->{face_y};
      $f->{height};
      $f->{width};
      $f->{right_eye_y};
      $f->{left_eye_y};
  }
  
  $kaolab->effect_face({type=>'box', color=>'#FF0000'});
  $kaolab->write('output.jpg');
  #my $imager = $kaolab->imager;
  #$imager->write(type=>'jpeg', file=>'output.jpg');

METHODS

new({target_file => '...', apikey => '....'})

The image file and api_key are passed. And Create new instance. The image should be JPEG.

access

Call The Kaolab API . The return value is a response object. See HTTP::Response.

scale

Call Imager scale method. See "scale" in Imager::Transformations.

effect_face

This method draws the line or box on the face.

The line is drawn on eyes.

  $kaolab->effect_face({type=>'line', color=>'#FF0000'});

The box is drawn on faces.

  $kaolab->effect_face({type=>'box', color=>'#FF0000'});
write('...')

Write an image to a file.

imager

The Imager instance is returned.

face_area

The image file is delimited to nine areas. Return face area.

unface_area

Return no face area.

ave_face_width

Return average width of all faces.

ave_face_height

Return average height of all faces.

errstr

Error message.

  warn "$WebService::Kaolabo::errstr";

SEE ALSO

Kaolab API http://kaolabo.com/webapi Kaolab http://kaolabo.com/

AUTHOR

Akihito Takeda <takeda.akihito@gmail.com>

LICENCE AND COPYRIGHT

Copyright (c) 2008, Akihito Takeda <takeda.akihito@gmail.com>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.