5
1 吉澤 [email protected], 非常勤講師 大妻女子大学 社会情報学部 画像情報処理論及び演習II 第8回講義 水曜日1限 教室6218 情報デザイン専攻 -フィルタ処理・エッジ強調- セパレート実装、方向フィルタ、形態作用素 Shin Yoshizawa: [email protected] 今日の授業内容 1. 線形フィルタのセパレート実装、Guassianピラミッド. 2. 方向フィルタ、Log-Gaborフィルタと方向ピラミッド. 3. 形態作用素. 4. 演習: Report05今日(12/17)〆切です。 次回は1/7です。 www.riken.jp/brict/Yoshizawa/Lectures/index.html www.riken.jp/brict/Yoshizawa/Lectures/Lec20.pdf Report04の採点結果を取りに来てください. Shin Yoshizawa: [email protected] 復習:周波数操作 変換 入力 画像 ©CG-ARTS協会 出力 画像 逆変換 周波数 処理後の 周波数 処理 Shin Yoshizawa: [email protected] 復習: FDCTによる周波数分解 全ての周波数バンドを足し合わせると入力になる. = + + + + + + + + + = 低周波 高周波 周波数領域 + + + + + + + + + 低周波 高周波 + ベースの 低周波 + Shin Yoshizawa: [email protected] 復習: DoG+FDCTによる周波数分解 = + + + + + + + + + 高周波 低周波 全ての周波数バンドを足し合わせると入力になる. = 周波数領域 + 高周波 低周波 + + + + + + + + 余り: 1-G + ベースの 低周波 + 復習:線形フィルタ Shin Yoshizawa: [email protected] 線形フィルタ(畳み込み和、Convolution): y y x x h h m h h n n m h n j m i f j i I ) , ( ) , ( ) , ( ) 1 2 ( ) 1 2 ( x y h h ) , ( j i y h 出力画像 I 入力画像 f カーネル画像:フィルタ h i j フィルタを適用している画素の座標値 ) , ( j i m n y h カーネル画像(局所Window)サイズ: ) , ( n m ) 0 , 0 ( ) , ( n j m i ) 0 , 0 ( x h x h 入力画像 カーネル 画像

情報デザイン専攻 画像情報処理論及び演習II画像情報処理論及び演習II 第8回講義 ... -Closing(穴埋め): ©Steven W. Smith Structuring Element はグレー

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 情報デザイン専攻 画像情報処理論及び演習II画像情報処理論及び演習II 第8回講義 ... -Closing(穴埋め): ©Steven W. Smith Structuring Element はグレー

1

吉澤 信[email protected], 非常勤講師

大妻女子大学 社会情報学部

画像情報処理論及び演習II

第8回講義

水曜日1限

教室6218

情報デザイン専攻

-フィルタ処理・エッジ強調-セパレート実装、方向フィルタ、形態作用素

Shin Yoshizawa: [email protected]

今日の授業内容

1. 線形フィルタのセパレート実装、Guassianピラミッド.

2. 方向フィルタ、Log-Gaborフィルタと方向ピラミッド.

3. 形態作用素.

4. 演習: Report05、今日(12/17)〆切です。

次回は1/7です。

www.riken.jp/brict/Yoshizawa/Lectures/index.htmlwww.riken.jp/brict/Yoshizawa/Lectures/Lec20.pdf

Report04の採点結果を取りに来てください.

Shin Yoshizawa: [email protected]

復習:周波数操作

変換入力画像

©CG-ARTS協会

出力画像

逆変換周波数

処理後の周波数

処理

Shin Yoshizawa: [email protected]

復習: FDCTによる周波数分解

全ての周波数バンドを足し合わせると入力になる.

= + + + +

+ + + ++

=

低周波

高周波

周波数領域

+

+

+

+

+

+

+

++

低周波

高周波

+ベースの低周波

+

Shin Yoshizawa: [email protected]

復習: DoG+FDCTによる周波数分解

=

+ + + + +

+ + + +

高周波

低周波 全ての周波数バンドを足し合わせると入力になる.

=

周波数領域

+高周波

低周波

+

+

+

+

+

+

+

+

余り:1-G

+ベースの低周波

+

復習:線形フィルタShin Yoshizawa: [email protected]

線形フィルタ(畳み込み和、Convolution):

y

y

x

x

h

hm

h

hn

nmhnjmifjiI ),(),(),(

)12()12( xy hh

),( ji

yh

出力画像I 入力画像fカーネル画像:フィルタh

i

j

フィルタを適用している画素の座標値),( ji

m

n

yh

カーネル画像(局所Window)サイズ:

),( nm)0,0(

),( njmi

)0,0(

xh xh

入力画像

カーネル画像

Page 2: 情報デザイン専攻 画像情報処理論及び演習II画像情報処理論及び演習II 第8回講義 ... -Closing(穴埋め): ©Steven W. Smith Structuring Element はグレー

2

復習:線形フィルタShin Yoshizawa: [email protected]

線形フィルタ(畳み込み和、Convolution):

y

y

x

x

h

hm

h

hn

nmhnjmifjiI ),(),(),(

fの重み付和=fとhの対応画素値の積和=線形フィルタ.

If

h

y

y

x

x

h

hm

h

hn

nmhnjmifjiI ),(),(),(

セパレート実装Shin Yoshizawa: [email protected]

1次元フィルタを次元(方向)別にn回適用してn次元線形畳み込みを効率よく適用する実装方法.

- 線形フィルタ(畳み込み和):

出力画像I 入力画像fカーネル画像:フィルタh

y

y

x

x

h

hm

h

hnxy nhnjmifmhjiI )(),()(),(

もしも分離可能なら↓ )()(),( nhmhnmh xy

セパレート実装2Shin Yoshizawa: [email protected]

例えば、2次元のアルゴリズムはx方向のフィルタ結果へy方向のフィルタを適用する.

y

y

x

x

h

hm

h

hnxy nhnjmifmhjiI )(),()(),(

12 xh

12 yh

x

x

h

hnx nhnjifjitmp )(),(),(

y

y

h

hmy mhjmifjiI )(),(),(

);,()(),(

)(

)(

)(

njifnhjitmp

nfor

jfor

ifor

);,()(),(

)(

)(

)(

jmitmpmhjiI

mfor

ifor

jfor

X方向のフィルタ Y方向のフィルタ

セパレート実装3Shin Yoshizawa: [email protected]

計算量は画像の縦横をsy,sxとすると、

例1:ソーベル作用素は、9/6=1.5倍:

hx, hyが大きいほど効率的→Gaussianフィルタ.

))1(2())12)(12(( yxyxyxyx sshhOsshhO

1

2

1

*101

101

202

101

121*

1

0

1

121

000

121

6)1(2,9)12)(12(1 yxyxyx hhhhhh

1

)12)(12(2

yx

yx

hh

hh倍 2

12 h hhh yx 倍速度

セパレート実装4Shin Yoshizawa: [email protected]

例2:Gaussianフィルタ:

2

12 h倍なので、もし半径h=100なら約100倍速い!

dudvvugvyuxfyxI ),(),(),(

- 分離:

)()(

))2

exp(2

1))(

2exp(

2

1(

)2

exp(2

1),(

2

2

2

2

2

22

2

ygxg

yx

yxyxg

高次元のGaussianは低次元Gaussianの積.

y

y

x

x

h

hm

h

hn

ngnjmifmgjiI )(),()(),(

)()(),( nhmhnmh xy が重要.

Ex13.zip内のSeparableGaussian.cxxに実際の実装があります.

Shin Yoshizawa: [email protected]

Gaussianピラミッド

.,)](*[ 01 fgkGgg kk

例3:Gaussianピラミッド作成時のExpandとReduce操作.

5-tap filer:

1464116

1

Page 3: 情報デザイン専攻 画像情報処理論及び演習II画像情報処理論及び演習II 第8回講義 ... -Closing(穴埋め): ©Steven W. Smith Structuring Element はグレー

3

Shin Yoshizawa: [email protected]

方向微分

通常の座標軸に沿った方向の微分(微小変化率)ではなく、任意の方向(ベクトル)に沿った微分.

勾配と方向微分したいベクトルとの内積.

例えば、LoGや

DoGを与えられた

方向に適用しても

OK!

tt

x

ff )(

Shin Yoshizawa: [email protected]

方向(Orientation) フィルタ

方向特徴フィルタ(log Gabor).

))cos())(sin(()exp( iGiG tx

Imaginary

Real

4方向の例

2/12imaginary

2real )( ff

角度:0 45 90 135

Quadrature Filter Set Kternels:

Real and Imaginary

Kernel画像

畳み込み結果

畳み込み結果

Kernel画像

強度

方向特徴フィルタ(log Gabor)によるOrientation Pyramid.

Shin Yoshizawa: [email protected]

Steerable Pyramid

+

Shin Yoshizawa: [email protected]

Steerable Pyramid

©www.filiprooms.be

Flat Structuring Element (SE)と呼ばれる二値化画像(Binary Image: b)の内側の輝度値の最小値・最大値等で、評価画素の輝度値を置き換える.

Shin Yoshizawa: [email protected]

形態作用素(Morphological Operator)

- Erosion(収縮):

- Dilation(膨張):

- Opening(穴あけ):

- Closing(穴埋め):

©Steven W. Smith

Structuring Element はグレースケール画像でもよいが本講義では取り扱わない.

Flat Structuring Element (SE)と呼ばれる二値化画像(Binary Image: b)の内側の輝度値の最小値・最大値等で、評価画素の輝度値を置き換える.

Shin Yoshizawa: [email protected]

形態作用素(Morphological Operator)2

),( ji

入力画像

- Erosion(収縮):

- Dilation(膨張):

- Opening(穴あけ):

- Closing(穴埋め):

- Top Hat:

- Bottom Hat:

Structuring Element )}({min)]([ txx

t

fbf

b

)}({max)]([ txxt

fbfb

]][[)( bbfbf

]][[)( bbfbf

)()(hat bfffT

fbffB )()(hat©wikipwdia

SEは円をよく使う.Ex13.zip内のMorphologicalOperators.hに実装があります.

Page 4: 情報デザイン専攻 画像情報処理論及び演習II画像情報処理論及び演習II 第8回講義 ... -Closing(穴埋め): ©Steven W. Smith Structuring Element はグレー

4

Shin Yoshizawa: [email protected]

Erosion

)}({min)]([ txxt

fbfb

Erosion(収縮): 白い部分がSE分だけ収縮する.

Minフィルタと同じ.

Structured Elementは円でその半径rが1r 2r 3r 4r 5r 10r

Shin Yoshizawa: [email protected]

Dilation

Dilation(膨張): 白い部分がSE分だけ膨張する.

Maxフィルタと同じ.

Structured Elementは円でその半径rが1r 2r 3r 4r 5r 10r

)}({max)]([ txxt

fbfb

Shin Yoshizawa: [email protected]

Opening

Opening(穴あけ):白に黒い穴がSE分だけあく.

Erosion後にDilation.

Structured Elementは円でその半径rが4r 8r 16r 20r 32r

]][[)( bbfbf

1r 2r 3r 4r 5r 10r

Shin Yoshizawa: [email protected]

Closing

Closing(穴埋め):白に黒い穴がSE分だけ埋まる.

Dilation後にErosion.

Structured Elementは円でその半径rが4r 8r 16r 20r 32r

1r 2r 3r 4r 5r 10r

]][[)( bbfbf

Shin Yoshizawa: [email protected]

Top Hat

TopHat: 穴あけで消えた部分を強調:

入力からOpeningを引く.

Structured Elementは円でその半径rが3r 4r 5r 10r 20r 30r

)()(hat bfffT

Shin Yoshizawa: [email protected]

Top Hat2

Shading Correctionに非常によい.

入力画像 大津の二値化 TopHat画像 大津の二値化

5r

20r

Page 5: 情報デザイン専攻 画像情報処理論及び演習II画像情報処理論及び演習II 第8回講義 ... -Closing(穴埋め): ©Steven W. Smith Structuring Element はグレー

5

Shin Yoshizawa: [email protected]

Bottom Hat

BottomHat: 穴埋めで消えた部分を強調.

Closingから入力を引く.

Structured Elementは円でその半径rが3r 4r 5r 10r 20r 30r

fbffB )()(hat

Shin Yoshizawa: [email protected]

Bottom Hat2

Shading Correctionに非常によい.

入力画像 大津の二値化 BottomHat画像 大津の二値化

5r

20r

Shin Yoshizawa: [email protected]

Morphologicalフィルタ

©wikipwdia

©inf.ed.ac.uk

Shin Yoshizawa: [email protected]

演習: 形態フィルタ

www.riken.jp/brict/Yoshizawa/Lectures/index.html

www.riken.jp/brict/Yoshizawa/Lectures/Lec20.pdf

www.riken.jp/brict/Yoshizawa/Lectures/Ex13.zip

前回までの内容=Report05(今日〆切)の内容が出来ていない人はそちらを先にやりましょう!

makeでコンパイル後にプログラムを各.cxxを見て実行してみましょう!

- Gaussianフィルタのセパレート実装.- 形態作用素.

次回は1/7です。Report04の採点結果を取りに来てください.