TWI579637B - Image enhancement method for lens stain detection - Google Patents

Image enhancement method for lens stain detection Download PDF

Info

Publication number
TWI579637B
TWI579637B TW104118644A TW104118644A TWI579637B TW I579637 B TWI579637 B TW I579637B TW 104118644 A TW104118644 A TW 104118644A TW 104118644 A TW104118644 A TW 104118644A TW I579637 B TWI579637 B TW I579637B
Authority
TW
Taiwan
Prior art keywords
image
grayscale
superimposed
enhancement method
algorithm
Prior art date
Application number
TW104118644A
Other languages
Chinese (zh)
Other versions
TW201643536A (en
Inventor
Chien Sheng Huang
Original Assignee
Calin Technology Co Ltd
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 Calin Technology Co Ltd filed Critical Calin Technology Co Ltd
Priority to TW104118644A priority Critical patent/TWI579637B/en
Publication of TW201643536A publication Critical patent/TW201643536A/en
Application granted granted Critical
Publication of TWI579637B publication Critical patent/TWI579637B/en

Links

Landscapes

  • Studio Devices (AREA)

Description

鏡頭髒污檢測之影像強化方法 Image enhancement method for lens dirty detection

本發明係與影像強化方法有關;特別是指一種用於鏡頭髒污檢測之影像強化方法。 The invention relates to an image enhancement method; in particular, to an image enhancement method for lens contamination detection.

鏡頭模組在組裝的過程中,由於人為因素組裝環影響,空氣中的微粒及灰塵很有可能會隨著組裝動作附於光學元件上,而些微粒將隨著光學元件的組裝而進到鏡頭模組內,而阻擋鏡頭模組中光之行進,從而導致鏡頭模組成像後之影像出現黑點等髒污。 During the assembly process of the lens module, due to the influence of the human component assembly ring, particles and dust in the air are likely to be attached to the optical component with the assembly action, and the particles will enter the lens as the optical component is assembled. Inside the module, the light in the lens module is blocked, which causes black spots and the like to appear in the image after the lens module is imaged.

目前,偵測鏡頭模組內是否有微粒的方式為,在鏡頭模組的成像處,設置一影像感測器(例如CCD),以接收該鏡頭模組的成像圖案,然後,操作員在藉由觀測成像圖案是有微粒影像時,以確定該鏡頭模組中的光學元件以被微粒污染。 At present, the method for detecting whether there is a particle in the lens module is that an image sensor (for example, CCD) is disposed at the imaging portion of the lens module to receive the imaging pattern of the lens module, and then the operator is borrowing When the image pattern is observed to have a particle image, the optical element in the lens module is determined to be contaminated by the particles.

但是,若直接觀測成像圖案,會因為微粒的過小或微粒影像與其他的影像的顏色過於相近,使操作員容易忽略成像圖案內的髒污影像,而無法找出有瑕疵的鏡頭模組。 However, if the imaging pattern is directly observed, the particle size is too small or the particle image is too close to the color of other images, so that the operator can easily ignore the dirty image in the imaging pattern, and cannot find the defective lens module.

有鑑於此,本發明之目的在於提供一種用於鏡頭髒污檢測之影像強化方法。 In view of the above, it is an object of the present invention to provide an image enhancement method for lens contamination detection.

緣以達成上述目的,本發明所提供的鏡頭髒污 檢測之影像強化方法,其中該影像係取自於該鏡頭在髒污檢測過程中所成像之一彩色影像,且該彩色影像呈現該鏡頭內之一光學鏡片及位於該光學鏡片上的一髒污,該影像強化方法包括下列步驟:A.提取該彩色影像中的一紅色圖層及一綠色圖層,且將該紅色圖層及該綠色圖層分別轉換為一第一灰階影像及一第二灰階影像。B.對該第一灰階影像及該第二灰階影像中的每一畫素的灰階值各乘上預設的權值至少一次,以提高該第一灰階影像及該第二灰階影像的灰階對比。C.將提高灰階對比後的該第一灰階影像以及提高灰階對比後的該第二灰階影像疊合,而得到一疊合影像。D.提高該疊合影像中的灰階對比。E.對提高灰階對比後的該疊合影像進行二值化,而得到一黑白影像,且該黑白影像中所呈現的該光學鏡片以及該髒污呈現相反的顏色。 In order to achieve the above object, the lens provided by the present invention is dirty. The image enhancement method for detecting, wherein the image is taken from a color image imaged by the lens during the stain detection process, and the color image presents an optical lens in the lens and a dirty surface on the optical lens The image enhancement method includes the following steps: A. extracting a red layer and a green layer in the color image, and converting the red layer and the green layer into a first grayscale image and a second grayscale image, respectively. . B. multiplying the grayscale values of each pixel in the first grayscale image and the second grayscale image by a preset weight at least once to improve the first grayscale image and the second grayscale Grayscale contrast of the order image. C. The first gray scale image after the gray scale contrast is improved, and the second gray scale image after the gray scale contrast is superimposed to obtain a superimposed image. D. Improve the grayscale contrast in the superimposed image. E. Binding the superimposed grayscale image to obtain a black and white image, and the optical lens and the stain present in the black and white image exhibit opposite colors.

本發明之效果在於可以很快的判斷出彩色影像中是否有髒污存在。此外,若需要操作員對黑白影像進行是否為髒污的判斷,也能因待測影像的高對比,而能快速即準確的分辯出髒污。 The effect of the present invention is that it is possible to quickly determine whether or not there is any stain in the color image. In addition, if the operator is required to judge whether the black and white image is dirty, it can also quickly and accurately distinguish the dirt due to the high contrast of the image to be tested.

12‧‧‧髒污 12‧‧‧Dirty

14‧‧‧光學鏡片 14‧‧‧Optical lenses

16‧‧‧光學鏡片之周圍 16‧‧‧ Around the optical lens

S100、S200、S300‧‧‧步驟 S100, S200, S300‧‧‧ steps

S202~S220‧‧‧步驟 S202~S220‧‧‧Steps

S400、S402‧‧‧步驟 S400, S402‧‧‧ steps

圖1為本發明一較佳實施例之鏡頭髒污檢測之影像強化方法流程圖。 1 is a flow chart of an image enhancement method for lens contamination detection according to a preferred embodiment of the present invention.

圖2為彩色照片。 Figure 2 is a color photograph.

圖3為待測影像。 Figure 3 shows the image to be tested.

圖4為上述圖1中步驟S200的第一種、第三種、第五種以及第七種演算法之流程圖。 4 is a flow chart of the first, third, fifth, and seventh algorithms of step S200 of FIG. 1 described above.

圖5為疊合影像。 Figure 5 is a superimposed image.

圖6為執行完尋邊演算法之影像。 Figure 6 shows the image of the edge-finding algorithm.

圖7為執行完步驟S210後之影像。 FIG. 7 is an image after the step S210 is performed.

圖8為執行完步驟S214後之影像。 FIG. 8 is an image after the step S214 is performed.

圖9為邊緣暗角影像的製作方法流程圖。 FIG. 9 is a flow chart of a method for manufacturing an edge vignetting image.

圖10為邊緣暗角影像。 Figure 10 is an image of the edge vignetting.

圖11為上述圖1中步驟S200的第二種演算法之流程圖。 FIG. 11 is a flow chart of the second algorithm of step S200 in FIG. 1 described above.

圖12為上述圖1中步驟S200的第四種演算法之流程圖。 FIG. 12 is a flow chart of the fourth algorithm of step S200 in FIG. 1 described above.

圖13為上述圖1中步驟S200的第六種演算法之流程圖。 FIG. 13 is a flow chart of the sixth algorithm of step S200 in FIG. 1 described above.

圖14為上述圖1中步驟S200的第八種演算法之流程圖。 FIG. 14 is a flow chart of the eighth algorithm of step S200 in FIG. 1 described above.

為能更清楚地說明本發明,茲舉較佳實施例並配合圖示詳細說明如後,請參圖1,為本發明一較佳實施例之鏡頭髒污檢測之影像強化方法流程圖。 In order to explain the present invention more clearly, the preferred embodiment is described in detail with reference to the accompanying drawings. FIG. 1 is a flow chart of an image enhancement method for lens contamination detection according to a preferred embodiment of the present invention.

步驟S100:將一影像感測器放置在一鏡頭模組的一側,以拍攝該鏡頭內之光學鏡片,並使該影像感測器依據該光學鏡片的影像而得到一彩色影像(如圖2所示),之後再利用一般電腦就可對該彩色影像進行影像處理。該彩色影像除了呈現該鏡頭內之該光學鏡片14外還有位於該光學鏡片上的一髒污12。該影像感測器為CCD,在其他實施例中,也可為由CMOS製造技術所製成的影像感測器,在此而不以為限。 Step S100: placing an image sensor on one side of the lens module to capture the optical lens in the lens, and causing the image sensor to obtain a color image according to the image of the optical lens (see FIG. 2). As shown in the figure), the color image can be image processed later using a general computer. In addition to presenting the optical lens 14 within the lens, the color image also has a stain 12 on the optical lens. The image sensor is a CCD. In other embodiments, it may also be an image sensor made by CMOS manufacturing technology, which is not limited thereto.

