0
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,461

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,461
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Miyagawanize"

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

    Clipping is a handy way to collect important slides you want to go back to later.

×