Computer and Robot Vision I Chapter 7 Conditioning and Labeling Presented by: 傅楸善 & 江祖榮 r02922085@ntu.edu.tw 指導教授: 傅楸善 博士
Recognition Methodology Conditioning Labeling Grouping Extracting Matching 調節、潤飾:去除無用的資訊,白話的說,就是去除雜訊 下標籤:針對有意義的pattern 做標記 群組化:把標籤值相同或相近的區塊圈選出來 解析:算出一些能代表群組特性的數值,像是 標準差 或是 平均值 比對:和已知的物品進行分析 比對
7-1 Introduction Conditioning: noise removal, background normalization,… Labeling: thresholding, edge detection, corner finding,… Conditioning : 雜訊移除,背景正規化 Labeling : 門檻值處理,邊緣偵測,角落偵測 dDC & CV Lab. CSIE NTU
7-2 Noise Cleaning noise cleaning: uses neighborhood spatial coherence uses neighborhood pixel value homogeneity Coherence: 連慣性,一致性 Homogeneity: 同質性 利用相同局部區域內的pixel 空間連貫性 和 同質性來去除雜詢 之所以稱為雜訊,就是他的 pixel value 和別人顯著的不同
7-2 Filter f(x-1,y-1) f(x,y-1) f(x+1,y-1) f(x-1,y) f(x,y) f(x+1,y) X axis image Filter Y axis W(-1,-1) W(0,-1) W(1,-1) W(-1,0) W(0,0) W(1,0) W(-1,1) W(0,1) W(1,1)
7.2 Noise Cleaning box filter: computes equally weighted average box filter: separable box filter: recursive implementation with “two+”, “two-”, “one/” per pixel Explain what is box filter and why 2+ 2- 1/ Box filter : 定義:鄰域內的pixel 權重相等 Box filter : 可分離,mask矩陣可以分拆成 一個列向量*行向量 Box filter : 可以遞迴實作,只需要兩個加法、兩個減法,一個除法
filter: separable 1 1 1 1 1 1 1 1 1 * 1 9 = 1 3 1 1 1 * 1 3 1 1 1 9 multiplications 3 multiplications 3 multiplications 1 2 1 2 4 2 1 2 1 * 1 16 = 1 4 1 2 1 * 1 4 1 2 1 直接做 convolution , 可以拆成對 column 方向做一次 convolution, 再對 row 方向做一次 convolution 9 multiplications 3 multiplications 3 multiplications
filter: separable
box filter: recursive implementation 觀察:重複計算的數值可以存起來,給下一個pixel 使用 所有在一個列的pixel 屬於同一個window ABCD 以 3*3 的MASK 為例,IBUF 的大小是一個 3 * 1 的陣列,包含同一個column位置上的三個pixel value 的和 IBUF( j-1) = ( pxl(i-1, j-1) , pxl(i, j-1), pxl(i+1, j-1)) IBUF( j) = ( pxl(i-1, j) , pxl(i, j), pxl(i+1, j)) IBUF( j+1) = ( pxl(i-1, j+1) , pxl(i, j+1), pxl(i+1, j+1)) 一個 Window 內 maintain N 個 IBUF, 假設現在要計算原始影像f(i,j)的輸出值,只要加上 IBUF(j-1) + IBUF(j) + IBUF( j + 1) 的值 再 除以 mask 的 長 * 寬 即可 當某一列的pixel 都計算完之後,下一個Window 的 IBUF 值 只要減去上一列的pixel value, 再加上下一列的 pixel value 即可完成更新 原本的計算量: I^2 * N^2 乘法 和 加法 透過
7.2 Noise Cleaning 如何產生局部最小變異數的 mask 的計算方式
7.2 Noise Cleaning 𝛼=2 𝛽=2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 ∗ 1 (1+4∗ 1 2 +4∗ 1 2 ) = 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 * 1 5 = 1 1 1 1 2 1 1 1 1 * 1 10
7.2 Noise Cleaning 𝛼=2 𝛽=4 1 4 1 2 1 4 1 2 1 1 2 1 4 1 2 1 4 ∗ 1 (1+4∗ 1 2 +4∗ 1 4 ) = 1 4 1 2 1 4 1 2 1 1 2 1 4 1 2 1 4 * 1 4 = 1 2 1 2 4 2 1 2 1 * 1 16
7.2 Noise Cleaning Gaussian filter: linear smoother weight matrix: for all where 可以將 w ( r , c ) 分開成2項相成 w1( r ) w2( c ) Mask大小的取法 => 離中心2~3倍sigma,也就是取4~6作為mask 的size 這種線性的去除雜訊filter會使影像失去焦點,邊緣會變得模糊 size of W: two or three from center linear noise-cleaning filters: defocusing images, edges blurred
Take a Break 0
A Statistical Framework for Noise Removal Idealization assumption: if there were no noise, the pixel values in each image neighborhood would be the same constant 理想化的假設 假如都沒有雜訊的話,鄰域內的pixel 應該擁有相同的pixel value
Outlier or Peak Noise outlier: peak noise: pixel value replaced by random noise value neighborhood size: larger than noise, smaller than preserved detail center-deleted: neighborhood pixel values in neighborhood except center 主要是將一個預測值與實際值做比較,若是差異太大,則判斷此點為peak noise or outlier 鄰域的size的選擇:要比noise 還大,但是要比想要保留的細節還要小。 一種neighborhood的定義方式: 除了中心的之外的剩餘mask中值的集合。 Center-deleted neighborhood : 相鄰區域內的pixel, 但是去除中心點。
Outlier or Peak Noise Decide whether y is an outlier or not X1 X2 X3 X4 y X5 X6 X7 X8 center-deleted neighborhood Center-deleted neighborhood 中心像素不列入林裕 center pixel value
Outlier or Peak Noise center-deleted neighborhood center pixel value mean of center-deleted neighborhood 為什麼取mean? 主要是為了最小化 sum of squared difference 使誤差的平方和為最小 minimizes
Outlier or Peak Noise output value of neighborhood outlier removal not an outlier value if reasonably close to Theta 門檻值 Y 為 center-value Z 算子的輸出值: 假如 y – u hat < 門檻值,則輸出 y, 保持中心值值不變 假如 y - u hat >= 門檻值,表示 y 是 outlier, 用 u hat 取代之 Theta 取的小,表示條件嚴格,連一點小小的變化都當成 outlier, 那麼像是 邊線上的 pixel 就會被平均值取代,影像變得模糊 Theta 取太大,表示條件很寬鬆,大道雜訊都沒有被過濾到,沒有得到太大的去除雜訊效果 use mean value when outlier threshold for outlier value too small: edges blurred too large: noise cleaning will not be good
Outlier or Peak Noise center-deleted neighborhood variance 對比相依的 偏差值(離群值)移除 的方法 統計上的Z值計算,轉換到圖型領域上,就是計算一個pixel 離平均值u hat 相差多少個標準差。 當某個pixel 減去 u hat 再除以 sigma hat相差 theta 個標準差以上時,我們把它視為顯著差異,也就是偏差值。 use neighborhood mean if pixel value significantly far from mean
7-2-3 Outlier or Peak Noise 若我們取 theta = 1; 相當於我們只保留與 平均值距離1 個sigma以內的 pixel, 超過一個 sigma的 pixel 都會被視為是outlier, 被 u hat 取代。 保留深藍色部分,取代淺藍色部分的pixel
7-2-3 Outlier or Peak Noise smooth replacement: instead of complete replacement or not at all convex combination of input and mean use neighborhood mean weighting parameter 除了使用二分法的小於門檻值就保留,大於門肯直就取代之外,我們也可以用一個平滑的 convex combination來當作輸出結果. 何謂 convex combination, 凸組合,簡單講就是一種有條件的線性內插: X = a1 * x1+ a2 * x2 + a3 * x3 + ak * xk 所有的係數 ai >= 0 , where i = 1 , 2 , … , k 所有的係數和 = 1 , i.e. , a1 + a2 + a3 + … + ak = 1 use input pixel value
7-2-4 K-Nearest Neighbor K-nearest neighbor: average equally weighted average of k-nearest neighbors 在鄰居中找K個跟center-value接近的,然後作平均。 和中心點相近權重相同 課本的建議, 取鄰域中前6個靠近的pixel,K=6, 重複3~4次比只做一次好。 會得到比較好的結果
7-2-5 Gradient Inverse weighted reduces sum-of-squares error within regions 與K-nearest不同,他是將neighbor距離參考點的灰階值倒數來當作weight 和中心點的像素差距越小,權重越大。 相反的,和中心點的像素差距越大,權重越小。 K為何要在前面補上1/2
Take a Break 1
7-2-6 Order Statistic Neighborhood Operators linear combination of neighborhood sorted values neighborhood pixel values sorted neighborhood values from smallest to largest 排序統計輛 排序後的數值的線性組合 X1, … , Xn : 鄰域的pixel value X(1), … , Xn : 排序後的pixel value
7-2-6 Order Statistic Neighborhood Operators x1 x2 x3 x4 x5 x6 x7 x8 x9 16 128 109 66 4 6 96 84 53 x(1) x(2) x(3) x(4) x(5) x(6) x(7) x(8) x(9) 4 6 16 53 66 84 96 109 128
7-2-6 Order Statistic Neighborhood Operators Median Operator median: most common order statistic operator median root: fixed-point result of a median filter median roots: comprise only constant-valued neighborhoods, sloped edges 最常見的統計排序運算子 一直重複做median filter會得到一個最後不會再改變的結果稱為 median root Median roots : 只有常數值的鄰域pixel(一片平坦的區域) 和 斜邊
Median Root Image Original Image
7-2-6 Order Statistic Neighborhood Operators median: effective for impulsive noise (salt and pepper) median: distorts or loses fine detail such as thin lines 專門針對 脈衝式的雜訊(像是椒鹽雜訊) 缺點:使影像失真,損失細節,像是影像中細微的線條 Quartile: 4分位數 inter- prep. 1. 表示"互相" 2. 表示"在...中間","在...之間","在...內
7-2-6 Order Statistic Neighborhood Operators Running-median Operator inter-quartile distance Inter-quartile distance 四分位差距(3rd四分位數 – 1st四分位數), 和 變異數 和 標準差一樣,都代表資料的分散程度 Contrast-dependent outlier removal 做比較 前面是 y - u 可以和 無條件捨去 Theta太大 => 原圖 Theta太小 => median filter
7-2-6 Order Statistic Neighborhood Operators Trimmed-Mean Operator trimmed-mean: first k and last k order statistics not used trimmed-mean: equal weighted average of central N-2k order statistics When alpha = kN called alpha trimmed mean 去掉前N個最大的和後N個最小的pixel
7-2-6 Order Statistic Neighborhood Operators Midrange operator midrange: noise distribution with light and smooth tails 取排序後數值最小的pixel 和 數值最大的pixel 相加取平均
7-2-7 Hysteresis Smoothing removes minor fluctuations, preserves major transients finite state machine with two states: UP, DOWN applied row-by-row and then column-by-column 滯後作用 平滑 移除影像中的,保留主要變化ˋtrænʃənt 有兩個狀態的有現狀態機
7-2-7 Hysteresis Smoothing if state DOWN and next one larger, if next local maximum does not exceed threshold then stays current value i.e. small peak cuts flat otherwise state changes from DOWN to UP and preserves major transients 消除小突出部 保留巨大變動 假如現在狀態是DOWN,也就是”向下” 若相對最高值 < 門檻值 h, 則視為小波動,以紅色虛線的地方砍平 若相對最高值 > 門檻值 h, 則視為方向改變,保留原有的數值,切換到 UP(向上)
7-2-7 Hysteresis Smoothing if state UP and next one smaller, if next local minimum does not exceed threshold then stays current value i.e. small valley filled flat otherwise state changes from UP to DOWN and preserves major transients 消除小突出部 保留巨大變動 假如現在狀態是UP,也就是”向上” 若相對最小值 < 門檻值 h, 則視為小波動,以紅色虛線的地方填滿 若相對最小值 > 門檻值 h, 則視為方向改變,保留原有的數值,切換到 DOWN(向下)
7-2-7 Hysteresis Smoothing 在一個row中,本來pixel value 越變越小,遇到轉折點的pixel時候,的時候偵測變化頂點的相對最大值,假如相對最大值超過門檻,則視為 在上坡的時候偵測相對最大值
Take a Break 2
Sigma Filter sigma filter: average only with values within two-sigma interval How sigma be counted? 是否為此mask中的值的sigma Trick:當#M太小,則直接取neighbors的平均
Selected-Neighborhood Averaging assumes pixel a part of homogeneous region (not required to be squared, others can be diagonal, rectangle, three pixels vertical and horizontal neighborhood) noise-filtered value: mean value from lowest variance neighborhood 觀點不同,先前都以參考點為中心,這個則以包含參考點的數個鄰域為參考區域候選人 取 variance 最小的鄰域為參考區域,算出mean value當作 filter的輸出。 Advantage: 包含邊的鄰域variance會很大,所以不會被選為參考區域 也就是說,此方法不會cross edge boundary,可以保持邊的性質
Minimum Mean Square Noise Smoothing additive or multiplicative noise each pixel in true image: regarded as a random variable 將每個pixel視為random variable : Y 再假定noise亦為random variable : e 則每個點 Z = Y + e; 我們的目摽則是由Z去預測Y’ => Y’ = aZ + b; 為了使a , b 最小,則利用 E[ (Y-Y’)^2 ] 其中 Y’ = aZ + b;
Minimum Mean Square Noise Smoothing Z : 觀察到的像素值 Y : 原始影像應該擁有的像素值 Ksi : 雜訊 Y : 估計的像素值, 我們透過數學方法還原所得到的值,可以用 Y hat = a Z + b 來表達 目標是 選擇適當的 alpha 和 beta 使得 均方差為最小,也就是我們透過數學方法還原所得到的值和原始影像的像素值越近越好
Noise-Removal Techniques-Experiments
Noise-Removal Techniques-Experiments types of noise uniform Gaussian salt and pepper varying noise (the noise energy varies across the image) Uniform : 雜訊值分布遵守均勻分布,每個gray level都有可能出現,且機率相等 , 又稱為 Quantization noise Gaussian :雜訊值分布遵守高斯分布的雜訊,會聚集在常態分布的兩端 Salt and pepper : 雜訊根據特定的比率參數出現在影像中,雜訊值只有兩種白雜點(Salt)pixel value 為 0 或 黑雜點(Pepper) pixel value 為255 Varying noise : 沒有固定分布模式, 整張影像的雜訊分布沒有固定的 pattern
Noise-Removal Techniques-Experiments salt and pepper minimum/ maximum gray value for noise pixels fraction of image to be corrupted with noise 如果 random variable u大於 p, 就維持不變 如果 random variable u小於等於 p, 就輸出 ( Imin + I max – I min )* u P : 是要參雜雜訊的比例參數 U : 均勻分布的隨機變數,大小在 0 , 1 區間之間 uniform random variable in [0,1] gray value at given pixel in input image gray value at given pixel in output image
Noise-Removal Techniques-Experiments Generate salt-and-pepper noise I(nim, i , j) = 0 if uniform(0,1) < 0.05 I(nim, i , j) = 255 if uniform(0,1) > 1- 0.05 I(nim, i , j) = I(im, i ,j) otherwise uniform(0,1) : random variable uniformly distributed over [0,1]
Noise-Removal Techniques-Experiments S/N ratio (signal to noise ratio): VS: image gray level variance VN: noise variance 𝑆𝑁𝑅=20∗ log 10 𝑉𝑆 𝑉𝑁 VN: 結果 – 帶有雜訊的圖 = 雜訊
Noise-Removal Techniques-Experiments 𝜇 𝑠 = ∀𝑛 𝐼 𝑖, 𝑗 𝑛 𝑉𝑆= ∀𝑛 𝐼 𝑖, 𝑗 − 𝜇 𝑠 2 𝑛 𝜇 𝑁𝑜𝑖𝑠𝑒 = ∀𝑛 𝐼 𝑁𝑜𝑖𝑠𝑒 𝑖, 𝑗 −𝐼( 𝑖,𝑗) 𝑛 𝑉𝑁= ∀𝑛 𝐼 𝑁𝑜𝑖𝑠𝑒 𝑖, 𝑗 −𝐼( 𝑖,𝑗)− 𝜇 𝑁𝑜𝑖𝑠𝑒 2 𝑛 𝑆𝑁𝑅=20∗ log 10 𝑉𝑆 𝑉𝑁
Take a Break 3
Noise-Removal Techniques-Experiments uniform noise Gaussian noise salt and pepper noise varies
Uniform Original noise Gaussian S & P
default peak noise removal
outlier removal Uniform S & P Gaussian Uniform S & P Gaussian 效果並不好,影像失去焦點,邊緣模糊
contrast-dependent noise removal
contrast-dependent outlier removal Uniform Uniform S & P Gaussian contrast-dependent outlier removal Gaussian S & P
smooth replacement Why need theta
contrast-dependent outlier removal with smooth replacement Uniform Uniform S & P Gaussian contrast-dependent outlier removal with smooth replacement Gaussian S & P
hysteresis smoothing
hysteresis smoothing Uniform Uniform S & P Gaussian Gaussian S & P 對於 pepper and salt 的雜訊影像並不適用,因為 黑點 和 白點 和中心pixel 差距太大,會被當成主要波動
inter-quartile mean filter
inter-quartile mean filter Uniform Uniform S & P Gaussian inter-quartile mean filter Gaussian S & P
neighborhood midrange filter
neighborhood midrange filter Uniform Uniform S & P Gaussian neighborhood midrange filter Gaussian S & P
neighborhood running-mean filter
neighborhood running-mean filter Uniform Uniform S & P Gaussian neighborhood running-mean filter Gaussian S & P
sigma filter
Uniform Uniform S & P Gaussian sigma filter Gaussian S & P
neighborhood weighted median filter (7X7)
neighborhood weighted median filter Uniform Uniform S & P Gaussian neighborhood weighted median filter Gaussian S & P
Noise-Removal Techniques-Experiments with Lena Uniform Gaussian_30 S & P 0.1 Contrast-dependent outlier removal 26.408 25.758 20.477 Smooth replacement 29.344 26.821 26.792 Outlier removal 26.407 25.768 20.406 Hysteresis 18.278 13.804 1.9040 Interquartile mean filter 29.193 24.517 35.720 Midrange filter 22.171 19.629 -0.1658 Running-mean filter 29.522 28.278 21.194 Sigma filter 34.717 18.831 -2.9151 Weighted-median filter 33.964 30.720 36.033
7.3 Sharpening unsharp masking: subtract fraction of neighborhood mean and scale result K越大 => 越 sharp possible to replace neighborhood mean with neighborhood median
Extremum Sharpening extremum-sharpening: output closer of neighborhood maximum or minimum 看離極大值或極小值這兩種極值,哪個極值較近。選比較靠近中心pixel 的 極值當作輸出 Z = Zmin,假如中心項訴離鄰域中的 最小值比較近 Z = Zmax,假如中心項訴離鄰域中的 最大值比較近
7.4 Edge Detection digital edge: boundary where brightness values are significantly different edge: brightness value appears to jump Digital edge : 一條影像上的邊界,左右兩側的pixel value 明顯不同 Edge : 明亮度有突然的抬升或下降,
Sculpture: 雕刻品 Salient:顯著的 Abruptly: 突然地 一般影像所謂的邊其實不見得會對應到實際物體的邊會因為打光 使我們在套mask找邊的時候 也會找到
Roof Edge : 紋理或邊緣的漸層變化 Step Edge :紋理或邊緣的強烈變化,影像強度不連續的地方 Line Edge : 可以想成是兩個Step Edge 的組合,圖型中一條明顯的線段
場景中的物理屬性的變化會產生”邊緣” Surface-normal: 法向量 => 對瓶蓋而言,由於法向量不連續,所以會造成邊(原本往上 突然變成向自己) Depth: 後半部顯示不出來,造成不連續 Illumination:光照射不連續,由於光照不到影子覆蓋的地方,造成有邊 Surface reflectance:表面反射不連續,紙上面有黑色塗料,這兩個東西反射係數不同
Gradient Edge Detectors Roberts operators: two 2X2 masks to calculate gradient 由於做first-order微分可以凸顯高頻的地方,而邊正好是高頻的地方 考慮一個點的差分 此兩mask微分得來 => f’(x) = f(x+1) – f(x) f’(x)=f(x+△x)/△x , △x趨近於0但電腦上單位為pixel 所以△x會是1則 f’(x) = f(x+1) – f(x) gradient magnitude: where are values from first, second masks respectively
Roberts operators
Gradient Edge Detectors Prewitt edge detector: two 3X3 masks in row column direction P1 P2 考慮兩個點? f’(x) = f(x+1) – f(x) f’(x-1) = f(x) – f(x-1) => f’(x) + f’(x-1) = f(x+1) – f(x-1) gradient magnitude: gradient direction: clockwise w.r.t. column axis where are values from first, second masks respectively
Gradient Edge Detectors
Prewitt edge detector
Gradient Edge Detectors Sobel edge detector: two 3X3 masks in row column direction gradient magnitude: gradient direction: clockwise w.r.t. column axis where are values from first, second masks respectively
Gradient Edge Detectors Sobel edge detector: 2X2 smoothing followed by 2X2 gradient 兩mask做convolution即可得到
Gradient Edge Detectors
Sobel edge detector
Gradient Edge Detectors Frei and Chen edge detector: two in a set of nine orthogonal masks (3X3) W^T * W = O =>稱之為orthogonal 總共有9個 orthogonal mask, 其中2個用來做 edge detection gradient magnitude: gradient direction: clockwise w.r.t. column axis where are values from first, second masks respectively
Gradient Edge Detectors orthogonal
Gradient Edge Detectors Frei and Chen edge detector: nine orthogonal masks (3X3)
Frei and Chen edge detector
Gradient Edge Detectors Kirsch: set of eight compass template edge masks 會是45*n? gradient magnitude: gradient direction:
Kirsch
Gradient Edge Detectors Robinson: compass template mask set with only done by only four masks since negation of each mask is also a mask gradient magnitude and direction same as Kirsch operator
Robinson
Gradient Edge Detectors Nevatia and Babu: set of six 5X5 compass template masks
Nevatia and Babu
Gradient Edge Detectors edge contour direction: along edge, right side bright, left side dark more than gradient direction
Robinson and Kirsch compass operator: detect lineal edges
Gradient Edge Detectors four important properties an edge operator might have accuracy in estimating gradient magnitude accuracy in estimating gradient direction accuracy in estimating step edge contrast accuracy in estimating step edge direction Edge operator 要有的性質 準確估計 梯度的強度 準確估計 梯度的方向 準確估計 step edge 的對比性 準確估計 step edge 的方向性 Gradient direction : 用來做邊的組織,選擇,和連結。 gradient direction: used for edge organization, selection, linking
7.4.1 Gradient Edge Detectors Polyhedral: 多面體 左上角:多面體物體 右上角:梯度強度影像 左下角:梯度強度二值化影像(門檻值為12) 右下角:右邊白左邊黑,選theta值在0~22度之間的。
Take a Break
Zero-Crossing Edge Detectors first derivative maximum: exactly where second derivative zero crossing first derivative maximum: exactly where second derivative zero crossing 跟課本上的比較
Zero-Crossing Edge Detectors Laplacian of a function
Zero-Crossing Edge Detectors two common 3X3 masks to calculate digital Laplacian First type Second type Rotate How to generate first one
Zero-Crossing Edge Detectors the 3X3 neighborhood values of an image function
Zero-Crossing Edge Detectors I(r,c) = k1+k2r+k3c+k4r2+k5rc+k6c2 ( r, c) (-1,-1) (-1, 0) (-1, 1) ( 0,-1) ( 0, 0) ( 0, 1) ( 1,-1) ( 1, 0) ( 1, 1) (-1,-1) (-1, 0) (-1, 1) ( 0,-1) ( 0, 0) ( 0, 1) ( 1,-1) ( 1, 0) ( 1, 1) (-1,-1) (-1, 0) (-1, 1) ( 0,-1) ( 0, 0) ( 0, 1) ( 1,-1) ( 1, 0) ( 1, 1) (-1,-1) (-1, 0) (-1, 1) ( 0,-1) ( 0, 0) ( 0, 1) ( 1,-1) ( 1, 0) ( 1, 1) (-1,-1) (-1, 0) (-1, 1) ( 0,-1) ( 0, 0) ( 0, 1) ( 1,-1) ( 1, 0) ( 1, 1) (-1,-1) (-1, 0) (-1, 1) ( 0,-1) ( 0, 0) ( 0, 1) ( 1,-1) ( 1, 0) ( 1, 1) (-1,-1) (-1, 0) (-1, 1) ( 0,-1) ( 0, 0) ( 0, 1) ( 1,-1) ( 1, 0) ( 1, 1) (-1,-1) (-1, 0) (-1, 1) ( 0,-1) ( 0, 0) ( 0, 1) ( 1,-1) ( 1, 0) ( 1, 1) (-1,-1) (-1, 0) (-1, 1) ( 0,-1) ( 0, 0) ( 0, 1) ( 1,-1) ( 1, 0) ( 1, 1) (-1,-1) (-1, 0) (-1, 1) ( 0,-1) ( 0, 0) ( 0, 1) ( 1,-1) ( 1, 0) ( 1, 1)
Zero-Crossing Edge Detectors
Zero-Crossing Edge Detectors 子影像帶入兩個常見的Laplacian operator去計算
Zero-Crossing Edge Detectors 3X3 mask computing a digital Laplacian
Zero-Crossing Edge Detectors 推導 e = -(4a+4b) 條件怎麼來的 推導 2a+b = 1 條件怎麼來的
Zero-Crossing Edge Detectors 3X3 mask for computing minimum-variance digital Laplacian First type -first+2first_rotate
Laplacian of the Gaussian kernel -2 -9 -23 -1 103 178 103 -1 -23 -9 -2 圖形像墨西哥帽
Zero-Crossing Edge Detectors
Zero-Crossing Edge Detectors
Zero-Crossing Edge Detectors A pixel is declared to have a zero crossing if it is less than –t and one of its eight neighbors is greater than t or if it is greater than t and one of its eight neighbors is less than –t for some fixed threshold t
Zero-Crossing Edge Detectors
Take a Break
Edge Operator Performance edge detector performance characteristics: misdetection/false-alarm rate False-alarm rate: 將非邊的pixel當做邊的機率。 Misdetection rate: 1 – 找到邊的比例 用來評估 edge detector 的兩個特徵 False-alarm rate : 假警報 把不是邊的pixel判定程是邊的pixel Misdetection rate : 誤檢率 明明是邊上的pixel確判定程不在邊上
這種找邊的方法她會先用gaussian 對原圖做smooth 齒輪的邊緣還有字體的清晰程度是最主要的不同 Sigma小的時候,小細節比較清楚;sigma逐漸增大的時候,粗略輪廓就逐漸顯現出來,但是細節就會逐漸消失。
抹布的影像 Scale 代表 解析度,換句話說,就是細節的呈現程度。放大或縮小的尺度。 Sigma小的時候,小細節比較清楚;sigma逐漸增大的時候,粗略輪廓就逐漸顯現出來,但是細節就會逐漸消失。
7.5 Line Detection A line segment on an image can be characterized as an elongated rectangular region having a homogeneous gray level bounded on both its longer sides by homogeneous regions of a different gray level Line segment 可以被描述成一個拉長的矩形,期內部有一致的灰階值,被另一個擁有不同灰階值區域區隔開來,
7.5 Line Detection one-pixel-wide lines can be detected by compass line detectors
semilinear line detector by step edge on either side of the line
detecting lines of one to three pixels in width
Project due Nov. 26 Write the following programs Generate additive white Gaussian noise Generate salt-and-pepper noise Run box filter (3X3, 5X5) on all noisy images Run median filter (3X3, 5X5) on all noisy images Run opening followed by closing or closing followed by opening 高斯雜訊(Gaussian noise)是白雜訊(white noise)的理想形態,是由訊號中隨機的擾動而造成。 疊加雜訊:I+N 像素值加上亂數數值 乘積雜訊:I(1+N) 像素值乘上亂數數值,則會產生斑點(speckle)雜訊(或簡稱斑點),因此又稱為乘積雜訊(multiplicative noise)。
Project due Nov. 27 box filter on white Gaussian noise with amplitude = 10 Gaussian noise After 3x3 box filter After 5x5 box filter
salt-and-pepper noise Project due Nov. 27 box filter on salt-and-pepper noise with threshold = 0.05 salt-and-pepper noise After 3x3 box filter After 5x5 box filter
Project due Nov. 27 median filter on white Gaussian noise with amplitude = 10 Gaussian noise After 3x3 median filter After 5x5 median filter
salt-and-pepper noise Project due Nov. 27 median filter on salt-and-pepper noise with threshold = 0.05 salt-and-pepper noise After 3x3 median filter After 5x5 median filter
Project due Nov. 27 Generate additive white Gaussian noise Gaussian random variable with zero mean and st. dev. 1 產生一個高斯分布在亂數產生器,對應參數為 平均值為0,標準差為1 震幅 amplitude 為 10 和 30 兩種case amplitude determines signal-to-noise ratio, try 10, 30
Project due Nov. 27 Generate additive white Gaussian noise with amplitude = 10
Project due Nov. 27 Generate additive white Gaussian noise with amplitude = 30
Project due Nov. 27 Generate salt-and-pepper noise I( noiseImage,i ,j) = 0 255 𝐼 𝑠𝑟𝑐𝐼𝑚𝑎𝑔𝑒,𝑖,𝑗 , if 𝑢𝑛𝑖𝑓𝑜𝑟𝑚 0,1 <0.05 , if 𝑢𝑛𝑖𝑓𝑜𝑟𝑚 0,1 >1−0.05 , otherwise 產生一個均勻分布在0~1之間的亂數產生器
Project due Nov. 27 Generate salt-and-pepper noise with threshold = 0.05
Project due Nov. 27 Generate salt-and-pepper noise with threshold = 0.1
Project due Dec. 26 Write programs to generate the following gradient magnitude images and choose proper thresholds to get the binary edge images: Roberts operator Prewitt edge detector Sobel edge detector Frei and Chen gradient operator Kirsch compass operator Robinson compass operator Nevatia-Babu 5X5 operator
Project due Dec. 26 Roberts operator with threshold = 30
Project due Dec. 26 Prewitt edge detector with threshold = 30
Project due Dec. 26 Sobel edge detector with threshold = 30
Project due Dec. 26 Frei and Chen gradient operator with threshold = 30
Project due Dec. 26 Kirsch compass operator with threshold = 30
Project due Dec. 26 Robinson compass operator with threshold = 30
Project due Dec. 26 Nevatia-Babu 5X5 operator threshold = 30
Project due Jan. 2 Write the following programs to detect edge: Zero-crossing on the following four types of images to get edge images (choose proper thresholds), p. 349 Laplacian minimum-variance Laplacian Laplacian of Gaussian Difference of Gaussian, (use tk to generate D.O.G.) dog (inhibitory , excitatory , kernel size=11)
Difference of Gaussian
Difference of Gaussian
Project due Jan. 2 Zero-crossing on the following four types of images to get edge images (choose proper thresholds t=1)
Laplacian
minimum-variance Laplacian
Laplacian of Gaussian
Difference of Gaussian (inhibitory , excitatory , kernel size=11)