步驟S200:對該彩色影像進行影像處理,而得到一待測影像(如圖3所示),且該待測影像的一部份為呈現黑色的圖塊,另一部份則為呈現白色的圖塊,且白色圖塊為多個,並分散於該待測影像中。 Step S200: Perform image processing on the color image to obtain a to-be-tested image (as shown in FIG. 3), and a part of the image to be tested is a black-colored tile, and the other part is white. The tile has a plurality of white tiles and is dispersed in the image to be tested.

步驟S300:分析在該待測影像中每一個白色圖塊的尺寸,若一白色圖塊的尺寸在所設定的區間內,則判斷該白色圖塊為髒污。 Step S300: analyzing the size of each white tile in the image to be tested. If the size of a white tile is within the set interval, it is determined that the white tile is dirty.

上述中所述的分析白色圖塊的尺寸,在本發明實施例中,是指分析該白色圖塊的畫素(pixel)面積、長度以及寬度是否在一區間內,以判斷該白色圖塊是否為髒污,例如,將面積的區間設定在30~1100之間、長度區間設定在5~635之間以及寬度區間設定在5~475之間。在其他實施中,可再針對該白色圖塊的形狀或位置等參數的設定以判斷該白色圖塊是否為髒污。 In the embodiment of the present invention, the size, the length, and the width of the pixel (pixel) of the white tile are analyzed in an interval to determine whether the white tile is For dirty, for example, set the area between 30 and 1100, the length to 5 to 635, and the width to 5 to 475. In other implementations, the setting of parameters such as the shape or position of the white tile may be further determined to determine whether the white tile is dirty.

