TWI479448B - Image pre-processing system and method - Google Patents
Image pre-processing system and method Download PDFInfo
- Publication number
- TWI479448B TWI479448B TW101124369A TW101124369A TWI479448B TW I479448 B TWI479448 B TW I479448B TW 101124369 A TW101124369 A TW 101124369A TW 101124369 A TW101124369 A TW 101124369A TW I479448 B TWI479448 B TW I479448B
- Authority
- TW
- Taiwan
- Prior art keywords
- matrix
- mxn
- original image
- size
- image
- Prior art date
Links
Landscapes
- Image Processing (AREA)
Description
本發明係關於一種影像前處理方法及系統,更詳而言之,係一種藉由矩陣前處理以提升效率的影像前處理方法及系統。The present invention relates to an image pre-processing method and system, and more particularly to an image pre-processing method and system for improving efficiency by matrix pre-processing.
隨著數位影像日益普及,透過影像處理技術將影像資料分析處理亦廣泛應用於醫學、數學、生物學、氣象學、工程科學…等學科之領域,甚至及於日常生活上。近來更由於多媒體設備技術之提升,使影像處理速度大幅上升且處理成本下降,顯示影像處理技術日益重要。With the increasing popularity of digital images, image processing and analysis is also widely used in the fields of medicine, mathematics, biology, meteorology, engineering science, etc., and even in daily life. Recently, due to the advancement of multimedia device technology, image processing speed has increased dramatically and processing costs have decreased, and display image processing technology has become increasingly important.
數位影像係為具有不同亮度與顏色之點(亦即,像素)之集合,每一個像素均有其位置與灰度值(gray level),藉由將數位影像中各像素之位置與灰度值化為矩陣形式,可經由不同演算法(algorithm)以達到各種不同影像處理之功能,例如:影像轉換、色彩轉換與分析、影像強化、特徵擷取、影像分割、影像表示與描述、影像壓縮及影像重建等。A digital image is a collection of points (ie, pixels) having different brightness and color. Each pixel has its position and gray level by using the position and gray value of each pixel in the digital image. In the form of a matrix, different algorithms can be used to achieve various image processing functions, such as image conversion, color conversion and analysis, image enhancement, feature extraction, image segmentation, image representation and description, image compression and Image reconstruction, etc.
惟,由於習知之影像處理方法需使用四階陣列運算,因此,不利於現今中央處理器、多核心中央處理器與顯示晶片中之大量核心處理器之高效率二階矩陣運算,致使影像處理效率隨影像尺寸上升而急遽下滑。如下列習知之影像處理之四階陣列方程式(1)所示,其中,H ij 表示經過影像處理後之矩陣,F ijkl 表示原始影像中待處理區域之四階 矩陣,G kl 表示欲設定之影像處理演算法所構成之遮罩(mask)矩陣,m、n係為正整數,用以表示該遮罩矩陣之大小。However, since the conventional image processing method needs to use the fourth-order array operation, it is not conducive to the high-efficiency second-order matrix operation of a large number of core processors in the central processing unit, the multi-core central processing unit and the display chip, so that the image processing efficiency is The image size has risen sharply and has fallen sharply. As shown in the following fourth-order array equation (1) of image processing, where H ij represents a matrix after image processing, F ijkl represents a fourth-order matrix of a region to be processed in the original image, and G kl represents an image to be set. A mask matrix formed by the processing algorithm, m and n are positive integers for indicating the size of the mask matrix.
可見,若中央處理器對上述方程式(1)進行運算,將無法提升影像處理的效率。It can be seen that if the central processor performs the operation on the above equation (1), the efficiency of image processing cannot be improved.
綜上所述,如何改善影像處理中之陣列運算,以提升影像處理之效率,遂成為目前亟待解決的課題。In summary, how to improve the array operation in image processing to improve the efficiency of image processing has become an urgent problem to be solved.
為解決前述習知技術之缺失,本發明之目的在於提供一種影像前處理方法及系統,藉由將影像處理之四階陣列轉換為二階陣列,以充分利用顯示晶片之高效能二階矩陣運算能力,可大幅提升影像處理之運算效率。In order to solve the above-mentioned shortcomings of the prior art, an object of the present invention is to provide an image pre-processing method and system, which can utilize the high-performance second-order matrix computing capability of the display chip by converting the fourth-order array of image processing into a second-order array. Can greatly improve the efficiency of image processing.
本發明係揭露一種影像前處理方法,包括以下步驟:(A)取得具有[M N]大小之原始影像矩陣;(B)將預設定之影像處理演算式轉換為具有[m n]大小之第一遮罩矩陣;(C)以該原始影像矩陣中任一元素(element)之位置為原點,選定一[m n]大小之待測區域矩陣,再將該原始影像矩陣周圍附加空白陣列以形成mxn個擴張矩陣;(D)依據該第一遮罩矩陣之大小以及該原始影像矩陣之大小,形成具有[MxN mxn]大小之暫存矩陣,其中,元素MxN係用以記憶該待測區域矩陣之原點,元素mxn係用以記憶各該待測區域矩陣之元素;(E)重複執行步驟(C)及步驟(D) 直至該原始影像矩陣中所有元素均完成計算以填滿該暫存矩陣;(F)將該第一遮罩矩陣對應該暫存矩陣展開為具有[MxN mxn]大小之第二遮罩矩陣;以及(G)將該暫存矩陣與該第二遮罩矩陣進行點乘,以取得[MxN mxn]大小之結果矩陣,再將該結果矩陣依預定規則進行階度轉換以得到新影像矩陣。The invention discloses an image pre-processing method, comprising the steps of: (A) obtaining an original image matrix having a size of [MN]; and (B) converting a preset image processing algorithm into a first mask having a size of [mn] a mask matrix; (C) taking a position of any element in the original image matrix as an origin, selecting a matrix of the area to be tested of [mn] size, and then adding a blank array around the original image matrix to form mxn Expanding the matrix; (D) forming a temporary storage matrix having a size of [MxN mxn] according to the size of the first mask matrix and the size of the original image matrix, wherein the element MxN is used to memorize the original matrix of the area to be tested Point, element mxn is used to memorize the elements of each matrix of the area to be tested; (E) repeat steps (C) and (D) Until all elements in the original image matrix are calculated to fill the temporary storage matrix; (F) expanding the first mask matrix corresponding to the temporary storage matrix to a second mask matrix having a size of [MxN mxn]; (G) multiplying the temporary storage matrix by the second mask matrix to obtain a result matrix of [MxN mxn] size, and then performing the step conversion according to a predetermined rule to obtain a new image matrix.
前述之影像前處理方法中,該影像處理演算式可為影像濾波演算式、形態學演算式或邊角檢測演算式,且可使用平行運算技術進行該暫存矩陣與該第二遮罩矩陣之點乘。In the foregoing image preprocessing method, the image processing calculation formula may be an image filtering calculation formula, a morphological calculation formula or a corner detection calculation formula, and the parallel operation technology may be used to perform the temporary storage matrix and the second mask matrix. Point multiply.
本發明復揭露一種影像前處理方法,包括以下步驟:(A)取得具有[M N]大小之原始影像矩陣;(B)以該原始影像矩陣作為初始矩陣,進一步取得該原始影像矩陣隨時間變化之複數待觀察影像矩陣;(C)於該原始影像矩陣中選定一特徵區域,並將該特徵區域轉換為具有[m n]大小之第一遮罩矩陣;(D)以該原始影像矩陣中任一元素之位置為原點,選定一[m n]大小之待測區域矩陣,再將該原始影像矩陣周圍附加空白陣列以形成mxn個擴張矩陣;(E)依據該第一遮罩矩陣之大小以及該原始影像矩陣之大小,形成具有[MxN mxn]大小之暫存矩陣,其中,元素MxN係用以記憶於該原始影像矩陣所選定之原點的位置,元素mxn係用以記憶各該待測區域矩陣之元素;(F)重複執行步驟(D)及步驟(E)直至該原始影像矩陣中所有元素均完成計算以填滿該暫存矩陣;(G)將該第一遮罩矩陣對應該暫存矩陣 展開為具有[MxN mxn]大小之第二遮罩矩陣;(H)將該暫存矩陣與該第二遮罩矩陣進行點乘,以取得[MxN mxn]大小之結果矩陣,再將該結果矩陣依預定規則進行階度轉換以得到該特徵區域於該原始影像中之位置;以及(G)以各該待觀察影像矩陣取代該原始影像矩陣,執行步驟(D)至步驟(H),以取得該特徵區域於各該待觀察影像矩陣中之位置,建立該特徵區域隨時間移動之軌跡。The present invention further discloses an image pre-processing method comprising the steps of: (A) obtaining an original image matrix having a size of [MN]; (B) using the original image matrix as an initial matrix, further obtaining the original image matrix to change with time. Complex image matrix to be observed; (C) selecting a feature region in the original image matrix, and converting the feature region into a first mask matrix having a size of [mn]; (D) using any of the original image matrix The position of the element is the origin, a matrix of the area to be tested of [mn] size is selected, and a blank array is added around the original image matrix to form mxn expansion matrices; (E) according to the size of the first mask matrix and The size of the original image matrix forms a temporary storage matrix having a size of [MxN mxn], wherein the element MxN is used to memorize the position of the origin selected by the original image matrix, and the element mxn is used to memorize each of the regions to be tested. The elements of the matrix; (F) repeating steps (D) and (E) until all elements in the original image matrix are calculated to fill the temporary storage matrix; (G) the first mask matrix corresponds to the temporary Deposit moment Expanded to a second mask matrix having a size of [MxN mxn]; (H) multiply the scratch matrix with the second mask matrix to obtain a result matrix of [MxN mxn] size, and then the result matrix Performing gradation conversion according to a predetermined rule to obtain a position of the feature region in the original image; and (G) replacing the original image matrix with each of the image matrix to be observed, performing step (D) to step (H) to obtain The feature area is located in each of the image matrix to be observed, and a trajectory of the feature area moving with time is established.
本發明之影像前處理系統包括:原始影像模組,係用以取得具有[M N]大小之原始影像矩陣;影像處理演算法模組,係用以將預設定之影像處理演算式轉換為具有[m n]大小之第一遮罩矩陣;擴張矩陣模組,係以該原始影像矩陣中任一元素之位置為原點,選定一[m n]大小之待測區域矩陣,再將該原始影像矩陣周圍附加空白陣列以形成mxn個擴張矩陣;暫存矩陣模組,係依據該第一遮罩矩陣之大小以及該原始影像矩陣之大小,形成具有[MxN mxn]大小之暫存矩陣,其中,元素MxN係用以記憶該待測區域矩陣之原點,元素mxn係用以記憶各該待測區域矩陣之元素;迴圈處理模組,係用以重複執行該擴張矩陣模組及該暫存矩陣模組之功能直至該原始影像矩陣中所有元素均完成計算以填滿該暫存矩陣;遮罩矩陣處理模組,係用以將該第一遮罩矩陣對應該暫存矩陣展開為具有[MxN mxn]大小之第二遮罩矩陣;以及影像處理模組,係用以將該暫存矩陣與該第二遮罩矩陣進行點乘,以取得[MxN mxn]大小之結果矩陣,再將該結果矩陣依預定規則進行階度轉換以得到新影 像矩陣。The image pre-processing system of the present invention comprises: an original image module for acquiring an original image matrix having a size of [MN]; and an image processing algorithm module for converting a preset image processing algorithm into having [ Mn] the first mask matrix of size; the expansion matrix module takes the position of any element in the original image matrix as the origin, selects a matrix of the area to be tested of [mn] size, and surrounds the original image matrix The blank array is added to form mxn expansion matrices; the temporary storage matrix module forms a temporary storage matrix having a size of [MxN mxn] according to the size of the first mask matrix and the size of the original image matrix, wherein the element MxN The system is used to memorize the origin of the matrix of the area to be tested, and the element mxn is used to memorize the elements of the matrix of the area to be tested; the loop processing module is used to repeatedly execute the expansion matrix module and the temporary storage matrix module. The function of the group until all the elements in the original image matrix are calculated to fill the temporary storage matrix; the mask matrix processing module is used to expand the first mask matrix corresponding to the temporary storage matrix to have [ a second mask matrix of size MXN mxn; and an image processing module for dot-multiplying the temporary storage matrix and the second mask matrix to obtain a result matrix of [MxN mxn] size, and then The result matrix is gradually converted according to a predetermined rule to obtain a new image. Like a matrix.
相較於習知的技術,本發明之影像處理方法及系統透過降低影像處理時矩陣相乘所需迴圈之方式進行矩陣之前處理,配合平行運算之技術,可顯著提升影像處理之效率。Compared with the prior art, the image processing method and system of the present invention performs matrix pre-processing by reducing the loop required for matrix multiplication in image processing, and the parallel computing technique can significantly improve the efficiency of image processing.
以下係藉由特定的具體實施例說明本發明之實施方式,熟悉此技術之人士可由本說明書所揭示之內容輕易地瞭解本發明之其他優點與功效。本發明亦可藉由其他不同的具體實施例加以施行或應用。The embodiments of the present invention are described below by way of specific embodiments, and those skilled in the art can readily appreciate the other advantages and advantages of the present invention. The invention may also be embodied or applied by other different embodiments.
第1圖係本發明之影像前處理方法之之流程圖,如圖所示,其具體流程包括以下的步驟: 於步驟S10中,取得具有[M N]大小之二階原始影像矩陣,可以A ij 表示,其中,i =1…M且j =1…N,M、N為正整數。1 is a flow chart of the image pre-processing method of the present invention. As shown in the figure, the specific process includes the following steps: In step S10, a second-order original image matrix having a size of [MN] is obtained, which can be represented by A ij Where, i =1...M and j =1...N, M, N are positive integers.
於步驟S11中,將預設定之影像處理演算式轉換為具有[m n]大小之二階第一遮罩矩陣,可以G kl 表示,其中,k =1…m且l =1…n,m、n為正整數。In step S11, the pre-set image processing algorithm is converted into a second-order first mask matrix having a size of [mn], which can be represented by G kl , where k =1...m and l =1...n, m, n Is a positive integer.
於一較佳實施例中,該影像處理演算式可為影像濾波演算式、形態學演算式或邊角檢測演算式。In a preferred embodiment, the image processing algorithm can be an image filtering algorithm, a morphological algorithm, or a corner detection algorithm.
於另一實施例中,該影像處理演算式係應用於叢集式電腦之平行運算與顯示晶片之平行運算。In another embodiment, the image processing algorithm is applied to parallel operations of parallel computing and display wafers of a cluster computer.
於步驟S12中,以該原始影像矩陣中任一元素之位置為原點,選定一[m n]大小之待測區域矩陣,可以F ij
表示,再將該原始影像矩陣周圍附加空白陣列以形成mxn個擴張
矩陣。步驟S12之詳細實施流程為:首先,將大小為[M(n-1)]之空白陣列附加於該原始影像矩陣之下方,並將大小為[(m-1)(N+(n-1))]之空白陣列附加於該原始影像矩陣之左方以取得第一擴張矩陣,然後,一次移動一行空白陣列,以將該原始影像矩陣左方之空白陣列依序附加至該原始影像矩陣之右方,以取得第二至第m個擴張矩陣,最後,一次移動一列空白陣列,以將該原始影像矩陣下方之空白陣列依序附加至該原始影像矩陣之上方,且於每次移動一列空白陣列之後,重複執行取得第二至第m個擴張矩陣之步驟,以取得第(m+1)至第(mxn)個擴張矩陣。擴張矩陣可以表示,其與待測區域矩陣之關係如下列方程式(2)所示:
於步驟S13中,依據該第一遮罩矩陣之大小以及該原始影像矩陣之大小,形成具有[MxN mxn]大小之暫存矩陣,其中,元素MxN係用以記憶於該原始影像矩陣所選定之原點的位置,元素mxn係用以記憶該擴張矩陣中之該待測區域矩陣之各元素。In step S13, a temporary storage matrix having a size of [MxN mxn] is formed according to the size of the first mask matrix and the size of the original image matrix, wherein the element MxN is used to store the selected image matrix. The position of the origin, the element mxn is used to memorize the elements of the matrix of the area to be tested in the expansion matrix.
於步驟S14中,重複執行步驟S12及步驟S13直至該原始影像矩陣中所有元素均完成計算以填滿該暫存矩陣,其中,該暫存矩陣以表示,又該暫存矩陣與擴張矩陣之關係如下列方程式(3)所示:
於步驟S15中,將該第一遮罩矩陣對應該暫存矩陣展開為具有[MxN mxn]大小之第二遮罩矩陣,該第二遮罩矩陣以表示。In step S15, the first mask matrix corresponding to the temporary storage matrix is expanded into a second mask matrix having a size of [MxN mxn], and the second mask matrix is Said.
於步驟S16中,將該暫存矩陣與該第二遮罩矩陣進行點乘,如下列方程式(4)所示,以取得[MxN mxn]大小之結果矩陣,該結果矩陣以表示,再將該結果矩陣依預定規則進行階度轉換以得到新影像矩陣。In step S16, the temporary storage matrix is dot-multiplied with the second mask matrix, as shown in the following equation (4), to obtain a result matrix of [MxN mxn] size, and the result matrix is Representing, the result matrix is gradually converted according to a predetermined rule to obtain a new image matrix.
於一較佳實施例中,該步驟S16可使用平行運算技術進行該暫存矩陣與該第二遮罩矩陣之點乘,且該預定規則可為方程式(5)及方程式(6):p =(k -1)n +l (5)In a preferred embodiment, the step S16 can perform point multiplication of the temporary storage matrix and the second mask matrix by using a parallel computing technique, and the predetermined rule can be Equation (5) and Equation (6): p = ( k -1) n + l (5)
q =(i -1)n +j (6) q =( i -1) n + j (6)
於另一實施例中,本發明之影像前處理方法可應用於區域性均值濾波演算法或區域性中值濾波演算法,以將四階之矩陣運算轉換為二階之矩陣運算,分別如下列方程式(7.1)與(7.2)以及方程式(8.1)與(8.2)所示:
H (i ,j )=median {F (i +k ,j +l );(p ,q )} (8.1) H ( i , j )= median { F ( i + k , j + l );( p , q )} (8.1)
第2a至2f圖係應用本發明之影像前處理方法之示意圖,其具體流程包括如下:如第2a圖所示,先取得具有[M N]大小之二階原始影像矩陣20,其中,M=512,N=512,[M N]具有512x512個元素,以下針對矩陣[M N]或[m n]皆為此種定義及表現方式。2a to 2f are schematic diagrams of an image pre-processing method to which the present invention is applied, and the specific flow includes the following: as shown in FIG. 2a, a second-order original image matrix 20 having a size of [MN] is first obtained, where M=512, N=512, [MN] has 512x512 elements, and the following definitions and representations for the matrix [MN] or [mn].
如第2b圖所示,將預設定之影像處理演算式轉換為[3 3]大小(即矩陣[3 3]具有3x3=9個元素)且具有元素G1至G9之二階第一遮罩矩陣21。As shown in FIG. 2b, the pre-set image processing equation is converted into a [3 3] size (ie, the matrix [3 3] has 3x3=9 elements) and has a second-order first mask matrix 21 of elements G1 to G9. .
如第2c圖所示,再以該原始影像矩陣20中i=1,j=1位置之元素為原點,選定一[3 3]大小之待測區域矩陣22,其中具有元素1至9,然後進行下列步驟:As shown in FIG. 2c, an element of the area of i=1, j=1 in the original image matrix 20 is used as an origin, and a matrix 22 of the area to be tested of [3 3] size is selected, wherein elements 1 to 9 are included. Then proceed with the following steps:
(1)先將大小為[512(3-1)]之空白陣列附加於該原始影像矩陣之下方,並將大小為[(3-1)(512+(3-1))]之空白陣列附加於該原始影像矩陣之左方以取得第一擴張矩陣221。(1) First, a blank array of size [512(3-1)] is attached below the original image matrix, and a blank array of size [(3-1)(512+(3-1))]] Attached to the left of the original image matrix to obtain the first expansion matrix 221.
(2)一次移動一行空白陣列,以將該原始影像矩陣左方之空白陣列依序附加至該原始影像矩陣之右方,以取得第二擴張矩陣222至第三擴張矩陣223。(2) Moving a row of blank arrays at a time to sequentially add the blank array to the left of the original image matrix to the right of the original image matrix to obtain the second to third expansion matrices 222 to 223.
(3)一次移動一列空白陣列,以將該原始影像矩陣下方之空白陣列依序附加至該原始影像矩陣之上方,且於每次移動一列空白陣列之後,重複執行步驟(2),以取得 第四至第九擴張矩陣(224-229)。(3) moving a column of blank arrays at a time to sequentially add the blank array below the original image matrix to the top of the original image matrix, and repeating step (2) after each moving of a column of blank arrays to obtain Fourth to ninth expansion matrices (224-229).
如第2d圖所示,依據該第一遮罩矩陣21之大小以及該原始影像矩陣20之大小,形成具有[512x512 3x3]大小之暫存矩陣23,其中,位於p方向上之512x512個元素係用以記憶於該原始影像矩陣20中所選定之原點的位置,位於q方向上之3x3個元素係用以記憶該擴張矩陣221至229中之該待測區域矩陣之各元素1至9。As shown in FIG. 2d, according to the size of the first mask matrix 21 and the size of the original image matrix 20, a temporary storage matrix 23 having a size of [512x512 3x3] is formed, wherein 512x512 elements in the p direction are formed. For storing the position of the origin selected in the original image matrix 20, 3x3 elements located in the q direction are used to memorize the elements 1 to 9 of the matrix of the area to be tested in the expansion matrices 221 to 229.
之後,以該原始影像矩陣20中其他位置之元素為原點,反覆執行上述第2c圖及第2d圖之步驟直至該原始影像矩陣20中所有元素均完成計算以填滿該暫存矩陣23,以使於習知影像處理方法中係為四階陣列形式之原待測區域矩陣可轉換為二階形式之暫存矩陣23。Then, the elements of the other positions in the original image matrix 20 are used as the origin, and the steps of the second and second graphs are repeatedly executed until all the elements in the original image matrix 20 are calculated to fill the temporary memory matrix 23, In order to make the original image region to be tested in the fourth-order array form in the conventional image processing method, the matrix can be converted into the second-order temporary storage matrix 23.
如第2e圖所示,將該第一遮罩矩陣21對應該暫存矩陣23展開為具有[512x512 9x9]大小之第二遮罩矩陣24。As shown in FIG. 2e, the first mask matrix 21 corresponds to the temporary memory matrix 23 and is expanded into a second mask matrix 24 having a size of [512x512 9x9].
如第2f圖所示,將暫存矩陣23與該第二遮罩矩陣24進行點乘,以取得[512x512 9x9]大小之結果矩陣25,再將該結果矩陣依如上述方程式(5)及(6)之預定規則進行階度轉換以得到新影像矩陣26。As shown in FIG. 2f, the temporary storage matrix 23 and the second mask matrix 24 are dot-multiplied to obtain a result matrix 25 of a size of [512×512 9×9], and the result matrix is as in the above equations (5) and ( 6) The predetermined rule is gradually converted to obtain a new image matrix 26.
第3圖係為本發明之影像前處理方法之另一實施例之流程圖,係可應用於數位影像相關法(Digital Image Correlation,DIC)。如圖所示,其具體流程包括以下的步驟:於步驟S30中,取得具有[M N]大小之原始影像矩陣。FIG. 3 is a flow chart of another embodiment of the image pre-processing method of the present invention, which can be applied to Digital Image Correlation (DIC). As shown in the figure, the specific process includes the following steps: In step S30, an original image matrix having a size of [M N] is obtained.
於步驟S31中,以該原始影像矩陣作為初始矩陣,進 一步取得該原始影像矩陣隨時間變化之複數待觀察影像矩陣。In step S31, the original image matrix is used as an initial matrix. The image matrix to be observed of the original image matrix changes over time.
於步驟S32中,於該原始影像矩陣中選定一特徵區域,並將該特徵區域轉換為具有[m n]大小之第一遮罩矩陣。In step S32, a feature region is selected in the original image matrix, and the feature region is converted into a first mask matrix having a size of [m n].
於步驟S33中,以該原始影像矩陣中任一元素之位置為原點,選定一[m n]大小之待測區域矩陣,再將該原始影像矩陣周圍附加空白陣列以形成mxn個擴張矩陣。步驟S33之詳細實施流程為:首先,將大小為[M(n-1)]之空白陣列附加於該原始影像矩陣之下方,並將大小為[(m-1)(N+(n-1))]之空白陣列附加於該原始影像矩陣之左方以取得第一擴張矩陣,然後,一次移動一行空白陣列,以將該原始影像矩陣左方之空白陣列依序附加至該原始影像矩陣之右方,以取得第二至第m個擴張矩陣,最後,一次移動一列空白陣列,以將該原始影像矩陣下方之空白陣列依序附加至該原始影像矩陣之上方,且於每次移動一列空白陣列之後,重複執行取得第二至第m個擴張矩陣之步驟,以取得第(m+1)至第(mxn)個擴張矩陣。In step S33, a matrix of the area to be tested of [m n] size is selected with the position of any element in the original image matrix as an origin, and a blank array is added around the original image matrix to form mxn expansion matrices. The detailed implementation process of step S33 is: first, a blank array of size [M(n-1)] is attached below the original image matrix, and the size is [(m-1)(N+(n-1)). a blank array is attached to the left of the original image matrix to obtain a first expansion matrix, and then a row of blank arrays is moved at a time to sequentially add the blank array to the left of the original image matrix to the right of the original image matrix Square to obtain the second to mth expansion matrix, and finally, move a column of blank arrays at a time to sequentially add the blank array below the original image matrix to the top of the original image matrix, and move a column of blank arrays at a time. Thereafter, the steps of obtaining the second to mth expansion matrices are repeatedly performed to obtain the (m+1)th to (mxn)th expansion matrices.
於步驟S34中,依據該第一遮罩矩陣之大小以及該原始影像矩陣之大小,形成具有[MxN mxn]大小之暫存矩陣,其中,元素MxN係用以記憶於該原始影像矩陣所選定之原點的位置,元素mxn係用以記憶各該待測區域矩陣之元素。In step S34, a temporary storage matrix having a size of [MxN mxn] is formed according to the size of the first mask matrix and the size of the original image matrix, wherein the element MxN is used to store the selected image matrix. The position of the origin, the element mxn is used to memorize the elements of the matrix of the area to be tested.
於步驟S35中,重複執行步驟S33及步驟S34直至該原始影像矩陣中所有元素均完成計算以填滿該暫存矩陣。In step S35, step S33 and step S34 are repeatedly performed until all the elements in the original image matrix are calculated to fill the temporary storage matrix.
於步驟S36中,將該第一遮罩矩陣對應該暫存矩陣展開為具有[MxN mxn]大小之第二遮罩矩陣。In step S36, the first mask matrix corresponding to the temporary storage matrix is expanded into a second mask matrix having a size of [MxN mxn].
於步驟S37中,將該暫存矩陣與該第二遮罩矩陣進行點乘,以取得[MxN mxn]大小之結果矩陣,再將該結果矩陣依預定規則進行階度轉換以得到該特徵區域於該原始影像中之位置。In step S37, the temporary storage matrix is dot-multiplied with the second mask matrix to obtain a result matrix of [MxN mxn] size, and then the result matrix is subjected to gradation conversion according to a predetermined rule to obtain the feature region. The location in the original image.
最後,於步驟S38中,以各該待觀察影像矩陣取代該原始影像矩陣,執行步驟S32至步驟S37,以取得該特徵區域於各該待觀察影像矩陣中之位置,建立該特徵區域隨時間移動之軌跡。Finally, in step S38, the original image matrix is replaced by each of the to-be-observed image matrices, and steps S32 to S37 are performed to obtain the position of the feature region in each of the to-be-observed image matrices, and the feature region is established to move with time. The trajectory.
第4圖係為應用本發明之影像前處理方法與習知影像處理之效率比較圖。如圖所示,橫軸為原始影像矩陣之大小,於第一遮罩矩陣之大小為[7 7]之條件下,分別以CPU及GPU進行影像處理,其結果顯示本發明之影像前處理方法可有效提升影像處理之效率,尤其是配合GPU之平行運算的能力,當原始影像矩陣大小為[1024 1024]時,能達到較習知影像處理方法高出約12倍之效率。Figure 4 is a graph comparing the efficiency of the image pre-processing method and the conventional image processing to which the present invention is applied. As shown in the figure, the horizontal axis is the size of the original image matrix, and the image processing is performed by the CPU and the GPU respectively under the condition that the size of the first mask matrix is [7 7], and the result shows the image pre-processing method of the present invention. It can effectively improve the efficiency of image processing, especially with the GPU's parallel computing ability. When the original image matrix size is [1024 1024], it can achieve about 12 times higher efficiency than the conventional image processing method.
請參閱第5圖,本發明復提供一種影像前處理系統5,包括原始影像模組50、影像處理演算法模組51、擴張矩陣模組52、暫存矩陣模組53、迴圈處理模組54、遮罩矩陣處理模組55以及影像處理模組56。Referring to FIG. 5, the present invention provides an image pre-processing system 5, including an original image module 50, an image processing algorithm module 51, an expansion matrix module 52, a temporary storage matrix module 53, and a loop processing module. 54. The mask matrix processing module 55 and the image processing module 56.
原始影像模組50,係用以取得具有[M N]大小之原始影像矩陣。The original image module 50 is used to obtain an original image matrix having a size of [M N].
影像處理演算法模組51,係用以將預設定之影像處理 演算式轉換為具有[m n]大小之第一遮罩矩陣。Image processing algorithm module 51 for processing pre-set image The calculus is converted to a first mask matrix of size [m n].
於一較佳實施例中,該影像處理演算式可為影像濾波、形態學或其邊角檢測。In a preferred embodiment, the image processing algorithm can be image filtering, morphology, or corner detection.
擴張矩陣模組52,係以該原始影像矩陣中任一元素之位置為原點,選定一[m n]大小之待測區域矩陣,再將該原始影像矩陣周圍附加空白陣列以形成mxn個擴張矩陣。The expansion matrix module 52 selects a matrix of the area to be tested of [mn] size with the position of any element in the original image matrix as an origin, and then adds a blank array around the original image matrix to form mxn expansion matrices. .
暫存矩陣模組53,係依據該第一遮罩矩陣之大小以及該原始影像矩陣之大小,形成具有[MxN mxn]大小之暫存矩陣,其中,元素MxN係用以記憶於該原始矩陣中所選定之原點的位置,元素mxn係用以記憶各該待測區域矩陣之元素。The temporary storage matrix module 53 forms a temporary storage matrix having a size of [MxN mxn] according to the size of the first mask matrix and the size of the original image matrix, wherein the element MxN is used to memorize the original matrix. The position of the selected origin, the element mxn is used to memorize the elements of the matrix of the area to be tested.
迴圈處理模組54,係用以重複執行該擴張矩陣模組及該暫存矩陣模組之功能直至該原始影像矩陣中所有元素均完成計算以填滿該暫存矩陣。The loop processing module 54 is configured to repeatedly execute the functions of the expansion matrix module and the temporary storage matrix module until all elements in the original image matrix are calculated to fill the temporary storage matrix.
遮罩矩陣處理模組55,係用以將該第一遮罩矩陣對應該暫存矩陣展開為具有[MxN mxn]大小之第二遮罩矩陣。The mask matrix processing module 55 is configured to expand the first mask matrix corresponding to the temporary storage matrix into a second mask matrix having a size of [MxN mxn].
影像處理模組56,係用以將該暫存矩陣與該第二遮罩矩陣進行點乘,以取得[MxN mxn]大小之結果矩陣,再將該結果矩陣依預定規則進行階度轉換以得到新影像矩陣。The image processing module 56 is configured to multiply the temporary storage matrix and the second mask matrix to obtain a result matrix of [MxN mxn] size, and then perform the step conversion according to a predetermined rule to obtain the result matrix. New image matrix.
綜上所述,本發明之影像前處理方法及系統係將習知影像處理技術中之四階陣列運算降階為二階陣列運算,可避免習知技術中無法有效利用中央處理器或顯示晶片之大量核心處理器之問題,以顯著提昇影像處理之效率。In summary, the image pre-processing method and system of the present invention reduces the fourth-order array operation in the conventional image processing technology to a second-order array operation, thereby avoiding the inability to effectively utilize the central processing unit or the display chip in the prior art. A large number of core processor issues to significantly improve the efficiency of image processing.
上述實施例僅為例示性說明本發明之原理及其功 效,而非用於限制本發明。任何熟習此項技術之人均可在不違背本發明之精神及範疇下,對上述實施例進行修飾與變化。The above embodiments are merely illustrative of the principles and functions of the present invention. It is not intended to limit the invention. Modifications and variations of the above-described embodiments can be made by those skilled in the art without departing from the spirit and scope of the invention.
20‧‧‧原始影像矩陣20‧‧‧ original image matrix
21‧‧‧第一遮罩矩陣21‧‧‧First mask matrix
221~229‧‧‧第一至第九擴張矩陣221~229‧‧‧First to Ninth Expansion Matrix
23‧‧‧暫存矩陣23‧‧‧Scratch matrix
24‧‧‧第二遮罩矩陣24‧‧‧second mask matrix
25‧‧‧結果矩陣25‧‧‧Result matrix
26‧‧‧新影像矩陣26‧‧‧New Image Matrix
5‧‧‧影像前處理系統5‧‧‧Image pre-processing system
50‧‧‧原始影像模組50‧‧‧ original image module
51‧‧‧影像處理演算法模組51‧‧‧Image Processing Algorithm Module
52‧‧‧擴張矩陣模組52‧‧‧Expansion matrix module
53‧‧‧暫存矩陣模組53‧‧‧Scratch Matrix Module
54‧‧‧迴圈處理模組54‧‧‧Circle processing module
55‧‧‧遮罩矩陣處理模組55‧‧‧Mask matrix processing module
56‧‧‧影像處理模組56‧‧‧Image Processing Module
S10~S16‧‧‧步驟S10~S16‧‧‧Steps
S30~S38‧‧‧步驟S30~S38‧‧‧Steps
第1圖為本發明之影像前處理方法之之流程圖;第2a至2f圖為應用本發明之影像前處理方法之示意圖;第3圖為應用本發明之影像前處理方法之另一實施例之流程圖;第4圖為應用本發明之影像前處理方法與習知影像處理之效率比較圖;以及第5圖為本發明之影像前處理系統之架構圖。1 is a flow chart of a pre-image processing method of the present invention; 2a to 2f are schematic views of an image pre-processing method to which the present invention is applied; and FIG. 3 is another embodiment of an image pre-processing method to which the present invention is applied. FIG. 4 is a comparison diagram of the efficiency of the image pre-processing method and the conventional image processing to which the present invention is applied; and FIG. 5 is an architectural diagram of the image pre-processing system of the present invention.
S10~S16‧‧‧步驟S10~S16‧‧‧Steps
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW101124369A TWI479448B (en) | 2012-07-06 | 2012-07-06 | Image pre-processing system and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW101124369A TWI479448B (en) | 2012-07-06 | 2012-07-06 | Image pre-processing system and method |
Publications (2)
Publication Number | Publication Date |
---|---|
TW201403538A TW201403538A (en) | 2014-01-16 |
TWI479448B true TWI479448B (en) | 2015-04-01 |
Family
ID=50345599
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW101124369A TWI479448B (en) | 2012-07-06 | 2012-07-06 | Image pre-processing system and method |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI479448B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7110596B2 (en) * | 2002-04-25 | 2006-09-19 | Microsoft Corporation | System and method facilitating document image compression utilizing a mask |
TW200638748A (en) * | 2005-04-28 | 2006-11-01 | Asmedia Technology Inc | A method for image enlargement |
US20090263041A1 (en) * | 2008-04-16 | 2009-10-22 | Microsoft Corporation | Block Based Image Processing |
TW201127023A (en) * | 2010-01-26 | 2011-08-01 | Univ Nat Chunghsing | Image processing apparatus, image processing method, and digital camera of using the mask to diminish the noise |
-
2012
- 2012-07-06 TW TW101124369A patent/TWI479448B/en active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7110596B2 (en) * | 2002-04-25 | 2006-09-19 | Microsoft Corporation | System and method facilitating document image compression utilizing a mask |
TW200638748A (en) * | 2005-04-28 | 2006-11-01 | Asmedia Technology Inc | A method for image enlargement |
US20090263041A1 (en) * | 2008-04-16 | 2009-10-22 | Microsoft Corporation | Block Based Image Processing |
TW201127023A (en) * | 2010-01-26 | 2011-08-01 | Univ Nat Chunghsing | Image processing apparatus, image processing method, and digital camera of using the mask to diminish the noise |
Also Published As
Publication number | Publication date |
---|---|
TW201403538A (en) | 2014-01-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109064396B (en) | Single image super-resolution reconstruction method based on deep component learning network | |
CN113034358B (en) | Super-resolution image processing method and related device | |
CN111709980A (en) | Multi-scale image registration method and device based on deep learning | |
CN110992265A (en) | Image processing method and model, model training method and electronic equipment | |
CN107680043B (en) | Single image super-resolution output method based on graph model | |
CN107590791A (en) | Image enchancing method and image processing apparatus | |
WO2023010831A1 (en) | Method, system and apparatus for improving image resolution, and storage medium | |
CN112767252B (en) | Image super-resolution reconstruction method based on convolutional neural network | |
Zhang et al. | Perspective-adaptive convolutions for scene parsing | |
CN110503002B (en) | Face detection method and storage medium | |
CN107945151A (en) | A kind of reorientation image quality evaluating method based on similarity transformation | |
CN111080683A (en) | Image processing method, image processing device, storage medium and electronic equipment | |
CN1317884C (en) | A method for realizing integral multiple amplification of image | |
WO2019136761A1 (en) | Three-dimensional convolution device for recognizing human action | |
TWI479448B (en) | Image pre-processing system and method | |
CN104881877A (en) | Method for detecting image key point based on convolution and time sequence optimization of FPGA | |
CN113807274B (en) | Crowd counting method and system based on image anti-perspective transformation | |
CN108875733A (en) | A kind of infrared small target quick extraction system | |
TWI622020B (en) | Clustering method with a two-stage local binary pattern and an iterative image testing system thereof | |
CN104574320B (en) | A kind of image super-resolution restored method based on sparse coding coefficients match | |
CN103077396B (en) | The vector space Feature Points Extraction of a kind of coloured image and device | |
Takemura | Optimize deep super-resolution and denoising for compressed textures | |
WO2022183325A1 (en) | Video block processing method and apparatus, neural network training method, and storage medium | |
CN115511968B (en) | Two-dimensional hand posture estimation method, device, equipment and storage medium | |
CN104394300B (en) | A kind of video scaling method and its system |