天然パーマです。

"miyagawanize" ( talk in YAPC::Asia 2009 )

Miyagawa-san is one of super geeks! Every Perl Mongers want to write codes like him.

But...

We can't be Miyagawa-san. Because we lose the 'PURPLE THING'.

PURPLE THING

This.

miyagawanize

This.

miyagawanize

I don't know what is this. But we need this to be like Miyagawa-san.

So, I made the 'miyagawanize' script that is very short.

miyagawanize.pl

 #!/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' );

Hot to use 'miyagawanize'

  1. Install OpenCV library.
  2. Install 'Imager' and 'Image::ObjectDetect' modules from cpan.
  3. Run the 'miyagawanize' script.

Demonstration

Larry is miyagawanized in my talk session.

miyagawanize

( This photo was taken by Sartak. Thanks. )

How about Obama ? Obama is not geek. But now we have the 'miyagawanize' script !

Can we miyagawanize him ??

Yes, we can !

miyagawanize

Finally I'll show you interesting miyagawanization. My father were in YAPC for our presentaion. I took a precious picture of him and Miyagawa-san.

miyagawanize

Now, miyagawanize my father and Miyagawa-san !

miyagawanize

That's all. Let's miyagawanize and write a great code!

Slide used in Lightning Talk

References

Special Thanks to...

Miyagawa-san!

Books written by Miyagawa-san

Perlデータマンジング―データ加工のテクニック集
posted with yusukebe.com::AmazonSearch on 2009.9.13
  • デイビッド クロス
  • 単行本 / ピアソンエデュケーション
  • Amazon 売り上げランキング: 275267
  • Amazon おすすめ度の平均: 4.5
    • 4 便利なすぐ使えるイディオム満載
    • 5 一課に一冊
Amazon.co.jpで詳細を見る

Blog Hacks ―プロが教えるテクニック&ツール100選
posted with yusukebe.com::AmazonSearch on 2009.9.13
  • 宮川 達彦 伊藤 直也
  • 単行本 / オライリー・ジャパン
  • Amazon 売り上げランキング: 262674
  • Amazon おすすめ度の平均: 4.5
    • 5 100に絞るところがよいかも
    • 5 大好きな一冊!!
    • 5 日本発のHACKS
    • 4 日本発のオライリー本を評価したい
    • 5 Blogいじりをする方必読
Amazon.co.jpで詳細を見る

まるごとPerl! Vol.1
posted with yusukebe.com::AmazonSearch on 2009.9.13
  • 小飼 弾 宮川 達彦 伊藤 直也 川合 孝典 水野 貴明
  • 大型本 / インプレスコミュニケーションズ
  • Amazon 売り上げランキング: 168992
  • Amazon おすすめ度の平均: 5.0
    • 5 技術書・解説書というよりはマイルストーン
Amazon.co.jpで詳細を見る