以上為本發明的影像檢測方法,其中於步驟200中可針對不同位置的髒污及髒污與光學鏡片所呈現對比度的不同,而使用不同的演算法,以下將說明八種不同的演算法:如圖4所示,為步驟200中第一種演算法之流程圖。 The above is the image detecting method of the present invention, wherein in step 200, different algorithms can be used for different positions of dirt and dirt and contrast exhibited by the optical lens, and eight different algorithms will be described below: As shown in FIG. 4, it is a flowchart of the first algorithm in step 200.

步驟S202:提取該彩色影像中的一紅色圖層及一綠色圖層,且該紅色圖層及綠色圖層分別轉換為一第一灰階影像及一第二灰階影像。之所以提取紅色圖層及綠色圖層是因為紅色及綠色的顏色差異度較大,因此鏡頭模組內若有髒污存在,則容易在紅色圖層或綠色圖層中被呈現出來。 Step S202: Extract a red layer and a green layer in the color image, and convert the red layer and the green layer into a first grayscale image and a second grayscale image. The reason why the red layer and the green layer are extracted is because the color difference between red and green is large, so if there is dirt in the lens module, it is easy to be presented in the red layer or the green layer.

步驟S204:對該第一灰階影像及綠色圖層第二灰階影像中的每一畫素的灰階值各乘上預設的權值至少一次,以提高該第一灰階影像及第二灰階影像的灰階對比。在本實施例中,該紅色圖層及綠色圖層中的每一畫素的灰階值乘上相對應的權值三次,且該權值為一種3×3的數位濾波器,如下所示: Step S204: Multiply the grayscale value of each pixel in the first grayscale image and the second grayscale image of the green layer by a preset weight at least once to improve the first grayscale image and the second Grayscale contrast of grayscale images. In this embodiment, the grayscale value of each pixel in the red layer and the green layer is multiplied by the corresponding weight three times, and the weight is a 3×3 digital filter, as follows:

