## What Causes Intensity Changes? 是什麼導致強度變化？​

• Geometric events 幾何事件
• surface orientation (boundary) discontinuities 表面方向（邊界）不連續
• depth discontinuities 深度不連續
• color and texture discontinuities 顏色和紋理不連續
• Non-geometric events 非幾何事件
• illumination changes 照明變化
• specularities 鏡面反射
• inter-reflections 互相反射

## Goal of Edge Detection 邊緣檢測的目標​

• Produce a line "drawing" of a scene from an image of that scene. 從場景的圖像中產生場景的線條圖。

## Why is Edge Detection Useful? 為什麼邊緣檢測有用？​

• Important features can be extracted from the edges of an image (e.g., corners, lines, curves). 重要的特徵可以從圖像的邊緣中提取出來（例如，拐角，線，曲線）。
• These features are used by higher-level computer vision algorithms (e.g., recognition). 這些特徵被更高級的電腦視覺算法使用（例如，識別）。

## Edge Descriptors 邊緣描述符​

• Edge direction: perpendicular to the direction of maximum intensity change (i.e., edge normal) 邊緣方向：垂直於最大強度變化的方向（即邊緣法線）

• Edge strength: related to the local image contrast along the normal. 邊緣強度：與沿法線的本地圖像對比相關。

• Edge position: the image position at which the edge is located. 邊緣位置：圖像位置在邊緣所在的位置。

## Main Steps in Edge Detection 邊緣檢測的主要步驟​

1. Smoothing: suppress as much noise as possible, without destroying true edges. 平滑：盡可能減少噪聲，而不破壞真實的邊緣。
2. Enhancement: apply differentiation to enhance the quality of edges (i.e., sharpening). 增強：應用差分增強邊緣的質量（即銳化）。
3. Thresholding: determine which edge pixels should be discarded as noise and which should be retained (i.e., threshold edge magnitude). 閾值：確定哪些邊緣像素應該被丟棄為噪聲，哪些應該被保留（即閾值邊緣幅度）。
4. Localization: determine the exact edge location. 定位：確定精確的邊緣位置。

sub-pixel resolution might be required for some applications to estimate the location of an edge to better than the spacing between pixels. 對於某些應用程序，可能需要子像素分辨率以估計邊緣的位置，以比像素之間的間距更好。

## Edge Detection Using Derivatives 使用微分的邊緣檢測​

• Often, points that lie on an edge are detected by: 通常，位於邊緣上的點通過以下方式檢測：
1. Detecting the local maxima or minima of the first derivative. 檢測第一個微分的局部最大值或最小值。
2. Detecting the zero-crossings of the second derivative. 檢測第二個微分的零交點。

## Practical Issues 實際問題​

• Smoothing depends on mask size (e.g., depends on σ for Gaussian filters). 平滑取決於掩模大小（例如，取決於高斯濾波器的 σ）。
• Larger mask sizes reduce noise, but worsen localization (i.e., add uncertainty to the location of the edge) and vice versa. 較大的掩模大小可減少噪聲，但會使定位變差（即增加邊緣位置的不確定性），反之亦然。

## Practical Issues (cont'd) 實際問題（繼續）​

• Choice of threshold. 閾值的選擇。

## Criteria for Optimal Edge Detection 邊緣檢測的最佳條件​

1. Good detection 良好的檢測
• Minimize the probability of false positives(i.e., spurious edges). 最小化誤報的概率（即虛假邊緣）。
• Minimize the probability of false negatives(i.e., missing real edges). 最小化誤報的概率（即遺漏真實邊緣）。
2. Good localization 好的定位
• Detected edges must be as close as possible to the true edges. 檢測到的邊緣必須盡可能接近真實邊緣。
3. Single response 單一回應
• Minimize the number of local maxima around the true edge. 最小化真實邊緣周圍的局部最大值的數量。

## Canny edge detector Canny 邊緣檢測器​

• Canny has shown that the first derivative of the Gaussian closely approximates the operator that optimizes the product of signal-to-noise ratio and localization. (i.e., analysis based on "step-edges" corrupted by "Gaussian noise") Canny 顯示，高斯的第一個微分近似地近似了優化 信號與噪聲 比率和定位的算子。 （即基於"步邊緣"並受到"高斯噪聲"損壞的分析）

J. Canny, A Computational Approach To Edge Detection , IEEE Trans. Pattern Analysis and Machine Intelligence, 8:679-714, 1986.

## Non-maxima suppression 非最大值抑制​

• Check if gradient magnitude at pixel location (i,j) is local maximum along gradient direction 檢查像素位置 (i,j) 的梯度幅值是否為沿梯度方向的局部最大值

## Hysteresis thresholding 閾值連接​

• Standard thresholding: 標準閾值

$E(x, y)= \begin{cases}1 & \text { if }\|\nabla f(x, y)\|>T \text { for some threshold } T \\ 0 & \text { otherwise }\end{cases}$
• Can only select "strong" edges. 只能選擇"強"邊緣。
• Does not guarantee "continuity". 不保證"連續性"。

## Hysteresis thresholding (cont'd) 閾值連接（繼續）​

• Hysteresis thresholding uses two thresholds: 閾值連接使用兩個閾值：
• low threshold tl
• high threshold th( usually, th = 2 tl)
• For "maybe" edges, decide on the edge if neighboring pixel is a strong edge. 對於"可能"邊緣，如果鄰近像素是強邊緣，則決定邊緣。