Your SlideShare is downloading. ×
0
Miyagawanize
Miyagawanize
Miyagawanize
Miyagawanize
Miyagawanize
Miyagawanize
Miyagawanize
Miyagawanize
Miyagawanize
Miyagawanize
Miyagawanize
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Miyagawanize

2,443

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,443
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
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 <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. &nbsp;
  • 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 &amp;quot;image file path is required!&amp;quot;; my $image = Imager-&gt;new-&gt;read( file =&gt; $file ); my $cascade = &apos;./haarcascade_frontalface_alt2.xml&apos;; my $detector = Image::ObjectDetect-&gt;new($cascade); my @faces = $detector-&gt;detect($file); my $purple_source = Imager-&gt;new-&gt;read(file =&gt; &apos;./purple.png&apos;); my $aspect = 1.5;
  • 9. for my $face (@faces) { my $purple = $purple_source-&gt;scale( xpixels =&gt; $face-&gt;{width} / $aspect, ypixels =&gt; $face-&gt;{height} / $aspect, ); $image-&gt;rubthrough( tx =&gt; $face-&gt;{width} / $aspect / 2 + $face-&gt;{x}, ty =&gt; $face-&gt;{height} / $aspect + $face-&gt;{y}, src =&gt; $purple, ); } $image-&gt;write( file =&gt; &apos;./output.jpg&apos; );
  • 10. DEMO
  • 11. Let’s “miyagawanize”, And write a great code! Thanks to Tatsuhiko Miyagawa!!

×