步驟S206:將提高灰階對比後的該第一灰階影像以及提高灰階對比後的該第二灰階影像疊合,而得到一疊合影像(如圖5所示),且該疊合影像中所呈現光學鏡片以及髒污之影像的灰階對比高於彩色影像中所呈現光學鏡片以及髒污之影像的灰階對比。此外,該疊合影像中所呈現光學鏡片以及該光學鏡片周圍的影像也有較高的對比。 Step S206: superimposing the first grayscale image after the grayscale contrast and the second grayscale image of the grayscale contrast to obtain a superimposed image (as shown in FIG. 5), and the superimposing The grayscale contrast of the optical lens and the dirty image presented in the image is higher than that of the optical lens and the dirty image presented in the color image. In addition, the optical lens presented in the superimposed image and the image around the optical lens are also highly contrasted.

步驟S208:對該疊合影像執行尋邊演算法(Sobel operator),以找出該疊合影像中所呈現的該光學鏡片以及該髒污的邊緣,且以白色呈現(如圖6所示)。 Step S208: Perform a Sobel operator on the superimposed image to find the optical lens and the dirty edge presented in the superimposed image, and present in white (as shown in FIG. 6). .

步驟S210:對執行尋邊演算法後的該疊合影像中的每一畫素的灰階值各乘上預設的權值10次,而提高灰階對比(如圖7所示)。此外,在本步驟中所述的權值與步驟S204的權值相同,而不再贅述。 Step S210: Multiply the grayscale value of each pixel in the superimposed image after performing the edge-finding algorithm by a preset weight of 10 times, and improve the grayscale contrast (as shown in FIG. 7). In addition, the weights described in this step are the same as the weights of step S204, and are not described again.

步驟S212:對經由步驟210後而提高灰階對比後的疊合影像進行二值化,而得到一黑白影像,且該黑白影像中所呈現的該光學鏡片以及該髒污呈現相反的顏色。在本實施例中,該黑白影像中所呈現的該髒污之顏色大部份為白色,且該該黑白影像中所呈現的該光學鏡片之顏色大部份為黑色。該二值化的灰階值的閥值在本實施例中設為134,但在其他實施例可依疊合影像的平均灰階值進行調整,而不以此為限。 Step S212: Binarize the superimposed grayscale image after step 210 to obtain a black and white image, and the optical lens and the dirtyness presented in the black and white image exhibit opposite colors. In this embodiment, the color of the stain presented in the black and white image is mostly white, and the color of the optical lens presented in the black and white image is mostly black. The threshold value of the binarized grayscale value is set to 134 in this embodiment, but other embodiments may be adjusted according to the average grayscale value of the superimposed image, and not limited thereto.

步驟S214:對該黑白影像進行閉合演算法(close operation),用以濾除該黑白影像中所呈現的該髒污影像內之雜訊及填補空洞,使髒污影像內的所有畫素為白色(如圖8所示)。在本實施例中,進行閉合演算法15次。 Step S214: Perform a close operation on the black and white image to filter out noise and fill holes in the dirty image presented in the black and white image, so that all pixels in the dirty image are white. (As shown in Figure 8). In the present embodiment, the closing algorithm is performed 15 times.

步驟216:將該黑白影像與一邊緣暗角影像進行疊合,並對疊合後之影像進行閉合演算法5次,而得到待測影像(如圖3所示)。上述中的邊緣暗角影像是指一種將光 學鏡片及圍繞該光學鏡片之周圍16(如圖2所示)的影像作明顯區分的影像。在本步驟中,將黑白影像與一邊緣暗角影像進行疊合,是為了確保該待測影像中所呈現的髒污以及圍繞該光學鏡片之周圍的顏色為白色,而光學鏡片的顏色為黑色,以利步驟300中,以分析出髒污。 Step 216: The black and white image is superimposed with an edge vignetting image, and the superimposed image is closed for 5 times to obtain an image to be tested (as shown in FIG. 3). The edge vignetting image in the above refers to a kind of light The lens and the image surrounding the periphery of the optical lens 16 (shown in Figure 2) are clearly distinguishable images. In this step, the black and white image is superimposed with an edge vignetting image to ensure that the image present in the image to be tested is dirty and the color around the optical lens is white, and the color of the optical lens is black. In order to facilitate the analysis of the dirty.

