Moments in Image Processing

簡短描述

檔案: \examples\Processing\Geometry\ImageMoments\ImageMoments.va

預設平台: mE5-MA-VCL

簡短說明

計算傳入影像的影像矩、方位角及偏心率。

影像處理中的矩,是指根據影像中單一像素的亮度值所計算出的平均值。透過這些矩,可以識別出影像中物體的物理 特性,例如方向、偏心率、面積或質心位置。

Orientation

入職說明會 物體的定義為 [Bur06]:

式 (24)。


並採用二階的中心矩:

式(25)。


附定義

式(26)。


質心是

式(27)。


以及那些不加修飾的時刻

方程式 28。


對應於物體的面積。 此處 g(x,y) 是數位灰階影像的灰階函數。

Eccentricity

物體的偏心率 e 可根據 [Bur06] 計算得出

式 (29)。


偏心率的結果介於 0(圓形物體)與 1(細長物體)之間。

Design in VisualApplets

在VisualApplets 中,實作了一項設計,其輸出包含原始影像以及物體的幾何屬性,例如面積、 重心、方向 以及偏心率。您可以在 \examples\Processing\Geometry\ImageMoments\ImageMoments.va 中找到此範例。 計算時選用了 4 級並行度。 圖 324「基本設計結構」中,展示了附有註解的設計結構。

基本設計結構

圖 324. 基本設計結構


灰階影像的幾何特性(面積、重心、方向及偏心率)是透過矩來計算的 (HierarchicalBox: ImageMoments). 這些屬性會附加到原始相機影像上(將時刻附加至圖片). 在 如圖 325 所示,「ImageMoments 的內容」。 顯示了 HierarchicalBox ImageMoments 原始矩 (對應於物件的面積) 進行明確的生命週期管理即呼叫 以及重心 和中心矩 進行明確的生命週期管理即呼叫 是根據上述公式實現的。最後,幾何屬性:方向 (即影像物件的主軸與離心率 $e$)是根據這些結果計算得出的。

ImageMoments 的內容

圖 325。ImageMoments 的內容


在 如圖 326 所示,「HierarchicalBox orientation_theta 的內容」 進行明確的生命週期管理即呼叫 如圖 327 所示,「HierarchicalBox eccentricity 的內容」 展示了 HierarchicalBoxes 的內容 orientation_theta 進行明確的生命週期管理即呼叫 eccentricity 以及關於單一操作步驟的插入註解。方向 和離心率 $e$ 是使用以下數值計算得出的: 根據 方程式 24 進行明確的生命週期管理即呼叫 方程式 29。 為 ARCTAN 運算子的輸入訊號選擇了 $R=7$ 的解析度。

HierarchicalBox orientation_theta 的內容

圖 326。HierarchicalBox orientation_theta 的內容


HierarchicalBox eccentricity 的內容

圖 327。HierarchicalBox eccentricity 的內容


Comment: During implementation of the orientation of Θ it showed, that limitation to 12 bits maximum input signal of the ARCTAN function can be a problem for calculation of accuracy and resolution: for example the image of an ellipse with orientation Θ= 44.07° (result of moment implementation with MATLAB) was analyzed. The 25 bit input signal for the ARCTAN function has to be limited to 12 bits. With resolution of R= 8 bits the implementation in VisualApplets has result 41.43°; with R=7 bits the result is 43.21° (with resolution for small angles of 0.2°) and with R= 6 it is 44.07° (with resolution for small angles of 0.45°). As an result we found that with high resolution (R= 8 bit) the maximum angle of calculation is smaller than the true angle of orientation, due to bit depth limitation. With smaller resolution R the result of calculation improves for big angles but has as an consequence smaller accuracy in the range of small angles. The problem can be solved by using a Lookup table instead of ARC TAN operator.