Miyagawanize

  • 2,366 views
Uploaded on

 

More in: Business , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,366
On Slideshare
0
From Embeds
0
Number of Embeds
3

Actions

Shares
Downloads
6
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. miyagawanize Yusukebe YAPC::Asia 2009 Lighting Talk
  • 2. 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” .
  • 3. PURPLE THING
  • 4.  
  • 5. 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.
  • 6. 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.
  • 7. #!/usr/bin/perl use strict; use warnings; use Imager; use Image::ObjectDetect;
  • 8. 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;
  • 9. 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' );
  • 10. DEMO
  • 11. Let’s “miyagawanize”, And write a great code! Thanks to Tatsuhiko Miyagawa!!