如圖9所示,為邊緣暗角影像的製作方法流程圖,包括下列步驟: As shown in FIG. 9 , a flow chart of a method for manufacturing an edge vignetting image includes the following steps:

步驟400:提取該彩色影像中的該紅色圖層,且將該紅色圖層轉換為該第一灰階影像。 Step 400: Extract the red layer in the color image, and convert the red layer into the first grayscale image.

步驟402:對該第一灰階影像進行二值化,之後進行反向處理,使光學鏡片呈現黑色,而光學鏡片的周圍呈現白色,以得到該邊緣暗角影像(如圖10所示)。 Step 402: Binarize the first grayscale image, and then perform reverse processing to make the optical lens appear black, and the periphery of the optical lens is white to obtain the edge vignetting image (as shown in FIG. 10).

如圖11所示,為步驟200中第二種演算法之流程圖。 As shown in FIG. 11, it is a flowchart of the second algorithm in step 200.

第一種演算法與第二種演算法的差異在於在步驟S210中是乘上預設的權值15次、在步驟S212中,二值化的灰階值的閥值設為223,以及在步驟S214中進行閉合演算法17次。此外,在步驟S210與步驟S212之間更增加了步驟S218。 The difference between the first algorithm and the second algorithm is that in step S210, the preset weight is multiplied by 15 times, and in step S212, the threshold value of the binarized gray level value is set to 223, and The closing algorithm is performed 17 times in step S214. Further, step S218 is further added between step S210 and step S212.

步驟S218:對該疊合影像進行膨脹演算法(Dilate)30次,之後進行侵蝕演算法(Erode)30次,以提高灰階對比。 Step S218: performing a dilation algorithm (Dilate) 30 times on the superimposed image, and then performing an erosion algorithm (Erode) 30 times to improve the gray scale contrast.

如圖4所示,以說明第三種演算法。 As shown in Figure 4, the third algorithm is explained.

第三種演算法與第一種演算法相似,其差異在於,在步驟S210中是乘上相對應的權值15次、在步驟S212中的二值化的灰階值閥值設為255以及在步驟S214中進行閉合演算法17次。 The third algorithm is similar to the first algorithm in that it is multiplied by the corresponding weight 15 times in step S210, and the binarized gray level value threshold in step S212 is set to 255 and The closing algorithm is performed 17 times in step S214.

如圖12所示,為步驟200中第四種演算法之 流程圖。 As shown in FIG. 12, it is the fourth algorithm in step 200. flow chart.

第四種演算法與第一種演算法相似,其差異在於,未執行步驟S210、在步驟S210中是各乘上預設的權值15次、在步驟S212中二值化的灰階值閥值設為255以及在步驟S214中進行閉合演算法5次。此外,在步驟S206以及步驟S210之間更加入了步驟S220。 The fourth algorithm is similar to the first algorithm, and the difference is that step S210 is not performed, and in step S210, each step is multiplied by a preset weight of 15 times, and the gray scale value valve is binarized in step S212. The value is set to 255 and the closing algorithm is performed 5 times in step S214. Further, step S220 is further added between step S206 and step S210.

步驟S220:對該疊合影像中的每一畫素的灰階值各乘上預設的權值1次。在本步驟中的權值為一種3×3的數位濾波器: Step S220: Multiply the grayscale value of each pixel in the superimposed image by a preset weight once. The weight in this step is a 3 × 3 digital filter:

如圖4所示,以說明第五種演算法。 As shown in Figure 4, the fifth algorithm is explained.

第五種演算法與第一種演算法相似,其差異在於,在步驟S204中是各乘上預設的權值2次以及在步驟S214中進行閉合演算法10次。 The fifth algorithm is similar to the first algorithm in that, in step S204, each of the preset weights is multiplied twice and the closing algorithm is performed 10 times in step S214.

如圖13所示,為步驟200中第六種演算法之流程圖。 As shown in FIG. 13, it is a flowchart of the sixth algorithm in step 200.

