• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Miyagawanize
 

Miyagawanize

on

  • 3,079 views

 

Statistics

Views

Total Views
3,079
Views on SlideShare
2,346
Embed Views
733

Actions

Likes
0
Downloads
6
Comments
0

6 Embeds 733

http://yusukebe.com 550
http://kamawada.com 167
http://webcache.googleusercontent.com 7
http://yusukebe.typepad.jp 6
http://www.slideshare.net 2
http://webryreader.sso.biglobe.ne.jp 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Miyagawanize Miyagawanize Presentation Transcript

    • miyagawanize Yusukebe YAPC::Asia 2009 Lighting Talk
    • Tatsuhiko Miyagawa
      • One of Super Geeks!
      • Every Perl Mongers want to write a code like him.
      But…
      • We can’t be Tatsuhiko.
      • Because we lose the “PURPLE THING” .
    • PURPLE THING
    •  
    • What’s This??
      • I don’t know what is this purple thing.
      • But we need this to be like Tatsuhiko!
      • So, I made a “miyagawanize” script.
      • Like “geek face generator” by Yappo-san.
    • How to make “miyagawanize”
      • Make a image of purple thing.
      • Install OpenCV library.
      • Install “Imager” and “Image::ObjectDetect” modules from CPAN.
      • Write a short script.
      • Run a script.
    • #!/usr/bin/perl use strict; use warnings; use Imager; use Image::ObjectDetect;
    • my $file = shift or die "image file path is required!"; my $image = Imager->new->read( file => $file ); my $cascade = './haarcascade_frontalface_alt2.xml'; my $detector = Image::ObjectDetect->new($cascade); my @faces = $detector->detect($file); my $purple_source = Imager->new->read(file => './purple.png'); my $aspect = 1.5;
    • for my $face (@faces) { my $purple = $purple_source->scale( xpixels => $face->{width} / $aspect, ypixels => $face->{height} / $aspect, ); $image->rubthrough( tx => $face->{width} / $aspect / 2 + $face->{x}, ty => $face->{height} / $aspect + $face->{y}, src => $purple, ); } $image->write( file => './output.jpg' );
    • DEMO
    • Let’s “miyagawanize”, And write a great code! Thanks to Tatsuhiko Miyagawa!!