画像特徴(点、直線、領域)の検出と識別- 2 呉海元@和歌山大学 2007...
DESCRIPTION
画像特徴(点、直線、領域)の検出と識別- 2 呉海元@和歌山大学 2007 年5月 14 日. エッジの検出. 空間フィルタと画像畳み込み. kernel. image. 注意:すべての空間フィルタ内の係数の合計=1. Low-pass filter. 画像平滑化. High-Pass Filter. 画像鮮鋭化. エッジ検出1. 画像中に表示された物理の輪郭( エッジ: edge )や線では、一般的に濃淡が急激に変化 エッジや線の検出処理は、画像理解や認識のための前処理として重要 計算コストが低い 強い視覚の手がかりを提供できる 物体の輪郭 認識できる特徴 - PowerPoint PPT PresentationTRANSCRIPT
画像特徴(点、直線、領域)の検出と識別- 2
呉海元@和歌山大学2007 年5月 14 日
エッジの検出
空間フィルタと画像畳み込み
f(x-1,y-1) f(x-1,y) f(x-1,y+1)
f(x,y-1) f(x,y) f(x,y+1)
f(x+1,y-1) f(x+1,y) f(x+1,y+1)
w(-1,-1) w(-1,0) w(-1,1)
w(0,1) w(0,0) w(0,1)
w(1,-1) w(1,0) w(1,1)
image
kernel
)1,1()1,1(),1()0,1(...),()0,0(
...),1()0,1()1,1()1,1(
yxfwyxfwyxfw
yxfwyxfwR
i
mn
iimnmn fwfwfwfwR
1
2211 ...
注意:すべての空間フィルタ内の係数の合計=1注意:すべての空間フィルタ内の係数の合計=1
Low-pass filter1/9 1/9 1/9
1/9 1/9 1/9
1/9 1/9 1/9
画像平滑化
High-Pass Filter-1 -1 -1
-1 9 -1
-1 -1 -1
画像鮮鋭化
エッジ検出1 画像中に表示された物理の輪郭(エッジ:edge )や線では、一般的に濃淡が急激に変化
エッジや線の検出処理は、画像理解や認識のための前処理として重要
•計算コストが低い•強い視覚の手がかりを提供できる
•物体の輪郭•認識できる特徴•見え隠れ•照明あるいは表面色の不連続性
Edge Types
Different edge models:
Roof edge Concave roof edge
Ramp edge Step edge Bar edge
屋根 凹形 傾斜 階段 棒
画像の勾配( Image gradient ) 画像の勾配 :
各方向の勾配
勾配(エッジ)の方向 :
勾配(エッジ)の大きさ:
画像勾配の離散化
有名な Gradient operators
(a): Roberts’ cross operator (b): 3x3 Prewitt operator(c): Sobel operator (d) 4x4 Prewitt operator
Sobel operator のエッジ検出例-1 -2 -1
-0 0 0
1 2 1
-1 0 1
-2 0 2
-1 0 1
ノイズの影響( Effects of noise )
Consider a single row or column of the image• Plotting intensity as a function of position gives a signal
Where is the edge? 微分するとノイズを強調される
1D
Where is the edge?
エッジ抽出前、まずフィルタ hより平滑化
Look for peaks in
Gaussian
1D
畳み込みの定理より1D
Laplacian of Gaussian Consider
Laplacian of Gaussianoperator
Where is the edge? Zero-crossings of bottom graph
1D
2D エッジ検出フィルタ
is the Laplacian operator:
Laplacian of Gaussian
Gaussian derivative of Gaussian
ノイズを抑制しながらエッジを検出
2
22
2
2
1),(
yx
eyxh
Laplacian operator のエッジ検出例0 1 0
1 -4 1
0 1 0
0 -1 0
-1 4 -1
0 -1 0
1 1 1
1 -8 1
1 1 1
エッジ検出2
様々なオペレータと異なるパラメータより2D 空間フィルタを構成し、エッジを検出
注意:エッジ検出の場合すべてのフィルタ内の係数の合計=0
最適なエッジ検出器 Canny Edge Detector
良いエッジ検出器とは• Good Detection: ノイズに強い• Good Localization: 真のエッジの所を検出• Single Response: 各点に一本のエッジを検
出
Canny Edge Detector の処理手順
1. Gaussian フィルタで画像を平滑化2. 平滑化された画像の微分を計算3. 勾配の大きさと方向を求める4. “Non-maximum Suppression” 処理を行う5. “Hysteresis Threshold” 処理を行う
Canny Edge Detector
1. Gaussian フィルタで画像を平滑化
2.平滑化された画像の微分を計算IyxgyxgIS ),(),(
2
22
2
2
1),(
yx
eyxg
IgIgS
y
x
g
g
y
gx
g
gIg
g
S
SS
y
x
y
x
Ig
Ig
y
x
Canny Edge DetectorDerivative of Gaussian
2
22
2
2
1),(
yx
eyxg
),( yxg x
),( yxg y
Canny Edge Detectorステップ1と2処理後の結果例
xS
ySI入力画像
Canny Edge Detectorステップ3処理後の結果例
3.勾配の大きさと方向を求める
x
y
yx
yx
S
S
SS
SS
1
22
tan
),(
方向
大きさ
勾配ベクトル
入力画像 勾配の大きさ
Canny Edge Detector4.“ Non-maximum Suppression” 処理を
行う
勾配(エッジ)方向に沿って、画素はローカル最大か否かをチェック(非最大エッジ抑制)
yx ,
yx, yx ,
otherwise
if
0
,,&
,,,
, yxSyxS
yxSyxSyxS
yxM
Canny Edge Detector4.“ Non-maximum Suppression” 処理を
行う
勾配(エッジ)方向に沿って、画素 q はローカル最大か否かをチェック(非最大エッジ抑制)するとき• 内挿画素 p と r をチェックすることになる
Canny Edge Detector勾配方向の量子化
41420tan41422-:3
41422|tan|:2
41422tan41420:1
41420tan41420:0
:ons)Quantizati(
.θ.
.θ
.θ.
.θ.-
角度を量子化
x
y
S
Sθ tan
0
12
3
内挿画素の問題を解決するため
次のエッジ点を予測 Assume the marked point is an edge point. Then we construct the tangent to the edge curve (which is normal to the gradient at that point) and use this to predict the next points (here either r or s).
(Forsyth & Ponce)
Canny Edge DetectorNon-Maximum Suppression の処理結
果22yx SSS (細線化)M
25ThresholdM
ionvisualizat For
2 値化処理
Step 3 Step 4
Canny Edge Detector5. “ Hysteresis Threshold” 処理を行う Scan the image from left to right, top-bottom. If the gradient at a pixel is
• above “High”, declare it an ‘edge pixel’• below “Low”, declare it a “non-edge-pixel”
High
low
Gradient magnitude
‘edge pixel’
•“non-edge-pixel”
ヒステリシス閾処理
Canny Edge Detector5. “ Hysteresis Threshold” 処理を行う If the gradient at a pixel is
• between “low” and “high” • Consider its neighbors iteratively then declare it an “edge pix
el” if it is connected to an ‘edge pixel’ directly or via pixels between “low” and “high”.
High
low
Gradient magnitude
‘edge pixel’
•“non-edge-pixel”
ヒステリシス閾処理
Canny Edge Detector “Hysteresis Threshold” 処理を行う
Connectedness
x x x
4 connected 8 connected 6 connected
Canny Edge Detector Hysteresis Threshold 処理結果例
25regular M
15
35
Hysteresis
Low
High
(細線化)M
Step 5
Effect of (Gaussian kernel size)
Canny with Canny with original
The choice of depends on desired behavior• large detects large scale edges• small detects fine features
Canny Edge Detector
Image
gx(x,y)Gradient
magnitude
gy(x,y) Gradientdirection
Non-maximumsuppression
Hysteresis thresholding
出席チェック3Canny Edge Detector の処理流れを述べてください。
OpenCV ではサンプルプログラムがあります。関連パラメータを調整しながら、好きな一枚の画像のエッジを検出してください。レポートには元画像、使ったパラメータと処理後の画像をそれぞれ記述してください。
レポート
提出期限: 3週間以内(講義の時 OR 私の部屋( A612 ))
Gaussian - image filter
Laplacian of Gaussian
Gaussian
delta function