第六種演算法與第二種演算法相似,其差異在於,並未執行步驟S208,且在完成步驟S206之後,直接進行步驟S210,其中,在步驟S210中是各乘上預設的權值10次。此外,也未進行步驟S214,而在完成步驟S212之後,直接進行步驟S216,其中,在步驟S212二值化的灰階值的閥值設為223。 The sixth algorithm is similar to the second algorithm, the difference is that step S208 is not performed, and after step S206 is completed, step S210 is directly performed, wherein in step S210, each of the preset weights is multiplied. 10 times. Further, step S214 is not performed, and after step S212 is completed, step S216 is directly performed, in which the threshold value of the grayscale value binarized in step S212 is set to 223.

如圖4所示,以說明第七種演算法。 As shown in Figure 4, the seventh algorithm is illustrated.

第七種演算法與第一種演算法相似,其差異在於,在步驟S210中是各乘上預設的權值5次、在步驟S212二值化的灰階值的閥值設為88以及在步驟S214中進行閉合演算法5次。 The seventh algorithm is similar to the first algorithm, and the difference is that in step S210, each of the preset weights is multiplied five times, and the threshold value of the grayscale value binarized in step S212 is set to 88 and The closing algorithm is performed 5 times in step S214.

如圖14所示,為步驟200中第八種演算法之流程圖。 As shown in FIG. 14, it is a flowchart of the eighth algorithm in step 200.

第八種演算法與第一種演算法相似,其差異在於,在步驟S204中所乘上的權值為: The eighth algorithm is similar to the first algorithm, with the difference that the weights multiplied in step S204 are:

且紅色圖層及綠色圖層中的每一畫素的灰階值乘上預設的權值一次。 And the grayscale value of each pixel in the red layer and the green layer is multiplied by the preset weight once.

此外,第八種演算法不執行第一種演算法中的步驟S206以及步驟S214,且於步驟S212中二值化的灰階值閥值設為255。 Further, the eighth algorithm does not perform step S206 and step S214 in the first algorithm, and the binarized grayscale value threshold is set to 255 in step S212.

上述中的第一種至第四種演算法主要檢測具有呈現有較高對比的髒污與光學鏡片之影像的彩色影像,但因對比的程度不同,而細分為四種不同的演算法,依序為第一種至第四種演算法。第五種及第六種演算法主要檢測具有呈現對比相對較低的髒污與光學鏡片影像的彩色影像,但因程度不同,而再細分兩種不同的演算法。第七種及第八種演算法主要檢測髒污位在光學鏡片邊緣的彩色影像,並依據髒污與光學鏡片邊緣之間的距離,而細分為兩種不同的演算法。 The first to fourth algorithms described above mainly detect color images having images with high contrast and dirty lenses, but are subdivided into four different algorithms depending on the degree of contrast. The order is the first to fourth algorithms. The fifth and sixth algorithms mainly detect color images with relatively low contrast and optical lens images, but subdivide two different algorithms depending on the degree. The seventh and eighth algorithms mainly detect the color image of the dirty spot on the edge of the optical lens, and subdivide into two different algorithms according to the distance between the dirty and the edge of the optical lens.

此外,本發明鏡頭髒污檢測之影像強化方法除了上述的步驟,還可先判斷該紅色圖層的平均灰階值是否小於128,以確保後續的步驟能判斷出是否有髒污的存在。 In addition, in addition to the above steps, the image enhancement method for the lens contamination detection of the present invention may first determine whether the average grayscale value of the red layer is less than 128 to ensure that the subsequent steps can determine whether there is any contamination.

綜上所述,本發明影像檢測方法可以很快的判斷出彩色影像中是否有髒污存在,以找出有瑕疵的鏡頭模組。此外,若需要操作員對待測影像中的白色區塊進行是否為髒污的判斷,也能因待測影像的高對比(即黑色區塊及白色區塊的顏色差別),而能快速即準確的分辯出髒污所在的 位置。 In summary, the image detecting method of the present invention can quickly determine whether there is any stain in the color image to find a defective lens module. In addition, if the operator needs to judge whether the white block in the image is dirty, it can also be fast and accurate due to the high contrast of the image to be tested (ie, the color difference between the black block and the white block). Distinguish the dirty position.

