miyagawanize Yusukebe YAPC::Asia 2009 Lighting Talk
Tatsuhiko Miyagawa <ul><li>One of Super Geeks! </li></ul><ul><li>Every Perl Mongers want to write a code like him. </li></...
PURPLE THING
 
What’s This?? <ul><li>I don’t know what is this purple thing. </li></ul><ul><li>But we need this to be like Tatsuhiko! </l...
How to make “miyagawanize” <ul><li>Make a image of purple thing. </li></ul><ul><li>Install OpenCV library. </li></ul><ul><...
#!/usr/bin/perl use strict; use warnings; use Imager; use Image::ObjectDetect;
my $file = shift or die &quot;image file path is required!&quot;; my $image  = Imager->new->read( file => $file ); my $cas...
for my $face (@faces) { my $purple = $purple_source->scale( xpixels => $face->{width} / $aspect, ypixels => $face->{height...
DEMO
Let’s “miyagawanize”, And write a great code! Thanks to Tatsuhiko Miyagawa!!
Upcoming SlideShare
Loading in …5
×

Miyagawanize

2,910 views
2,704 views

Published on

Published in: Business, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,910
On SlideShare
0
From Embeds
0
Number of Embeds
766
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Miyagawanize

  1. miyagawanize Yusukebe YAPC::Asia 2009 Lighting Talk
  2. Tatsuhiko Miyagawa <ul><li>One of Super Geeks! </li></ul><ul><li>Every Perl Mongers want to write a code like him. </li></ul>But… <ul><li>We can’t be Tatsuhiko. </li></ul><ul><li>Because we lose the “PURPLE THING” . </li></ul>
  3. PURPLE THING
  4.  
  5. What’s This?? <ul><li>I don’t know what is this purple thing. </li></ul><ul><li>But we need this to be like Tatsuhiko! </li></ul><ul><li>So, I made a “miyagawanize” script. </li></ul><ul><li>Like “geek face generator” by Yappo-san. </li></ul>
  6. How to make “miyagawanize” <ul><li>Make a image of purple thing. </li></ul><ul><li>Install OpenCV library. </li></ul><ul><li>Install “Imager” and “Image::ObjectDetect” modules from CPAN. </li></ul><ul><li>Write a short script. </li></ul><ul><li>Run a script. </li></ul>
  7. #!/usr/bin/perl use strict; use warnings; use Imager; use Image::ObjectDetect;
  8. my $file = shift or die &quot;image file path is required!&quot;; 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!!

×