TWI807627B - Image edge detecting method and image edge processing device - Google Patents

Image edge detecting method and image edge processing device Download PDF

Info

Publication number
TWI807627B
TWI807627B TW111104348A TW111104348A TWI807627B TW I807627 B TWI807627 B TW I807627B TW 111104348 A TW111104348 A TW 111104348A TW 111104348 A TW111104348 A TW 111104348A TW I807627 B TWI807627 B TW I807627B
Authority
TW
Taiwan
Prior art keywords
image
gradient
edge detection
data
image edge
Prior art date
Application number
TW111104348A
Other languages
Chinese (zh)
Other versions
TW202333109A (en
Inventor
梁煜
Original Assignee
大陸商星宸科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 大陸商星宸科技股份有限公司 filed Critical 大陸商星宸科技股份有限公司
Priority to TW111104348A priority Critical patent/TWI807627B/en
Application granted granted Critical
Publication of TWI807627B publication Critical patent/TWI807627B/en
Publication of TW202333109A publication Critical patent/TW202333109A/en

Links

Images

Landscapes

  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

An image edge detecting method for processing an image including a plurality of pixels includes respectively performing a convolution calculation with a first direction gradient operator and a second direction gradient operator for the image to obtain a first direction gradient information and a second direction gradient information, wherein the first direction is perpendicular to the second direction; determining gradient statistics of a neighboring area of a target pixel of the image according to the first direction gradient information and the second direction gradient information; and determining an edge significance of the target pixel according to the gradient statistics.

Description

圖像邊緣偵測方法及圖像邊緣偵測裝置 Image edge detection method and image edge detection device

本發明係指一種圖像邊緣偵測方法及圖像邊緣偵測裝置,尤指一種應用於圖像降噪以及圖像銳化的圖像邊緣偵測方法及圖像邊緣偵測裝置。 The present invention refers to an image edge detection method and image edge detection device, especially an image edge detection method and image edge detection device applied to image noise reduction and image sharpening.

現有的圖像處理技術包含藉由邊緣偵測方法判斷圖像中的邊緣是否具有方向,例如一種邊緣偵測方法可根據邊緣梯度判斷邊緣是否具有方向。然而,當邊緣偵測方法遇到弱邊緣或強紋理時,可能判斷不準確,進而影響圖像銳化和圖像降噪等所需的邊緣訊息,而導致邊緣模糊或邊緣雜訊明顯。 Existing image processing techniques include judging whether an edge in an image has a direction by an edge detection method, for example, an edge detection method can judge whether an edge has a direction according to an edge gradient. However, when the edge detection method encounters weak edges or strong textures, the judgment may be inaccurate, which will affect the edge information required for image sharpening and image noise reduction, resulting in blurred edges or obvious edge noise.

具體而言,傳統的邊緣偵測技術根據索伯(Sobel)算子(Operator)計算圖像不同方向的梯度,並且將梯度的幅度較大的區域認為有方向邊緣。然而,當有方向紋理的梯度不夠大,上述方法可能將紋理辨識為邊緣而造成誤判,或者,當有方向邊緣較弱,上述方法也難以檢測到有方向邊緣。因此,現有技術有改進的必要。 Specifically, the traditional edge detection technology calculates gradients in different directions of an image according to a Sobel operator, and regards regions with larger gradients as having directional edges. However, when the gradient of the directional texture is not large enough, the above method may identify the texture as an edge and cause misjudgment, or, when the directional edge is weak, the above method is also difficult to detect the directional edge. Therefore, there is a need for improvement in the prior art.

有鑑於此,本發明之主要目的即在於提供一種圖像邊緣偵測方法及 圖像邊緣偵測裝置,以有效偵測圖像中有方向的邊緣。 In view of this, the main purpose of the present invention is to provide a kind of image edge detection method and An image edge detection device to effectively detect directional edges in an image.

本發明實施例揭露一種圖像邊緣偵測方法,用以處理包含有複數個像素之一圖像,該方法包含有以一第一方向之梯度算子及一第二方向之梯度算子,分別對該圖像進行一卷積運算,以獲得一第一方向梯度資料及一第二方向梯度資料,其中該第一方向垂直於該第二方向;根據該第一方向梯度資料及該第二方向梯度資料,在該圖像之一目標像素之一鄰近區域內計算梯度統計,以得到一梯度統計量;以及根據該梯度統計量,決定對應於該目標像素之一邊緣顯著度。 The embodiment of the present invention discloses an image edge detection method for processing an image comprising a plurality of pixels. The method includes performing a convolution operation on the image with a gradient operator in a first direction and a gradient operator in a second direction to obtain gradient data in a first direction and gradient data in a second direction, wherein the first direction is perpendicular to the second direction; according to the gradient data in the first direction and the gradient data in the second direction, gradient statistics are calculated in an adjacent region of a target pixel of the image to obtain a gradient statistic; The edge saliency of one of the target pixels.

本發明實施例另揭露一種圖像邊緣偵測裝置,用以處理包含有複數個像素之一圖像,其包含有一卷積電路,包含有一第一卷積電路單元以及一第二卷積電路單元,用來分別以一第一方向之梯度算子及一第二方向之梯度算子,分別對該圖像進行一卷積運算,以獲得一第一方向梯度資料及一第二方向梯度資料,其中該第一方向垂直於該第二方向;一統計電路,用來根據該第一方向梯度資料及該第二方向梯度資料,在該圖像之一目標像素之一鄰近區域內計算梯度統計,以得到一梯度統計量;以及一判斷電路,用來根據該梯度統計量,決定對應於該目標像素之一邊緣顯著度。 The embodiment of the present invention further discloses an image edge detection device for processing an image comprising a plurality of pixels, which includes a convolution circuit, including a first convolution circuit unit and a second convolution circuit unit, which are used to respectively perform a convolution operation on the image with a gradient operator in the first direction and a gradient operator in the second direction to obtain gradient data in the first direction and gradient data in the second direction, wherein the first direction is perpendicular to the second direction; Gradient statistics are calculated in a neighboring region of the pixel to obtain a gradient statistic; and a judging circuit is used to determine an edge saliency corresponding to the target pixel according to the gradient statistic.

10:圖像邊緣偵測方法 10: Image edge detection method

102-112:步驟 102-112: Steps

20,50:圖像邊緣偵測裝置 20,50: Image edge detection device

202,502:卷積電路 202,502: convolutional circuits

2022:第一卷積電路單元 2022: The first convolutional circuit unit

2024:第二卷積電路單元 2024: The second convolutional circuit unit

204,504:乘積電路 204,504: product circuits

206,506:統計電路 206,506: Statistical circuits

208,508:判斷電路 208,508: judgment circuit

210:處理電路 210: processing circuit

5022,5024:卷積電路單元 5022,5024: convolutional circuit unit

f(Je):邊緣顯著度函式 f(Je): edge saliency function

I:圖像 I: Image

Ixx(i,j)、Iyy(i,j)、Ixy(i,j):梯度統計量 Ixx (i,j), Iyy (i,j), Ixy (i,j): gradient statistics

Je:邊緣顯著度 Je: edge salience

Y:通道 Y: channel

UV:通道 UV: channel

YUV:圖像 YUV: Image

第1圖為本發明實施例之一圖像邊緣偵測方法之示意圖。 FIG. 1 is a schematic diagram of an image edge detection method according to an embodiment of the present invention.

第2圖為本發明實施例之一圖像邊緣偵測裝置之示意圖。 FIG. 2 is a schematic diagram of an image edge detection device according to an embodiment of the present invention.

第3圖為本發明實施例之一映射函數之一映射曲線之示意圖。 FIG. 3 is a schematic diagram of a mapping curve of a mapping function according to an embodiment of the present invention.

第4圖為本發明實施例之一應用場景之示意圖。 FIG. 4 is a schematic diagram of an application scenario of an embodiment of the present invention.

第5圖為本發明另一實施例之圖像邊緣偵測裝置之示意圖。 Fig. 5 is a schematic diagram of an image edge detection device according to another embodiment of the present invention.

請同時參考第1圖及第2圖,第1圖為本發明實施例之一圖像邊緣偵測方法10之示意圖,第2圖為本發明實施例之一圖像邊緣偵測裝置20之示意圖。圖像邊緣偵測裝置20可用來執行圖像邊緣偵測方法10以處理包含有複數個像素之一圖像I。圖像邊緣偵測裝置20包含有一卷積電路202、一乘積電路204、一統計電路206、一判斷電路208及一處理電路210。 Please refer to FIG. 1 and FIG. 2 at the same time. FIG. 1 is a schematic diagram of an image edge detection method 10 according to an embodiment of the present invention, and FIG. 2 is a schematic diagram of an image edge detection device 20 according to an embodiment of the present invention. The image edge detection device 20 can be used to execute the image edge detection method 10 to process an image I including a plurality of pixels. The image edge detection device 20 includes a convolution circuit 202 , a product circuit 204 , a statistics circuit 206 , a judgment circuit 208 and a processing circuit 210 .

在步驟104中,圖像邊緣偵測方法10以一第一方向之梯度算子(Operator)及一第二方向之梯度算子,分別對圖像I進行一卷積運算,以獲得一第一方向梯度資料Gx及一第二方向梯度資料Gy,其中第一方向垂直於第二方向。 In step 104, the image edge detection method 10 uses a gradient operator (Operator) in the first direction and a gradient operator in the second direction to perform a convolution operation on the image I respectively to obtain a gradient data Gx in the first direction and a gradient data Gy in the second direction, wherein the first direction is perpendicular to the second direction.

具體而言,卷積電路202之第一卷積電路單元2022以及第二卷積電路單元2024可針對圖像I的所有像素,分別以第一方向之梯度算子及第二方向之梯度算子進行卷積運算。在一實施例中,第一卷積電路單元2022可對圖像I以x方向梯度運算子Kx進行卷積運算,以得到第一方向梯度資料Gx,而第二卷積電路單元2024可對圖像I以y方向梯度運算子Ky進行卷積運算,以得到第二方向梯度資料Gy,並且上述x方向(即第一方向)與y方向(即第二方向)相互垂直。 Specifically, the first convolution circuit unit 2022 and the second convolution circuit unit 2024 of the convolution circuit 202 can respectively perform convolution operations on all pixels of the image I using gradient operators in the first direction and gradient operators in the second direction. In one embodiment, the first convolution circuit unit 2022 can perform convolution operation on the image I with the gradient operator Kx in the x direction to obtain the gradient data Gx in the first direction, and the second convolution circuit unit 2024 can perform convolution operation on the image I with the gradient operator Ky in the y direction to obtain the gradient data Gy in the second direction, and the above-mentioned x direction (ie, the first direction) and the y direction (ie, the second direction) are perpendicular to each other.

舉例來說,當目標像素A在圖像I中的座標為(i,j),圖像邊緣偵測裝置20可根據圖像邊緣偵測方法10之步驟104得到目標像素A之第一方向梯度資料 Gx以及第二方向梯度資料Gy,如下列式(1)-(4):Kx=[-1 0 1]...(1) For example, when the coordinates of the target pixel A in the image I are (i, j), the image edge detection device 20 can obtain the first direction gradient data Gx and the second direction gradient data Gy of the target pixel A according to the step 104 of the image edge detection method 10, as shown in the following formulas (1)-(4): Kx =[-1 0 1]...(1)

Ky=[-1 0 1] T ...(2) Ky = [-1 0 1] T ... (2)

Figure 111104348-A0305-02-0006-1
Figure 111104348-A0305-02-0006-1

Figure 111104348-A0305-02-0006-2
Figure 111104348-A0305-02-0006-2

其中,Kx為x方向的梯度運算子、Ky為y方向的梯度運算子,Gx(i,j)代表目標像素A與x方向梯度運算子Kx進行卷積後的結果、Gy(i,j)代表目標像素A與y方向梯度運算子Ky進行卷積後的結果。 Among them, Kx is the gradient operator in the x direction, Ky is the gradient operator in the y direction, Gx(i,j) represents the result of convolution between the target pixel A and the gradient operator Kx in the x direction, and Gy(i,j) represents the result of convolution between the target pixel A and the gradient operator Ky in the y direction.

由於現有的圖像邊緣偵測技術在決定圖像的邊緣方向性時,僅採用單一像素的梯度訊息,無法有效地辨識圖像中的紋理或弱邊緣,進而影響辨識圖像邊緣的準確性。因此,本發明實施例之圖像邊緣偵測方法10進一步採用目標像素A的鄰近區域的像素梯度訊息,以用於辨識圖像邊緣,其中鄰近區域可包含目標像素A之至少一相鄰像素。在一實施例中,鄰近區域可以是相鄰於目標像素A的5*5或7*7個像素單元的鄰近像素。 Since the existing image edge detection technology only uses the gradient information of a single pixel when determining the edge directionality of the image, it cannot effectively identify the texture or weak edge in the image, which further affects the accuracy of image edge identification. Therefore, the image edge detection method 10 of the embodiment of the present invention further uses the pixel gradient information of the adjacent area of the target pixel A for identifying the image edge, wherein the adjacent area may include at least one adjacent pixel of the target pixel A. In an embodiment, the adjacent area may be adjacent pixels of 5*5 or 7*7 pixel units adjacent to the target pixel A.

在步驟106中,圖像邊緣偵測方法10根據第一方向梯度資料Gx及第二方向梯度資料Gy,在圖像I之目標像素A之鄰近區域內計算梯度統計,以得到一梯度統計量。 In step 106 , the image edge detection method 10 calculates gradient statistics in the vicinity of the target pixel A in the image I according to the first directional gradient data Gx and the second directional gradient data Gy to obtain a gradient statistic.

實施上,可先利用乘積電路204,根據對於目標像素A的第一方向梯度資料Gx以及第二方向梯度資料Gy,計算第一方向梯度資料Gx的平方Gxx=GxGx、第二方向梯度資料Gy的平方Gyy=GyGy以及第一方向梯度資料Gx 與第二方向梯度資料Gy之乘積Gxy=GxGy。 In practice, the product circuit 204 can be used to calculate the square Gxx=GxGx of the first direction gradient data Gx, the square Gyy=GyGy of the second direction gradient data Gy, and the first direction gradient data Gx according to the first direction gradient data Gx and the second direction gradient data Gy of the target pixel A. The product Gxy with the second direction gradient data Gy=GxGy.

接著,統計電路206可根據一加權係數、第一方向梯度資料Gx的平方Gxx、第二方向梯度資料Gy的平方Gyy以及第一方向梯度資料Gx與第二方向梯度資料Gy之乘積Gxy,計算目標像素A鄰近區域內的梯度統計量,其中加權係數可以是一高斯加權或一均值加權。 Then, the statistical circuit 206 can calculate the gradient statistics in the vicinity of the target pixel A according to a weighting coefficient, the square Gxx of the first direction gradient data Gx, the square Gyy of the second direction gradient data Gy, and the product Gxy of the first direction gradient data Gx and the second direction gradient data Gy, wherein the weighting coefficient can be a Gaussian weighted or a mean weighted.

當加權係數w為高斯加權係數時,可以如式(5)所示:

Figure 111104348-A0305-02-0007-3
When the weighting coefficient w is a Gaussian weighting coefficient, it can be shown as formula (5):
Figure 111104348-A0305-02-0007-3

當加權係數w為均值係數時,可以如式(6)所示:w(m,n)=1...(6) When the weighting coefficient w is the mean coefficient, it can be shown in formula (6): w(m,n)=1...(6)

其中,σ為一常態分布的標準偏差,m、n的值為目標像素A的鄰近區域的範圍。例如,當鄰近區域為5*5像素單元時,則m、n分別為-2至2之間的整數(即-2、-1、0、1、2);當鄰近區域為7*7像素單元時,則m、n分別為-3至3之間的整數(即-3、-2、-1、0、1、2、3)。 Wherein, σ is the standard deviation of a normal distribution, and the values of m and n are the range of the adjacent area of the target pixel A. For example, when the adjacent area is a 5*5 pixel unit, m and n are integers between -2 and 2 (ie -2, -1, 0, 1, 2); when the adjacent area is a 7*7 pixel unit, then m and n are integers between -3 and 3 (ie -3, -2, -1, 0, 1, 2, 3).

因此,梯度統計量Ixx(i,j)、Iyy(i,j)、Ixy(i,j)可以如式(7)、(8)、(9)所示:

Figure 111104348-A0305-02-0007-4
Therefore, the gradient statistics Ixx (i, j), Iyy (i, j), Ixy (i, j) can be shown as formula (7), (8), (9):
Figure 111104348-A0305-02-0007-4

Figure 111104348-A0305-02-0007-5
Figure 111104348-A0305-02-0007-5

Figure 111104348-A0305-02-0007-6
Figure 111104348-A0305-02-0007-6

值得注意的是,圖像邊緣偵測方法10之步驟104及步驟106僅描述針對單一目標像素A計算目標像素A的鄰近像素的梯度統計量Ixx(i,j)、Iyy(i,j)、Ixy(i,j)。實際上,本發明實施例之圖像邊緣偵測裝置20根據圖像邊緣偵測方法10對圖像I中的所有像素計算對應的梯度統計量Ixx(i,j)、Iyy(i,j)、Ixy(i,j)。 It should be noted that the steps 104 and 106 of the image edge detection method 10 only describe the calculation of the gradient statistics Ixx (i,j), Iyy (i,j), and Ixy (i,j) of adjacent pixels of the target pixel A for a single target pixel A. In fact, the image edge detection device 20 of the embodiment of the present invention calculates the corresponding gradient statistics Ixx (i, j), Iyy (i, j), and Ixy (i, j) for all pixels in the image I according to the image edge detection method 10.

在此情形下,本發明實施例的圖像邊緣偵測方法10將目標像素A以及鄰近於目標像素A的相鄰區域的像素的梯度訊息作為決定圖像的邊緣方向性的判斷依據,以提升圖像邊緣方向性判斷的準確性。 In this case, the image edge detection method 10 of the embodiment of the present invention uses the gradient information of the target pixel A and the pixels in the adjacent area adjacent to the target pixel A as the basis for determining the edge directionality of the image, so as to improve the accuracy of image edge directionality judgment.

在步驟108中,圖像邊緣偵測方法10根據梯度統計量Ixx(i,j)、Iyy(i,j)、Ixy(i,j),決定對應於目標像素A之一邊緣顯著度Je。 In step 108 , the image edge detection method 10 determines an edge saliency Je corresponding to the target pixel A according to the gradient statistics Ixx (i,j), Iyy (i,j), and Ixy (i,j).

具體而言,邊緣顯著度Je可根據梯度統計量Ixx(i,j)、Iyy(i,j)、Ixy(i,j)之二階統計量之一共變異數矩陣(covariance matrix)決定。例如,梯度統計量Ixx(i,j)、Iyy(i,j)、Ixy(i,j)的一共變異數矩陣Cxy可以如式(10)所示:

Figure 111104348-A0305-02-0008-7
Specifically, the edge saliency degree Je may be determined according to a covariance matrix (covariance matrix), one of the second-order statistics of the gradient statistics Ixx (i,j), Iyy (i,j), and Ixy (i,j). For example, a covariance matrix Cxy of the gradient statistics Ixx (i, j), Iyy (i, j), Ixy (i, j) can be shown as formula (10):
Figure 111104348-A0305-02-0008-7

當共變異數矩陣Cxy之一主方向之特徵值(eigenvalue)λ1與一次方向之特徵值λ2之一差距越大時,表示目標像素A之邊緣顯著度越大,其中主方向與次方向相互正交。由於梯度統計量Ixx(i,j)、Iyy(i,j)、Ixy(i,j)是根據目標像素A以及其鄰近區域的像素的梯度資訊所獲得,而當λ1≫λ2時,對應的鄰近區域可能為邊緣區域。 When the difference between the eigenvalue λ 1 of the main direction and the eigenvalue λ 2 of the primary direction of the covariance matrix Cxy is larger, it means that the edge saliency of the target pixel A is greater, wherein the main direction and the secondary direction are orthogonal to each other. Since the gradient statistics Ixx (i, j), Iyy (i, j), and Ixy (i, j) are obtained according to the gradient information of the target pixel A and the pixels in its adjacent area, when λ 1 ≫ λ 2 , the corresponding adjacent area may be an edge area.

在一實施例中,本發明實施例之圖像邊緣偵測方法10即可將邊緣顯著度Je設置為:

Figure 111104348-A0305-02-0009-8
In one embodiment, the image edge detection method 10 of the embodiment of the present invention can set the edge salient degree Je as:
Figure 111104348-A0305-02-0009-8

當λ1與λ2的差異越大時,則邊緣顯著度越大;當λ1與λ2相同時,則邊緣顯著度Je=2。除此之外,式(11)也可推導成為等效式(12):

Figure 111104348-A0305-02-0009-9
When the difference between λ 1 and λ 2 is larger, the edge salience is greater; when λ 1 and λ 2 are the same, the edge salience is Je=2. Besides, formula (11) can also be deduced into equivalent formula (12):
Figure 111104348-A0305-02-0009-9

實施上,可藉由判斷電路208來判斷邊緣顯著度Je,判斷電路208可利用式(11)或式(12)計算邊緣顯著度Je。 In practice, the judgment circuit 208 can be used to judge the edge salience degree Je, and the judgment circuit 208 can calculate the edge salience degree Je by using formula (11) or formula (12).

在步驟110中,圖像邊緣偵測方法10將對應於圖像I之邊緣顯著度Je進行正規化,並且以一映射方式決定圖像I之一邊緣資料。 In step 110 , the image edge detection method 10 normalizes the edge saliency Je corresponding to the image I, and determines the edge data of the image I in a mapping manner.

由於邊緣顯著度Je的範圍為[2,∞),因此在實際使用時需要正規化至0至1之間,並進行適當的映射,以符合應用場景的需求。本發明實施例之圖像邊緣偵測方法10將對應於圖像之邊緣顯著度Je進行正規化(Normalized),並且以一映射方式決定圖像之一邊緣資料Jec,其可表示為:Jec=f(Je)...(13) Since the range of the edge saliency Je is [2,∞), it needs to be normalized to be between 0 and 1 in actual use, and be properly mapped to meet the requirements of the application scenario. The image edge detection method 10 of the embodiment of the present invention normalizes the edge saliency Je corresponding to the image (Normalized), and determines the edge data Jec of the image by a mapping method, which can be expressed as: Jec =f( Je )...(13)

在一實施例中,圖像邊緣偵測方法10可透過一映射函數f(.)將邊緣顯著度Je調整到適當的值,上述映射方式可以是一簡單線性映射、一查找表映射、一指數映射或一對數映射等。 In one embodiment, the image edge detection method 10 can adjust the edge saliency degree Je to an appropriate value through a mapping function f(.), and the above-mentioned mapping method can be a simple linear mapping, a lookup table mapping, an exponential mapping, or a logarithmic mapping.

當映射方式為簡單線性映射時,邊緣資料Jec可表示為:Jec=min(max(a(Je-b),0),1)...(14) When the mapping method is simple linear mapping, the edge data Jec can be expressed as: Jec =min(max( a ( Je - b ),0),1)...(14)

當映射方式為查找表映射時,則可根據第3圖所示之曲線所對應的一查找表來進行,並且將邊緣顯著度Je截位(clip)至一定範圍後再進行查找表映射,在此情形下,邊緣資料Jec可表示為:Jec=LUT(min(max(Je,a),b))...(15) When the mapping method is look-up table mapping, it can be performed according to a look-up table corresponding to the curve shown in Figure 3, and the edge saliency Je is clipped to a certain range before performing look-up table mapping. In this case, the edge data Jec can be expressed as: Jec =LUT(min(max(Je,a),b))...(15)

實施上,可利用處理電路210來對邊緣顯著度Je進行正規化及映射處理。在一實施例中,處理電路210係包含一查表電路,查表電路藉由查找預先儲存於記憶體的查找表來完成映射處理。 In practice, the processing circuit 210 can be used to perform normalization and mapping processing on the edge saliency degree Je. In one embodiment, the processing circuit 210 includes a table lookup circuit, and the table lookup circuit completes the mapping process by looking up a lookup table stored in memory in advance.

值得注意的是,本發明實施例圖像邊緣偵測方法10可因應不同應用場景選擇不同的映射方式調整邊緣顯著度Je。舉例來說,當圖像I的感光度(ISO值)為一低感光度時(例如ISO 100),處理電路210的查表電路藉由查找一第一查找表來進行映射處理,而當圖像I的感光度(ISO值)為一高感光度時(例如ISO 3200),處理電路210的查表電路藉由查找一第二查找表來進行映射處理,第一查找表與第二查找表係對應不同的映射曲線。 It is worth noting that the image edge detection method 10 according to the embodiment of the present invention can select different mapping methods to adjust the edge saliency degree Je according to different application scenarios. For example, when the sensitivity (ISO value) of the image I is a low sensitivity (such as ISO 100), the lookup table circuit of the processing circuit 210 performs mapping processing by looking up a first lookup table, and when the sensitivity (ISO value) of the image I is a high sensitivity (such as ISO 3200), the table lookup circuit of the processing circuit 210 performs mapping processing by looking up a second lookup table, and the first lookup table and the second lookup table correspond to different mapping curves.

請參考第4圖,第4圖為本發明實施例之一應用場景之示意圖。依據本發明實施例之圖像邊緣偵測方法10所產生的圖像I像素的邊緣資料Jec,可應用於對圖像I的一銳化(Sharpening)處理。 Please refer to FIG. 4, which is a schematic diagram of an application scenario of an embodiment of the present invention. The edge data Jec of the image I pixels generated by the image edge detection method 10 according to the embodiment of the present invention can be applied to a sharpening process on the image I.

銳化處理是用以提昇圖像的銳利度,一般來說,銳化處理是針對YUV圖像的Y通道(即亮度通道)進行處理。如第4圖所示,對圖像I進行處理時係先將Y通道分離出來。接著,對Y通道進行細節提取,以產生一紋理層、一邊緣層及一基礎層,而依據本發明實施例之圖像邊緣偵測方法10所產生的邊緣顯著度Je可用來做為調整圖像的邊緣層的參數。實施上,係利用邊緣顯著度Je經正規化及映射處理後所得到的邊緣資料Jec調整圖像的邊緣層。 The sharpening process is used to improve the sharpness of the image. Generally speaking, the sharpening process is performed on the Y channel (ie, the brightness channel) of the YUV image. As shown in Figure 4, when image I is processed, the Y channel is first separated. Next, the details of the Y channel are extracted to generate a texture layer, an edge layer and a base layer, and the edge saliency Je generated by the image edge detection method 10 according to the embodiment of the present invention can be used as a parameter for adjusting the edge layer of the image. In practice, the edge layer of the image is adjusted by using the edge data Jec obtained after the edge saliency degree Je is normalized and mapped.

在一實施例中,邊緣資料Jec可與對應的邊緣層相乘(如第4圖所示,即邊緣資料Jec為邊緣層的一乘積係數)。在其它實施例中,邊緣資料Jec也可以加法、減法、或除法等邏輯運算方式來調整邊緣層。最後,經由本發明實施例之邊緣資料Jec調整後的圖像邊緣層與基礎層結合後得到銳化後的Y通道,再與經由顏色處理的UV通道合併,以輸出處理後的YUV圖像。 In one embodiment, the edge data Jec can be multiplied by the corresponding edge layer (as shown in FIG. 4 , that is, the edge data Jec is a multiplication coefficient of the edge layer). In other embodiments, the edge data Jec can also adjust the edge layer by logical operations such as addition, subtraction, or division. Finally, the image edge layer adjusted by the edge data Jec of the embodiment of the present invention is combined with the base layer to obtain a sharpened Y channel, which is then combined with the color-processed UV channel to output a processed YUV image.

請參考第5圖,第5圖為本發明實施例之一圖像邊緣偵測裝置50之示意圖。圖像邊緣偵測裝置50亦可用以實施圖像邊緣偵測方法10。圖像邊緣偵測裝置50包含一卷積電路502、一乘積電路504、一統計電路506及一判斷電路508,其中卷積電路502包含有卷積電路單元5022、5024。 Please refer to FIG. 5 , which is a schematic diagram of an image edge detection device 50 according to an embodiment of the present invention. The image edge detection device 50 can also be used to implement the image edge detection method 10 . The image edge detection device 50 includes a convolution circuit 502 , a product circuit 504 , a statistical circuit 506 and a judgment circuit 508 , wherein the convolution circuit 502 includes convolution circuit units 5022 , 5024 .

如第5圖所示,圖像I被輸入至圖像邊緣偵測裝置50,可經由卷積電路的卷積電路單元5022、5024分別對圖像I進行卷積運算(例如,卷積電路單元5022以x方向梯度運算子Kx對圖像I進行卷積運算,卷積電路單元5024以y方向梯度運算子Ky對圖像I進行卷積運算),以得到第一方向梯度資料Gx以及第二方向梯度資料Gy。為了配合的乘積電路504的需求及/或減少計算量,卷積電路502可包含有多個移位電路,以對卷積電路單元5022、5024之輸出進行移位處理(例 如,向右移位一位元(bit))。 As shown in FIG. 5, the image I is input to the image edge detection device 50, and the image I can be convoluted through the convolution circuit units 5022 and 5024 of the convolution circuit (for example, the convolution circuit unit 5022 performs convolution operation on the image I with the x-direction gradient operator Kx, and the convolution circuit unit 5024 performs convolution operation on the image I with the y-direction gradient operator Ky), to obtain the first direction gradient data Gx and the second direction gradient data Gy. In order to meet the needs of the product circuit 504 and/or reduce the amount of calculation, the convolution circuit 502 may include a plurality of shift circuits to perform shift processing on the outputs of the convolution circuit units 5022, 5024 (for example For example, shift right by one bit).

接著,乘積電路504利用平方電路以及乘法電路,計算第一方向梯度資料Gx的平方Gxx、第二方向梯度資料Gy的平方Gyy以及第一方向梯度資料Gx與第二方向梯度資料Gy之乘積Gxy,並且由移位電路以及截位電路Clip[.]將其結果向右移兩位元,並截取-2048至2047位元,以配合統計電路506的需求及/或減少計算量。 Next, the product circuit 504 uses the square circuit and the multiplication circuit to calculate the square Gxx of the first direction gradient data Gx, the square Gyy of the second direction gradient data Gy, and the product Gxy of the first direction gradient data Gx and the second direction gradient data Gy, and the shift circuit and the truncation circuit Clip[. ] shift the result to the right by 2 bits, and intercept -2048 to 2047 bits to meet the needs of the statistical circuit 506 and/or reduce the amount of calculation.

進一步地,統計電路506包含加總電路Σ(.)以及截位電路Clip[.],以根據鄰近於目標像素A的鄰近區域的梯度資料,計算局部區域內的梯度統計量Ixx(i,j)、Iyy(i,j)、Ixy(i,j)並進行截位處理。 Further, the statistical circuit 506 includes a summation circuit Σ (.) and a truncation circuit Clip[. ], to calculate the gradient statistics Ixx (i, j), Iyy (i, j), Ixy (i, j) in the local area according to the gradient data of the adjacent area adjacent to the target pixel A and perform truncation processing.

最後,判斷電路508可以邏輯運算電路、移位電路、截位電路Clip[.]及除法電路實現上述式(12),以得到對應的邊緣顯著度Je。在一實施例中,圖像邊緣偵測裝置50可進一步包含一處理電路(未繪示),用以對邊緣顯著度Je進行正規化及映射處理,以符合應用場景的需求。 Finally, the judging circuit 508 can be a logic operation circuit, a shift circuit, a truncation circuit Clip[. ] and the division circuit realize the above formula (12) to obtain the corresponding edge salience degree Je. In one embodiment, the image edge detection device 50 may further include a processing circuit (not shown) for normalizing and mapping the edge saliency Je to meet the requirements of the application scene.

值得注意的是,第5圖所標示的位元數為用來說明圖像邊緣偵測裝置50的各個電路之間的位元關係,而非用來限定圖像邊緣偵測裝置50的實施方式。此外,圖像邊緣偵測裝置50中的硬體電路及其連接關係僅為實施圖像邊緣偵測方法10的一種電路實施方式,而不以此為限制。 It should be noted that the number of bits indicated in FIG. 5 is used to illustrate the bit relationship between the various circuits of the image edge detection device 50 , rather than to limit the implementation of the image edge detection device 50 . In addition, the hardware circuit and its connections in the image edge detection device 50 are only a circuit implementation for implementing the image edge detection method 10 , and are not limited thereto.

綜上所述,本發明所提供的圖像邊緣偵測方法及圖像邊緣偵測裝置,以鄰近於目標像素的梯度統計訊息來判斷圖像的邊緣,進而有效提升偵測 圖像中的有方向的邊緣的精準度。 In summary, the image edge detection method and the image edge detection device provided by the present invention judge the edge of the image with the gradient statistical information adjacent to the target pixel, thereby effectively improving the detection The accuracy of oriented edges in the image.

以上所述僅為本發明之較佳實施例,凡依本發明申請專利範圍所做之均等變化與修飾,皆應屬本發明之涵蓋範圍。 The above descriptions are only preferred embodiments of the present invention, and all equivalent changes and modifications made according to the scope of the patent application of the present invention shall fall within the scope of the present invention.

10:圖像邊緣偵測方法 10: Image edge detection method

102-112:步驟 102-112: Steps

Claims (17)

一種圖像邊緣偵測方法,執行於一圖像邊緣偵測裝置上,用以處理包含有複數個像素之一圖像,該方法包含有:以一第一方向之梯度算子及一第二方向之梯度算子,分別對該圖像進行一卷積運算,以獲得一第一方向梯度資料及一第二方向梯度資料,其中該第一方向垂直於該第二方向;根據該第一方向梯度資料及該第二方向梯度資料,在該圖像之一目標像素之一鄰近區域內計算梯度統計,以得到一梯度統計量;以及根據該梯度統計量,決定對應於該目標像素之一邊緣顯著度。 An image edge detection method, executed on an image edge detection device, for processing an image comprising a plurality of pixels, the method includes: using a gradient operator in a first direction and a gradient operator in a second direction to perform a convolution operation on the image respectively to obtain gradient data in a first direction and gradient data in a second direction, wherein the first direction is perpendicular to the second direction; according to the gradient data in the first direction and the gradient data in the second direction, calculate gradient statistics in an adjacent area of a target pixel of the image to obtain a gradient statistic; A statistic that determines the saliency of an edge corresponding to the target pixel. 如請求項1所述之圖像邊緣偵測方法,其中得到該梯度統計量的操作包含:計算該第一方向梯度資料的平方、該第二方向梯度資料的平方以及該第一方向梯度資料與該第二方向梯度資料之一乘積,以據以得到該梯度統計量。 The image edge detection method as described in Claim 1, wherein the operation of obtaining the gradient statistics includes: calculating the square of the gradient data in the first direction, the square of the gradient data in the second direction, and the product of the gradient data in the first direction and the gradient data in the second direction, so as to obtain the gradient statistics. 如請求項1所述之圖像邊緣偵測方法,其中得到該梯度統計量的操作包含:根據一加權係數、該第一方向梯度資料以及該第二方向梯度資料,得到該梯度統計量。 The image edge detection method according to claim 1, wherein the operation of obtaining the gradient statistics includes: obtaining the gradient statistics according to a weighting coefficient, the gradient data in the first direction, and the gradient data in the second direction. 如請求項1所述之圖像邊緣偵測方法,其中該鄰近區域包含該目標像素以及該目標像素之至少一相鄰像素。 The image edge detection method according to claim 1, wherein the adjacent area includes the target pixel and at least one adjacent pixel of the target pixel. 如請求項1所述之圖像邊緣偵測方法,其中該邊緣顯著度是根據該梯度統計量之一共變異數矩陣(covariance matrix)決定。 The image edge detection method according to claim 1, wherein the edge saliency is determined according to a covariance matrix of the gradient statistics. 如請求項5所述之圖像邊緣偵測方法,其中當該共變異數矩陣之一主方向之特徵值(eigenvalue)與一次方向之特徵值之一差距越大時,該目標像素之邊緣顯著度越大。 The image edge detection method according to claim 5, wherein the greater the difference between the eigenvalue of the covariance matrix in the main direction and the eigenvalue in the primary direction, the greater the saliency of the edge of the target pixel. 如請求項6所述之圖像邊緣偵測方法,其中該主方向與該次方向相互正交。 The image edge detection method according to claim 6, wherein the main direction and the secondary direction are orthogonal to each other. 如請求項1所述之圖像邊緣偵測方法,其另包含有:將對應於該圖像之邊緣顯著度進行正規化,並且以一映射方式決定該圖像之一邊緣資料。 The image edge detection method according to Claim 1 further includes: normalizing the edge saliency corresponding to the image, and determining edge data of the image in a mapping manner. 如請求項8所述之圖像邊緣偵測方法,另包含有:依據該邊緣資料對該圖像進行一銳化(Sharpening)處理。 The image edge detection method as described in Claim 8 further includes: performing a sharpening process on the image according to the edge data. 一種圖像邊緣偵測裝置,用以處理包含有複數個像素之一圖像,其包含有:一卷積電路,包含有一第一卷積電路單元以及一第二卷積電路單元,用來以一第一方向之梯度算子及一第二方向之梯度算子,分別對該圖像進行一卷積運算,以獲得一第一方向梯度資料及一第二方向梯度資料,其中該第一方向垂直於該第二方向;一統計電路,用來根據該第一方向梯度資料及該第二方向梯度資料,在該圖 像之一目標像素之一鄰近區域內計算梯度統計,以得到一梯度統計量;以及一判斷電路,用來根據該梯度統計量,決定對應於該目標像素之一邊緣顯著度。 An image edge detection device for processing an image containing a plurality of pixels, which includes: a convolution circuit, including a first convolution circuit unit and a second convolution circuit unit, used to perform a convolution operation on the image with a gradient operator in a first direction and a gradient operator in a second direction, respectively, to obtain a gradient data in a first direction and a gradient data in a second direction, wherein the first direction is perpendicular to the second direction; Gradient statistics are calculated in a neighboring region of a target pixel to obtain a gradient statistic; and a judging circuit is used to determine an edge saliency corresponding to the target pixel according to the gradient statistic. 如請求項10所述之圖像邊緣偵測裝置,其另包含有:一乘積電路,用來計算該第一方向梯度資料的平方、該第二方向梯度資料的平方以及該第一方向梯度資料與該第二方向梯度資料之一乘積。 The image edge detection device according to claim 10, further comprising: a product circuit for calculating the square of the gradient data in the first direction, the square of the gradient data in the second direction, and a product of the gradient data in the first direction and the gradient data in the second direction. 如請求項10所述之圖像邊緣偵測裝置,其中該統計電路用來根據一加權係數、該第一方向梯度資料以及該第二方向梯度資料,得到該梯度統計量。 The image edge detection device according to claim 10, wherein the statistics circuit is used to obtain the gradient statistics according to a weighting coefficient, the gradient data in the first direction and the gradient data in the second direction. 如請求項10所述之圖像邊緣偵測裝置,其中該鄰近區域包含該目標像素以及該目標像素之至少一相鄰像素。 The image edge detection device according to claim 10, wherein the adjacent area includes the target pixel and at least one adjacent pixel of the target pixel. 如請求項10所述之圖像邊緣偵測裝置,其中該判斷電路是根據該梯度統計量之一共變異數矩陣(covariance matrix)決定該邊緣顯著度。 The image edge detection device according to claim 10, wherein the judging circuit determines the edge saliency according to a covariance matrix of the gradient statistics. 如請求項14所述之圖像邊緣偵測裝置,其中當該共變異數矩陣之一主方向之特徵值(eigenvalue)與一次方向之特徵值之一差距越大時,該目標像素之邊緣顯著度越大。 The image edge detection device according to claim 14, wherein the greater the difference between the eigenvalue in the main direction and the eigenvalue in the primary direction of the covariance matrix, the greater the saliency of the edge of the target pixel. 如請求項15所述之圖像邊緣偵測裝置,其中該主方向與該次方向 相互正交。 The image edge detection device as described in claim 15, wherein the main direction and the secondary direction orthogonal to each other. 如請求項10所述之圖像邊緣偵測裝置,其另包含有:一處理電路,用來將對應於該圖像之邊緣顯著度進行正規化及映射處理,以得到該圖像之一邊緣資料。 The image edge detection device according to claim 10 further includes: a processing circuit for normalizing and mapping the edge saliency corresponding to the image to obtain edge data of the image.
TW111104348A 2022-02-07 2022-02-07 Image edge detecting method and image edge processing device TWI807627B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW111104348A TWI807627B (en) 2022-02-07 2022-02-07 Image edge detecting method and image edge processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW111104348A TWI807627B (en) 2022-02-07 2022-02-07 Image edge detecting method and image edge processing device

Publications (2)

Publication Number Publication Date
TWI807627B true TWI807627B (en) 2023-07-01
TW202333109A TW202333109A (en) 2023-08-16

Family

ID=88149119

Family Applications (1)

Application Number Title Priority Date Filing Date
TW111104348A TWI807627B (en) 2022-02-07 2022-02-07 Image edge detecting method and image edge processing device

Country Status (1)

Country Link
TW (1) TWI807627B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI342153B (en) * 2007-01-04 2011-05-11 Himax Tech Inc Edge-oriented interpolation method and system for a digital image
CN103208117A (en) * 2013-03-21 2013-07-17 袁景 Intelligent multifunctional belt surface patch edge detection method
TW201432620A (en) * 2013-02-05 2014-08-16 Lsi Corp Image processor with edge selection functionality

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI342153B (en) * 2007-01-04 2011-05-11 Himax Tech Inc Edge-oriented interpolation method and system for a digital image
TW201432620A (en) * 2013-02-05 2014-08-16 Lsi Corp Image processor with edge selection functionality
CN103208117A (en) * 2013-03-21 2013-07-17 袁景 Intelligent multifunctional belt surface patch edge detection method

Also Published As

Publication number Publication date
TW202333109A (en) 2023-08-16

Similar Documents

Publication Publication Date Title
US9483835B2 (en) Depth value restoration method and system
US8090214B2 (en) Method for automatic detection and correction of halo artifacts in images
CN106067177B (en) HDR scene detection method and device
CN103455994A (en) Method and equipment for determining image blurriness
CN110415208A (en) A kind of adaptive targets detection method and its device, equipment, storage medium
CN111210393B (en) Color image enhancement method, system and storage medium based on edge extraction
CN109685142A (en) A kind of image matching method and device
CN112991374B (en) Canny algorithm-based edge enhancement method, canny algorithm-based edge enhancement device, canny algorithm-based edge enhancement equipment and storage medium
CN115797300A (en) Edge detection method and device based on adaptive gradient threshold canny operator
CN109255792B (en) Video image segmentation method and device, terminal equipment and storage medium
CN115578284A (en) Multi-scene image enhancement method and system
CN111369570A (en) Multi-target detection tracking method for video image
CN114998186B (en) Method and system for detecting surface scab defect of copper starting sheet based on image processing
CN111325728B (en) Product defect detection method, device, equipment and storage medium
CN115131359A (en) Method for detecting pitting defects on surface of metal workpiece
CN117557820A (en) Quantum dot optical film damage detection method and system based on machine vision
US11348251B2 (en) Device and method for determining edge location based on adaptive weighing of gradients
CN113628169B (en) Infrared image automatic focusing evaluation method, system and medium based on pseudo color
TWI807627B (en) Image edge detecting method and image edge processing device
CN106415596A (en) Segmentation based image transform
CN117611483A (en) Image acquisition method, device, equipment and storage medium
CN111553927A (en) Checkerboard corner detection method, checkerboard corner detection system, computer device and storage medium
US20230386023A1 (en) Method for detecting medical images, electronic device, and storage medium
CN108416815B (en) Method and apparatus for measuring atmospheric light value and computer readable storage medium
US20230237668A1 (en) Image edge detection method and image edge detection device