以上所述僅為本發明較佳可行實施例而已,舉凡應用本發明說明書及申請專利範圍所為之等效變化,理應包含在本發明之專利範圍內。 The above is only a preferred embodiment of the present invention, and equivalent changes to the scope of the present invention and the scope of the patent application are intended to be included in the scope of the present invention.

S202~S216‧‧‧步驟 S202~S216‧‧‧Steps

Claims (7)

一種鏡頭髒污檢測之影像強化方法,其中該影像係取自於該鏡頭在髒污檢測過程中所成像之一彩色影像,且該彩色影像呈現該鏡頭內之一光學鏡片及位於該光學鏡片上的一髒污,該影像強化方法包括下列步驟:A.提取該彩色影像中的一紅色圖層及一綠色圖層,且將該紅色圖層及該綠色圖層分別轉換為一第一灰階影像及一第二灰階影像;B.對該第一灰階影像及該第二灰階影像中的每一畫素的灰階值各乘上預設的權值至少一次,以提高該第一灰階影像及該第二灰階影像的灰階對比;C.將提高灰階對比後的該第一灰階影像以及提高灰階對比後的該第二灰階影像疊合,而得到一疊合影像;D.提高該疊合影像中的灰階對比;以及E.對提高灰階對比後的該疊合影像進行二值化,而得到一黑白影像,且該黑白影像中所呈現的該光學鏡片以及該髒污呈現相反的顏色。 An image enhancement method for lens contamination detection, wherein the image is taken from a color image imaged by the lens during the stain detection process, and the color image presents an optical lens in the lens and is located on the optical lens The image enhancement method comprises the following steps: A. extracting a red layer and a green layer in the color image, and converting the red layer and the green layer into a first grayscale image and a first a gray scale image; B. multiplying the gray scale values of each pixel in the first gray scale image and the second gray scale image by a preset weight at least once to improve the first gray scale image Corresponding to the gray scale of the second grayscale image; C. superimposing the grayscale contrasted first grayscale image and increasing the grayscale contrasted second grayscale image overlay to obtain a superimposed image; D. improving the grayscale contrast in the superimposed image; and E. binarizing the superimposed grayscale contrast image to obtain a black and white image, and the optical lens presented in the black and white image and This stain shows the opposite color. 如請求項1所述之影像強化方法,其中該黑白影像更包括一邊緣圖塊區域,該影像檢測方法更包括下列步驟:將該第一灰階影像進行二值化並進行影像反轉,而得到一邊緣暗角影像;以及疊合該黑白影像以及該邊緣暗角影像,並進行閉合演算法,而得到一待測影像,且該待測影像中之該光學鏡片以及圍繞該光學鏡片之周圍的影像呈現相反的顏色。 The image enhancement method of claim 1, wherein the black and white image further comprises an edge tile region, the image detection method further comprising the steps of: binarizing the first grayscale image and performing image inversion, and Obtaining an edge vignetting image; and superimposing the black and white image and the edge vignetting image, and performing a closing algorithm to obtain a to-be-tested image, and the optical lens in the image to be tested and surrounding the optical lens The image shows the opposite color. 如請求項2所述之影像強化方法,更包括下列步驟:分析該待測影像中之髒污所呈現的影像的尺寸,以判斷為髒污。 The image enhancement method according to claim 2, further comprising the step of: analyzing the size of the image presented by the dirt in the image to be tested to determine that the image is dirty. 如請求項1所述之影像強化方法,其中步驟D中更包括對該疊合影像執行尋邊演算法,以找出該疊合影像中所呈現的該光學鏡片的邊緣以及該髒污的邊緣,之後,對執行尋邊演算法後的該疊合影像中的每一畫素的灰階值各乘上預設的權值,以提高灰階對比。 The image enhancement method of claim 1, wherein the step D further comprises performing a edge finding algorithm on the superimposed image to find an edge of the optical lens and the dirty edge presented in the superimposed image. Then, the grayscale value of each pixel in the superimposed image after performing the edge-finding algorithm is multiplied by a preset weight to improve the grayscale contrast. 如請求項1所述之影像強化方法,其中在步驟D之後更包括對該疊合影像依序進行膨脹演算法及侵蝕演算法,以提高該疊合影像的對比。 The image enhancement method of claim 1, wherein after the step D, the superimposed algorithm and the erosion algorithm are sequentially performed on the superimposed image to improve the contrast of the superimposed image. 如請求項1所述之影像強化方法,其中步驟D中更包括對該疊合影像中的每一畫素的灰階值各乘上預設的權值,以提高該疊合影像的對比。 The image enhancement method of claim 1, wherein the step D further comprises multiplying the grayscale values of each pixel in the superimposed image by a preset weight to improve the contrast of the superimposed image. 如請求項1所述之影像強化方法,其中在步驟E之後對該黑白影像進行閉合演算法,用以濾除呈現該髒污之影像內的雜訊。 The image enhancement method of claim 1, wherein the black and white image is closed after the step E to filter out the noise in the image that is dirty.
TW104118644A 2015-06-09 2015-06-09 Image enhancement method for lens stain detection TWI579637B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW104118644A TWI579637B (en) 2015-06-09 2015-06-09 Image enhancement method for lens stain detection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW104118644A TWI579637B (en) 2015-06-09 2015-06-09 Image enhancement method for lens stain detection

