Skip to main content

Edge Detection 邊緣檢測

Aims 宗旨

  • Intensity Images 強度圖像
  • Edge Detection 邊緣檢測
  • Convolution 卷積

Intensity Images 強度圖像

  • An intensity image is a data matrix, whose values represent intensities within some range. 強度圖像是一個數據矩陣,其值表示某個範圍內的強度。
  • represented as a single matrix, with each element of the matrix corresponding to one image pixel 強度圖像由一個矩陣表示,矩陣中的每個元素對應一個圖像像素。
  • In matlab: To display an intensity image, use the imagesc ("image scale") function 用 imagesc 函數顯示強度圖像。

1

Indexed Images 索引圖像

  • An indexed image consists of a data matrix, X, and a colormap matrix, map. 索引圖像由數據矩陣 X 和 colormap 矩陣 map 組成。
  • map is an m-by-3 array of class double containing floating-point values in the range [0, 1]. map 是 double 類的 m×3 數組,包含 [0, 1] 範圍內的浮點值
  • Each row of map specifies the red, green, and blue components of a single color. map 的每一行指定了一個單獨顏色的紅、綠、藍分量。

2

Guess the image 猜圖

3 4 5

Intensity gradients 強度梯度

  • The image is a function mapping coordinates to intensity f(x,y)f(x,y) 圖像是將坐標映射到強度 f(x,y)f(x,y) 的函數

    6

  • The gradient of the intensity is a vector 強度的梯度是一個向量

    G[f(x,y)]=[GxGy]=[dfdxdfdy]\vec{G}[f(x, y)]=\left[\begin{array}{c} G_x \\ G_y \end{array}\right]=\left[\begin{array}{c} \frac{d f}{d x} \\ \frac{d f}{d y} \end{array}\right]

    7

  • We can think of the gradient as having an x and a y component 梯度有 x 和 y 兩個分量

    8

Approximating the gradient 近似梯度

  • Our image is discrete with pixels indexed by i and j 我們的圖像是由 i 和 j 索引的像素

  • We want to estimated in the same place 我們想在同一個地方估計

    Gxf[i,j+1]f[i,j]Gyf[i,j]f[i+1,j]\begin{aligned} G_x & \cong f[i, j+1]-f[i, j] \\ G_y & \cong f[i, j]-f[i+1, j] \end{aligned}

    9

  • So we use a 2x2 mask instead 所以我們改用 2x2 掩碼

    10

  • For each mask of weights you multiply the corresponding pixel by the weight and sum over all pixels 對於每個權重掩碼,您將相應的像素乘以權重並對所有像素求和

Other edge detectors 其他邊緣檢測器

  • Roberts 羅伯茨 11

  • Sobel 索貝爾 12

Approximating the gradient 近似梯度

  • Sobel 索貝爾 13

Convolution 卷積

  • Convolution is the computation of weighted sums of image pixels. 卷積是圖像像素的加權和計算。
  • For each pixel [i,j] in the image, the value h[i,j] is calculated by translating the mask to pixel [i,j] and taking the weighted sum of pixels in neighbourhood of [i,j] 針對圖像中的每個像素 [i,j],通過將掩碼平移到像素 [i,j] 並對 [i,j] 的鄰域像素進行加權求和,計算出 h[i,j] 的值。

14

What do these filters do 這些過濾器有什麼作用

  • Steps:
    • Take image 拍照
    • Convolve mask with image for each direction 卷積遮罩與圖像
      • Calculate derivatives Gx and Gy 計算導數 Gx 和 Gy
    • Calculate magnitude = M(G)=Gx2+Gy2M(\vec{G})= \sqrt{G_x^2 +G_y^2} 計算震級 = M(G)=Gx2+Gy2M(\vec{G})= \sqrt{G_x^2 +G_y^2}

15

Filtering 過濾

  • We could detect edges by calculating the intensity change (gradient) across the image 我們可以通過計算圖像中的強度變化(梯度)來檢測邊緣
  • We could implement this using the idea of filtering 我們可以使用過濾的概念來實現這一點

16

Linear filtering: the algorithm 線性過濾:算法

17

Highly Directed Work 高度導向的工作

  • Gaussian (Canny) edge detection 高斯(Canny)邊緣檢測
  • Second order operators 二階算子
  • Thresholding 閾值