Movatterモバイル変換


[0]ホーム

URL:


Yusuke Wada, profile picture
Uploaded byYusuke Wada
3,451 views

画像Hacks

The document shows code for processing images using the Imager module in Perl. It demonstrates scaling, cropping, mapping color values, combining images using rubthrough, adding text with QR codes, detecting differences between images, and detecting faces in an image using a cascade classifier. It also includes code to search for adult video actresses from a porn module.

Embed presentation

Downloaded 33 times
use strict;use warnings;use Imager;my $file = 'doya.jpg';my $image = Imager->new( file => $file ) or die Imager->errstr;$image = $image->scale( xpixels => 100 );$image->write( file => 'out.jpg' ) or die $image->errstr;
...;my $image = Imager->new( file => $file ) or die Imager->errstr;$image = $image->scale( xpixels => 100 );$image = $image->crop( height => 100 ); #$image->write( file => 'out.jpg' ) or die $image->errstr;...;
sub get_map {    my $gamma = shift;    my @map =          map { int( 0.5 + 255 * ( $_ / 255 )**$gamma ) } 0 .. 255;    return @map;}$image->map(    red   => get_map(0.5),    green => get_map(0.65),    blue => get_map(0.8));my $waku = Imager->new( file => 'waku.png' );$image->rubthrough( src => $waku );
...;my $font = Imager::Font->new( file => 'HiraKakuPro-W3.ttf' );...;
...;       my $qrcode = Imager::QRCode->new(           size          => 3,           margin        => 0,           version       => 1,           level         => 'M',           casesensitive => 1,           lightcolor    => Imager::Color->new( 255, 255, 255 ),           darkcolor     => Imager::Color->new( 35, 54, 92 ),       );       my $qr = $qrcode->plot( $text );       $qr = $qr->scale( xpixels => 90 );       $image = $image->paste( left => 590, top => 198, src => $qr );...;
ff
...;       my $diff = $org->difference( other => $numbers[$n] );       $diff = $diff->to_rgb8;       my $count;       for ( my $x = 0 ; $x < $width ; $x++ ) {           for ( my $y = 0 ; $y < 38 ; $y++ ) {               my $pixel = $diff->getpixel( x => $x, y => $y );               next unless $pixel;               my $result = $pixel->rgba;               $count++ if $result == 255;           }       }...;
use Imager;use Image::ObjectDetect;my   $image      =   Imager->new->read( file => 'picture.jpg' );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' );
•    –    –•    –    –
••    –        •    –        ••    –        •        •        •
use Acme::Porn::JP;…;my $porn = Acme::Porn::JP->new;my $actress_list = $porn->actress();for my $actress ( @$actress_list ){    search("$query $actress”);}…;$ perl -MAcme::Porn::JP -e '$p = Ace::Porn::JP->new; printscalar @{$p->actress};’4502
••    –    –••    –•        positive.dat        [filename]  [#  of  objects]  [[x  y  width  height]  [...  2nd  object]  ...]        images/01.jpg  1  140  100  45  45        nega%ve.dat        images/neg-­‐01.jpg        images/neg-­‐02.jpg
画像Hacks
画像Hacks
画像Hacks
画像Hacks
画像Hacks
画像Hacks
画像Hacks

Recommended

PPT
An Elephant of a Different Colour: Hack
ODT
linieaire regressie
KEY
テストデータどうしてますか?
RTF
distill
PPTX
Mootools selectors
PDF
PhoneGap: Local Storage
PDF
WordPress 3.1 at DC PHP
PPTX
Oh, you’re the NY times guy
PDF
Doctrine fixtures
PDF
The Art of Transduction
PDF
PHP for Python Developers
PPTX
Coding Horrors
PPTX
11. CodeIgniter vederea unei singure inregistrari
KEY
Crazy things done on PHP
PDF
PHP object calisthenics
PPTX
Автотесты для картинок
PPTX
12. edit record
PPTX
11. delete record
PPTX
10. view one record
PPTX
8. vederea inregistrarilor
PDF
Perlで実装されたLINE NEWSの裏側
PDF
Et si on en finissait avec CRUD ?
PDF
Code moi une RH! (PHP tour 2017)
PDF
Devs for Leokz e 7Masters - WTF Oriented Programming
DOC
The Truth About Lambdas in PHP
PPT
Google Visualization API
PPT
Database api
PDF
Nette framework (WebElement #27 lightning talk)
PDF
Transformative Web Design ~変化にしなやかに対応するデザイン力~
PDF
解析データの分析と活用

More Related Content

PPT
An Elephant of a Different Colour: Hack
ODT
linieaire regressie
KEY
テストデータどうしてますか?
RTF
distill
PPTX
Mootools selectors
PDF
PhoneGap: Local Storage
PDF
WordPress 3.1 at DC PHP
PPTX
Oh, you’re the NY times guy
An Elephant of a Different Colour: Hack
linieaire regressie
テストデータどうしてますか?
distill
Mootools selectors
PhoneGap: Local Storage
WordPress 3.1 at DC PHP
Oh, you’re the NY times guy

What's hot

PDF
Doctrine fixtures
PDF
The Art of Transduction
PDF
PHP for Python Developers
PPTX
Coding Horrors
PPTX
11. CodeIgniter vederea unei singure inregistrari
KEY
Crazy things done on PHP
PDF
PHP object calisthenics
PPTX
Автотесты для картинок
PPTX
12. edit record
PPTX
11. delete record
PPTX
10. view one record
PPTX
8. vederea inregistrarilor
PDF
Perlで実装されたLINE NEWSの裏側
PDF
Et si on en finissait avec CRUD ?
PDF
Code moi une RH! (PHP tour 2017)
PDF
Devs for Leokz e 7Masters - WTF Oriented Programming
DOC
The Truth About Lambdas in PHP
PPT
Google Visualization API
PPT
Database api
PDF
Nette framework (WebElement #27 lightning talk)
Doctrine fixtures
The Art of Transduction
PHP for Python Developers
Coding Horrors
11. CodeIgniter vederea unei singure inregistrari
Crazy things done on PHP
PHP object calisthenics
Автотесты для картинок
12. edit record
11. delete record
10. view one record
8. vederea inregistrarilor
Perlで実装されたLINE NEWSの裏側
Et si on en finissait avec CRUD ?
Code moi une RH! (PHP tour 2017)
Devs for Leokz e 7Masters - WTF Oriented Programming
The Truth About Lambdas in PHP
Google Visualization API
Database api
Nette framework (WebElement #27 lightning talk)

Viewers also liked

PDF
Transformative Web Design ~変化にしなやかに対応するデザイン力~
PDF
解析データの分析と活用
PDF
マークアップエンジニア だからうれしい Fireworksの使い方あれこれ
KEY
WordPressコミュニティの魅力 | OSC Nagoya 2012 WordBench Nagoya
PDF
リサーチャーとマーケター原稿2012326
PDF
最新開発支援ツールを使ったデバッグ対応
PDF
The Craft of UX
PDF
デザイナーがエンジニアさんと楽しくデザイン実装の話をするために
PDF
3D printing for Development Hack Day in Bucharest, session 1
PPTX
Debugging mobile websites and web apps
PDF
WebフレームワークXSS対策の自動化
PDF
Simple Pure Java
PDF
『デザイニング・インターフェース』読書会資料
PDF
Developing with Phonegap - Adobe Refresh 2012
PDF
言語の世界
PDF
これから求められるWebコミュニケーションスキル 〜今日から始めるプロトタイプデザイン
PPTX
6 Key Elements to a Good Website
 
PDF
PDF
デジタルインテリジェンスの「構想力」
PDF
【16-D-4】3分ではじめるスマホアプリのビジュアル開発
Transformative Web Design ~変化にしなやかに対応するデザイン力~
解析データの分析と活用
マークアップエンジニア だからうれしい Fireworksの使い方あれこれ
WordPressコミュニティの魅力 | OSC Nagoya 2012 WordBench Nagoya
リサーチャーとマーケター原稿2012326
最新開発支援ツールを使ったデバッグ対応
The Craft of UX
デザイナーがエンジニアさんと楽しくデザイン実装の話をするために
3D printing for Development Hack Day in Bucharest, session 1
Debugging mobile websites and web apps
WebフレームワークXSS対策の自動化
Simple Pure Java
『デザイニング・インターフェース』読書会資料
Developing with Phonegap - Adobe Refresh 2012
言語の世界
これから求められるWebコミュニケーションスキル 〜今日から始めるプロトタイプデザイン
6 Key Elements to a Good Website
 
デジタルインテリジェンスの「構想力」
【16-D-4】3分ではじめるスマホアプリのビジュアル開発

More from Yusuke Wada

PDF
僕がつくった 70個のうちの48個のWebサービス達
PDF
スッとGoを取り入れる
PDF
東京脱出計画中
PDF
Extreme remote working
PDF
Podcastを支える技術、エンジニアのためのWebメディア、そしてCPAN
PDF
創造のプロセスを回せ!v0.01
PDF
It's not only about "REMOTE"
PDF
事故からはじまるスケールチャンス
PDF
Google BigQueryを使ってみた!
PDF
Webサービスのコンテンツパターン 或いはデータの活⽤
PDF
とある Perl Monger の働き方
PDF
5 minutes - YAPC::Asia Tokyo 2014
PDF
Podcastをカジュアルに 支える技術
PDF
The master plan of scaling a web application
PDF
そのWebサービスは本当に「あたりまえ」だったのか?
PDF
Mojoliciousでつくる! Webアプリ入門
PDF
10 things to learn from Bokete
PDF
Inside Bokete: Web Application with Mojolicious and others
PDF
僕らの履歴書
PDF
僕らがWebサービスをつくる5つの理由
僕がつくった 70個のうちの48個のWebサービス達
スッとGoを取り入れる
東京脱出計画中
Extreme remote working
Podcastを支える技術、エンジニアのためのWebメディア、そしてCPAN
創造のプロセスを回せ!v0.01
It's not only about "REMOTE"
事故からはじまるスケールチャンス
Google BigQueryを使ってみた!
Webサービスのコンテンツパターン 或いはデータの活⽤
とある Perl Monger の働き方
5 minutes - YAPC::Asia Tokyo 2014
Podcastをカジュアルに 支える技術
The master plan of scaling a web application
そのWebサービスは本当に「あたりまえ」だったのか?
Mojoliciousでつくる! Webアプリ入門
10 things to learn from Bokete
Inside Bokete: Web Application with Mojolicious and others
僕らの履歴書
僕らがWebサービスをつくる5つの理由

Recently uploaded

PPTX
Data Privacy and Protection: Safeguarding Information in a Connected World
PDF
Six Shifts For 2026 (And The Next Six Years)
DOCX
Introduction to the World of Computers (Hardware & Software)
PDF
Day 5 - Red Team + Blue Team in the Cloud - 2nd Sight Lab Cloud Security Class
PDF
DIGITAL FORENSICS - Notes for Everything.pdf
PDF
Accelerating Responsible AI Adoption in Public Sector and Private Organizations.
PDF
Eredità digitale sugli smartphone: cosa resta di noi nei dispositivi mobili
PDF
Usage Control for Process Discovery through a Trusted Execution Environment
PDF
GPUS and How to Program Them by Manya Bansal
PDF
The year in review - MarvelClient in 2025
PPTX
THIS IS CYBER SECURITY NOTES USED IN CLASS ON VARIOUS TOPICS USED IN CYBERSEC...
PDF
Greetings All Students Update 3 by Mia Corp
PPTX
Cybersecurity Best Practices - Step by Step guidelines
PDF
Session 1 - Solving Semi-Structured Documents with Document Understanding
PDF
Vibe Coding vs. Spec-Driven Development [Free Meetup]
PDF
Zero Trust & Defense-in-Depth: The Future of Critical Infrastructure Security
PDF
Energy Storage Landscape Clean Energy Ministerial
PPT
software-security-intro in information security.ppt
PDF
Dev Dives: AI that builds with you - UiPath Autopilot for effortless RPA & AP...
PPTX
AI in Cybersecurity: Digital Defense by Yasir Naveed Riaz
Data Privacy and Protection: Safeguarding Information in a Connected World
Six Shifts For 2026 (And The Next Six Years)
Introduction to the World of Computers (Hardware & Software)
Day 5 - Red Team + Blue Team in the Cloud - 2nd Sight Lab Cloud Security Class
DIGITAL FORENSICS - Notes for Everything.pdf
Accelerating Responsible AI Adoption in Public Sector and Private Organizations.
Eredità digitale sugli smartphone: cosa resta di noi nei dispositivi mobili
Usage Control for Process Discovery through a Trusted Execution Environment
GPUS and How to Program Them by Manya Bansal
The year in review - MarvelClient in 2025
THIS IS CYBER SECURITY NOTES USED IN CLASS ON VARIOUS TOPICS USED IN CYBERSEC...
Greetings All Students Update 3 by Mia Corp
Cybersecurity Best Practices - Step by Step guidelines
Session 1 - Solving Semi-Structured Documents with Document Understanding
Vibe Coding vs. Spec-Driven Development [Free Meetup]
Zero Trust & Defense-in-Depth: The Future of Critical Infrastructure Security
Energy Storage Landscape Clean Energy Ministerial
software-security-intro in information security.ppt
Dev Dives: AI that builds with you - UiPath Autopilot for effortless RPA & AP...
AI in Cybersecurity: Digital Defense by Yasir Naveed Riaz

画像Hacks

  • 5.
    use strict;use warnings;useImager;my $file = 'doya.jpg';my $image = Imager->new( file => $file ) or die Imager->errstr;$image = $image->scale( xpixels => 100 );$image->write( file => 'out.jpg' ) or die $image->errstr;
  • 6.
    ...;my $image =Imager->new( file => $file ) or die Imager->errstr;$image = $image->scale( xpixels => 100 );$image = $image->crop( height => 100 ); #$image->write( file => 'out.jpg' ) or die $image->errstr;...;
  • 11.
    sub get_map { my $gamma = shift; my @map = map { int( 0.5 + 255 * ( $_ / 255 )**$gamma ) } 0 .. 255; return @map;}$image->map( red => get_map(0.5), green => get_map(0.65), blue => get_map(0.8));my $waku = Imager->new( file => 'waku.png' );$image->rubthrough( src => $waku );
  • 20.
    ...;my $font =Imager::Font->new( file => 'HiraKakuPro-W3.ttf' );...;
  • 21.
    ...; my $qrcode = Imager::QRCode->new( size => 3, margin => 0, version => 1, level => 'M', casesensitive => 1, lightcolor => Imager::Color->new( 255, 255, 255 ), darkcolor => Imager::Color->new( 35, 54, 92 ), ); my $qr = $qrcode->plot( $text ); $qr = $qr->scale( xpixels => 90 ); $image = $image->paste( left => 590, top => 198, src => $qr );...;
  • 25.
  • 26.
    ...; my $diff = $org->difference( other => $numbers[$n] ); $diff = $diff->to_rgb8; my $count; for ( my $x = 0 ; $x < $width ; $x++ ) { for ( my $y = 0 ; $y < 38 ; $y++ ) { my $pixel = $diff->getpixel( x => $x, y => $y ); next unless $pixel; my $result = $pixel->rgba; $count++ if $result == 255; } }...;
  • 32.
    use Imager;use Image::ObjectDetect;my $image = Imager->new->read( file => 'picture.jpg' );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' );
  • 40.
    – –• – –
  • 41.
    •• – • – •• – • • •
  • 42.
    use Acme::Porn::JP;…;my $porn= Acme::Porn::JP->new;my $actress_list = $porn->actress();for my $actress ( @$actress_list ){ search("$query $actress”);}…;$ perl -MAcme::Porn::JP -e '$p = Ace::Porn::JP->new; printscalar @{$p->actress};’4502
  • 44.
    •• – –•• –• positive.dat [filename]  [#  of  objects]  [[x  y  width  height]  [...  2nd  object]  ...] images/01.jpg  1  140  100  45  45 nega%ve.dat images/neg-­‐01.jpg images/neg-­‐02.jpg

[8]ページ先頭

©2009-2025 Movatter.jp