Publications (2)

Publication Number Publication Date
TW201643536A TW201643536A (en) 2016-12-16
TWI579637B true TWI579637B (en) 2017-04-21

Family

ID=58055911

Family Applications (1)

Application Number Title Priority Date Filing Date
TW104118644A TWI579637B (en) 2015-06-09 2015-06-09 Image enhancement method for lens stain detection

Country Status (1)

Country Link
TW (1) TWI579637B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102413354A (en) * 2011-10-05 2012-04-11 深圳市联德合微电子有限公司 Automatic optical detection method, device and system of mobile phone camera module
TW201432250A (en) * 2013-02-08 2014-08-16 Benq Materials Corp A method of detecting stain on the optical lens
US20140354800A1 (en) * 2013-06-04 2014-12-04 Hon Hai Precision Industry Co., Ltd. Detection system and detection method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102413354A (en) * 2011-10-05 2012-04-11 深圳市联德合微电子有限公司 Automatic optical detection method, device and system of mobile phone camera module
TW201432250A (en) * 2013-02-08 2014-08-16 Benq Materials Corp A method of detecting stain on the optical lens
US20140354800A1 (en) * 2013-06-04 2014-12-04 Hon Hai Precision Industry Co., Ltd. Detection system and detection method

Also Published As

Publication number Publication date
TW201643536A (en) 2016-12-16

Similar Documents

Publication Publication Date Title
JP7262021B2 (en) Depth Acquisition Device, Depth Acquisition Method and Program
JP2014517265A (en) Analysis of digital images of the outer surface of tires and processing of false measurement points
JP5705711B2 (en) Crack detection method
TWI512284B (en) Bubble inspection system for glass
KR20190023374A (en) Method for testing display pannel
US8237848B2 (en) Image sensing apparatus and method for sensing target that has a defective portion region
JPH03160349A (en) Device for detecting crack
KR101677070B1 (en) System and Method for Automatically Detecting a Mura Defect using Morphological Image Processing and Labeling
JP4244046B2 (en) Image processing method and image processing apparatus
JP2009139133A (en) Flaw detection method and flaw detector
JP2007155405A (en) Visual inspection method and visual inspection device
KR102241989B1 (en) Semiconductor inspecting method, semiconductor inspecting apparatus and semiconductor manufacturing method
JP2010008159A (en) Visual inspection processing method
JP2005069887A (en) Defect inspection method and apparatus
TWI579637B (en) Image enhancement method for lens stain detection
JP2007208050A (en) External-appearance inspecting method
JP2005326323A (en) Image quality inspection device
JP4978215B2 (en) Machining surface defect judgment method
JP5452035B2 (en) Defect inspection method and defect inspection apparatus
TWI510776B (en) Bubble inspection processing method for glass
US11080860B2 (en) Image inspection method
JP2005140655A (en) Method of detecting stain flaw, and stain flaw detector
JP4863050B2 (en) Color unevenness defect inspection method and apparatus
JP4998722B2 (en) Work defect inspection method by image processing
TWI493177B (en) Method of detecting defect on optical film with periodic structure and device thereof