TWI843045B - Image processing and detection method, computer device, and storage medium - Google Patents

Image processing and detection method, computer device, and storage medium Download PDF

Info

Publication number
TWI843045B
TWI843045B TW111102258A TW111102258A TWI843045B TW I843045 B TWI843045 B TW I843045B TW 111102258 A TW111102258 A TW 111102258A TW 111102258 A TW111102258 A TW 111102258A TW I843045 B TWI843045 B TW I843045B
Authority
TW
Taiwan
Prior art keywords
image
detected
processing
defect
bar graph
Prior art date
Application number
TW111102258A
Other languages
Chinese (zh)
Other versions
TW202331643A (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 TW111102258A priority Critical patent/TWI843045B/en
Publication of TW202331643A publication Critical patent/TW202331643A/en
Application granted granted Critical
Publication of TWI843045B publication Critical patent/TWI843045B/en

Links

Images

Landscapes

  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

The present application provides an image processing and detection method, a computer device, and a storage medium. The image processing and detection method includes: acquiring an image to be detected, and correcting the image to be detected; performing a flaw enhancement processing on the corrected image, including: performing a median filtering processing on the corrected image; performing a contrast adjustment on the corrected image after the median filtering processing; performing a bilateral filtering processing on the corrected image after the contrast adjustment; performing a flaw detection on the corrected image after the flaw enhancement processing and obtaining a detection result. This application can assist in detecting whether there is any abnormality in the image, and improving the accuracy of image processing and detection.

Description

影像處理與檢測方法、電腦裝置及儲存介質 Image processing and detection method, computer device and storage medium

本發明涉及產品檢測領域,特別是指一種影像處理與檢測方法、電腦裝置及儲存介質。 The present invention relates to the field of product testing, and in particular to an image processing and testing method, a computer device, and a storage medium.

在實際工業生產過程中,部分產品的表面存在難以避免的擦傷或是沾染灰塵導致的缺陷。即使用高解析度的相機對產品進行拍攝,不同光源拍攝環境下仍會出現某些瑕疵拍攝出來的效果不明顯的狀況,導致產品瑕疵檢測時的檢測準確度降低。 In the actual industrial production process, some products have inevitable scratches or dust defects on their surfaces. Even if a high-resolution camera is used to shoot the product, some defects may not be obvious in different light sources, resulting in reduced accuracy in product defect detection.

鑒於以上內容,有必要提供一種影像處理與檢測方法、電腦裝置及儲存介質,可以輔助檢測產品異常,以解決上述問題。 In view of the above, it is necessary to provide an image processing and detection method, a computer device and a storage medium that can assist in detecting product abnormalities to solve the above problems.

所述影像處理與檢測方法包括:獲取待檢測圖像,對所述待檢測圖像進行校正;對校正後的待檢測圖像進行瑕疵增強處理,包括:對所述校正後的待檢測圖像進行中值濾波處理;對中值濾波處理後的待檢測圖像進行對比度調整;對調整對比度後的待檢測圖像進行雙邊濾波處理;對瑕疵增強處理後的待檢測圖像進行瑕疵檢測,獲得檢測結果。 The image processing and detection method includes: obtaining an image to be detected, correcting the image to be detected; performing defect enhancement processing on the corrected image to be detected, including: performing median filtering processing on the corrected image to be detected; adjusting the contrast of the image to be detected after the median filtering processing; performing bilateral filtering processing on the image to be detected after the contrast adjustment; performing defect detection on the image to be detected after the defect enhancement processing, and obtaining a detection result.

可選地,所述對所述待檢測圖像進行校正包括:獲取無瑕疵圖像,將所述無瑕疵圖像作為參考圖像對所述待檢測圖像進行位置校正。 Optionally, the correction of the image to be detected includes: obtaining a flawless image, and using the flawless image as a reference image to perform position correction on the image to be detected.

可選地,所述對所述校正後的待檢測圖像進行中值濾波處理包括: 在所述校正後的待檢測圖像中,透過滑動預設的滑動視窗,將所述校正後的待檢測圖像中的每一點的圖元值更新為所述滑動視窗中的圖元值的中值;對所述校正後的待檢測圖像的邊緣位置處的圖元值做邊緣處理。 Optionally, the median filtering process for the corrected image to be detected includes: In the corrected image to be detected, by sliding a preset sliding window, updating the pixel value of each point in the corrected image to be detected to the median value of the pixel value in the sliding window; performing edge processing on the pixel value at the edge position of the corrected image to be detected.

可選地,所述對中值濾波處理後的待檢測圖像進行對比度調整包括:獲取所述中值濾波處理後的待檢測圖像的亮度長條圖;設定均衡閾值K,依據所述均衡閾值K更新所述亮度長條圖;根據更新後的亮度長條圖,利用長條圖均衡化方法調整所述中值濾波處理後的待檢測圖像的對比度。 Optionally, the contrast adjustment of the image to be detected after the median filtering process includes: obtaining a brightness bar graph of the image to be detected after the median filtering process; setting an equalization threshold K , and updating the brightness bar graph according to the equalization threshold K ; and adjusting the contrast of the image to be detected after the median filtering process using a bar graph equalization method according to the updated brightness bar graph.

可選地,所述亮度長條圖的橫軸為圖元值v,所述亮度長條圖的縱軸為所述中值濾波處理後的待檢測圖像中對應圖元值v的圖元數量y v Optionally, the horizontal axis of the brightness bar graph is the pixel value v , and the vertical axis of the brightness bar graph is the number of pixels y v corresponding to the pixel value v in the image to be detected after the median filtering process.

可選地,所述依據所述均衡閾值K更新所述亮度長條圖包括:確定所述亮度長條圖中大於所述均衡閾值K的圖元數量y v ,利用公式

Figure 111102258-A0305-02-0004-1
獲得更新後的亮度長條圖,所述更新後的亮度長條圖的橫軸為圖元值v,所述更新後的亮度長條圖的縱軸為對應圖元值v的圖元數量y' v 。 Optionally, updating the brightness bar graph according to the equalization threshold K comprises: determining the number of pixels y v in the brightness bar graph that are greater than the equalization threshold K , using the formula
Figure 111102258-A0305-02-0004-1
An updated brightness bar graph is obtained, wherein the horizontal axis of the updated brightness bar graph is the pixel value v , and the vertical axis of the updated brightness bar graph is the number of pixels y' v corresponding to the pixel value v .

可選地,所述根據更新後的亮度長條圖,利用長條圖均衡化方法調整所述中值濾波處理後的待檢測圖像的對比度包括:計算累積分佈函數cdf(v),利用所述累積分佈函數cdf(v)對圖元值v進行更新,獲得更新後的圖元值k(v),所使用的公式為:

Figure 111102258-A0305-02-0004-4
,其中,round表示取整函數,M表示所述中值濾波處理後的待檢測圖像的寬的圖元的數量,N表示所述中值濾波處理後的待檢測圖像的高的圖元的數量。 Optionally, adjusting the contrast of the image to be detected after the median filtering process by using the histogram equalization method according to the updated brightness histogram includes: calculating a cumulative distribution function cdf ( v ), updating the pixel value v by using the cumulative distribution function cdf ( v ), and obtaining an updated pixel value k ( v ), and the formula used is:
Figure 111102258-A0305-02-0004-4
, wherein round represents a rounding function, M represents the number of wide pixels of the image to be detected after the median filtering process, and N represents the number of high pixels of the image to be detected after the median filtering process.

可選地,所述對瑕疵增強處理後的待檢測圖像進行瑕疵檢測,獲得檢測結果包括:利用預先訓練的影像處理與檢測模型對所述瑕疵增強處理後的待檢測圖像進行瑕疵檢測,獲得所述瑕疵增強處理後的待檢測圖像的瑕疵值;判斷所述瑕疵值是否超出預設的瑕疵閾值的範圍;當所述瑕疵值超出所述瑕疵值的範圍時,確定所述待檢測圖像為有瑕疵圖像;或當所 述瑕疵值未超出所述瑕疵值的範圍時,確定所述待檢測圖像為無瑕疵圖像。 Optionally, the defect detection of the image to be detected after defect enhancement processing to obtain the detection result includes: using a pre-trained image processing and detection model to perform defect detection on the image to be detected after defect enhancement processing to obtain a defect value of the image to be detected after defect enhancement processing; judging whether the defect value exceeds a preset defect threshold range; when the defect value exceeds the defect value range, determining that the image to be detected is a defective image; or when the defect value does not exceed the defect value range, determining that the image to be detected is a non-defective image.

所述電腦可讀儲存介質儲存有至少一個指令,所述至少一個指令被處理器執行時實現所述影像處理與檢測方法。 The computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by the processor, the image processing and detection method is implemented.

所述電腦裝置包括儲存器和至少一個處理器,所述儲存器中儲存有至少一個指令,所述至少一個指令被所述至少一個處理器執行時實現所述影像處理與檢測檢查方法。 The computer device includes a memory and at least one processor, wherein at least one instruction is stored in the memory, and when the at least one instruction is executed by the at least one processor, the image processing and detection inspection method is implemented.

相較於習知技術,所述影像處理與檢測方法、電腦裝置及儲存介質,可以在不影響正常樣本的情況下,強化圖像上瑕疵的表現,以提高瑕疵檢測的準確率。 Compared with the prior art, the image processing and detection method, computer device and storage medium can enhance the appearance of defects on the image without affecting the normal sample, so as to improve the accuracy of defect detection.

3:電腦裝置 3:Computer equipment

32:處理器 32: Processor

31:儲存器 31: Storage

30:影像處理與檢測系統 30: Image processing and detection system

S1~S3:步驟 S1~S3: Steps

S20~S22:步驟 S20~S22: Steps

S30~S33:步驟 S30~S33: Steps

為了更清楚地說明本申請實施例或習知技術中的技術方案,下面將對實施例或習知技術描述中所需要使用的附圖作簡單地介紹,顯而易見地,下面描述中的附圖僅僅是本申請的實施例,對於本領域普通技術人員來講,在不付出創造性勞動的前提下,還可以根據提供的附圖獲得其他的附圖。 In order to more clearly illustrate the technical solutions in the embodiments of this application or the known technology, the drawings required for the embodiments or the known technology description will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative labor.

圖1是本申請實施例提供的影像處理與檢測方法的流程圖。 Figure 1 is a flow chart of the image processing and detection method provided by the embodiment of this application.

圖2是本申請實施例提供的電腦裝置的架構圖。 Figure 2 is a diagram of the architecture of the computer device provided in the embodiment of this application.

圖3是本申請實施例提供的步驟S2的流程圖。 Figure 3 is a flow chart of step S2 provided in the embodiment of this application.

圖4是本申請實施例提供的影像處理與檢測方法的示例圖。 Figure 4 is an example diagram of the image processing and detection method provided by the embodiment of this application.

圖5是本申請實施例提供的步驟S3的流程圖。 Figure 5 is a flow chart of step S3 provided in the embodiment of this application.

為了能夠更清楚地理解本申請的上述目的、特徵和優點,下面結合附圖和具體實施例對本申請進行詳細描述。需要說明的是,在不衝突的 情況下,本申請的實施例及實施例中的特徵可以相互組合。 In order to more clearly understand the above-mentioned purpose, features and advantages of this application, the following is a detailed description of this application in conjunction with the attached drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of this application and the features in the embodiments can be combined with each other.

在下面的描述中闡述了很多具體細節以便於充分理解本申請,所描述的實施例僅僅是本申請一部分實施例,而不是全部的實施例。基於本申請中的實施例,本領域普通技術人員在沒有做出創造性勞動前提下所獲得的所有其他實施例,都屬於本申請保護的範圍。 In the following description, many specific details are explained to facilitate a full understanding of this application. The embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative labor are within the scope of protection of this application.

除非另有定義,本文所使用的所有的技術和科學術語與屬於本申請的技術領域的技術人員通常理解的含義相同。本文中在本申請的說明書中所使用的術語只是為了描述具體的實施例的目的,不是旨在於限制本申請。 Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of this application. The terms used in this specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.

參閱圖1所示,為本申請實施例提供的影像處理與檢測的流程圖。 See Figure 1, which is a flowchart of image processing and detection provided in the embodiment of this application.

在本實施例中,所述影像處理與檢測方法可以應用於電腦裝置中,對於需要進行影像處理與檢測的電腦裝置,可以直接在電腦裝置上集成本申請的方法所提供的用於影像處理與檢測的功能,或者以軟體開發套件(Software Development Kit,SDK)的形式運行在電腦裝置上。 In this embodiment, the image processing and detection method can be applied to a computer device. For a computer device that needs to perform image processing and detection, the image processing and detection functions provided by the method of this application can be directly integrated on the computer device, or run on the computer device in the form of a software development kit (SDK).

如圖1所示,所述影像處理與檢測方法具體包括以下步驟,根據不同的需求,該流程圖中步驟的順序可以改變,某些步驟可以省略。 As shown in Figure 1, the image processing and detection method specifically includes the following steps. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

步驟S1、電腦裝置獲取待檢測圖像,對所述待檢測圖像進行校正。 Step S1, the computer device obtains the image to be detected and calibrates the image to be detected.

在一個實施例中,電腦裝置可以回應用戶輸入,獲取所述待檢測圖像,所述待檢測圖像可以包括多張圖像,之後對所述待檢測圖像的操作包括對所述多張圖像中的每張圖像的操作。用戶輸入可以是對圖像的傳送,例如上傳或下載,並透過介面或介面輸入待檢測圖像。 In one embodiment, the computer device can respond to user input to obtain the image to be detected, which may include multiple images, and then the operation on the image to be detected includes the operation on each of the multiple images. The user input can be the transmission of the image, such as uploading or downloading, and the image to be detected is input through an interface or interface.

此外,電腦裝置還可以預先儲存所述待檢測圖像在電腦裝置的儲存器中,或者預先儲存所述待檢測圖像在與電腦裝置通訊連接的其他設備中。待檢測圖像可以是對需要進行檢測的某種印刷品(例如化妝品說明書 等)所拍攝獲得的圖像。 In addition, the computer device can also pre-store the image to be detected in the memory of the computer device, or pre-store the image to be detected in other devices that are connected to the computer device. The image to be detected can be an image taken of a certain printed material that needs to be detected (such as a cosmetics manual, etc.).

在一個實施例中,所述對所述待檢測圖像進行校正包括:獲取無瑕疵圖像,將所述無瑕疵圖像作為參考圖像對所述待檢測圖像進行位置校正。 In one embodiment, the correction of the image to be detected includes: obtaining a flawless image, and using the flawless image as a reference image to perform position correction on the image to be detected.

電腦裝置可以回應用戶輸入,獲取一張所述無瑕疵圖像,將所述無瑕疵圖像作為對所述待檢測圖像進行圖像校正時的參考圖像。電腦裝置還可以預先將所述無瑕疵圖像儲存在該電腦裝置的儲存器中,或者預先將所述無瑕疵圖像儲存在與該電腦裝置通訊連接的其他設備中。 The computer device can respond to user input and obtain a flawless image, and use the flawless image as a reference image when performing image correction on the image to be detected. The computer device can also pre-store the flawless image in a memory of the computer device, or pre-store the flawless image in other devices that are connected to the computer device in communication.

本實施例中,所述無瑕疵圖像可以是所述印刷品的標準樣本(Golden Sample)圖像,即可以是針對沒有瑕疵的所述印刷品所拍攝的圖像。 In this embodiment, the flawless image may be a standard sample (Golden Sample) image of the printed product, that is, an image taken of the printed product without any flaws.

在一個實施例中,對所述待檢測圖像進行圖像校正包括利用尺度不變特徵變換(Scale-invariant feature transform,SIFT)技術對所述待檢測圖像的位置進行幾何位置校正。 In one embodiment, performing image correction on the image to be detected includes using scale-invariant feature transform (SIFT) technology to perform geometric position correction on the position of the image to be detected.

所述利用SIFT技術對所述待檢測圖像的位置進行幾何校正包括:獲取所述待檢測圖像中的多個第一特徵點(例如,待檢測圖像中的紋理劇烈變化的點、拐角點、直線與直線的交點,以及單純區域中的孤立點等)和所述無瑕疵圖像中的多個第二特徵點(例如,無瑕疵圖像中的紋理劇烈變化的點、拐角點、直線與直線的交點,以及單純區域中的孤立點等); The geometric correction of the position of the image to be detected by using SIFT technology includes: obtaining multiple first feature points in the image to be detected (for example, points where the texture in the image to be detected changes dramatically, corner points, intersections of straight lines, and isolated points in a simple area, etc.) and multiple second feature points in the flawless image (for example, points where the texture in the flawless image changes dramatically, corner points, intersections of straight lines, and isolated points in a simple area, etc.);

利用計算匹配矩陣的方法,在每個第一特徵點和每個第二特徵點之間建立匹配關係,獲得互相匹配的多個第一特徵點對;利用隨機抽樣一致(Random Sample Consensus,RANSAC)演算法從所述多個第一特徵點對中剔除匹配錯誤的第一特徵點對,獲得匹配正確的第一特徵點對;根據所述匹配正確的第一特徵點對,計算所述待檢測圖像的第一校正矩陣;基於所述第一校正矩陣,對所述待檢測圖像進行校正。需要說明的是,本實施例中,每個第一特徵點對也即是互相匹配的第一特徵點和第二特徵點的 組合。 By using a matching matrix calculation method, a matching relationship is established between each first feature point and each second feature point to obtain a plurality of mutually matching first feature point pairs; a random sample consensus (RANSAC) algorithm is used to eliminate the first feature point pairs with incorrect matching from the plurality of first feature point pairs to obtain the first feature point pairs with correct matching; based on the first feature point pairs with correct matching, a first correction matrix of the image to be detected is calculated; based on the first correction matrix, the image to be detected is corrected. It should be noted that in this embodiment, each first feature point pair is a combination of mutually matching first feature points and second feature points.

需要說明的是,校正後的待檢測圖像和所述無瑕疵圖像大小一致。 It should be noted that the size of the image to be detected after correction is the same as the flawless image.

步驟S2、電腦裝置對校正後的待檢測圖像進行瑕疵增強處理。 Step S2: The computer device performs defect enhancement processing on the calibrated image to be detected.

在一個實施例中,所述對校正後的待檢測圖像進行瑕疵增強處理的細化流程包括如圖3所示的步驟20至步驟22。 In one embodiment, the detailed process of performing defect enhancement processing on the corrected image to be detected includes steps 20 to 22 as shown in FIG3.

步驟20、對所述校正後的待檢測圖像進行中值濾波處理。 Step 20: Perform median filtering on the corrected image to be detected.

在一個實施例中,所述對所述校正後的待檢測圖像進行中值濾波處理包括:在所述校正後的待檢測圖像中,透過滑動預設的滑動視窗,將所述校正後的待檢測圖像中的每一點的圖元值更新為所述滑動視窗中的圖元值的中值;對所述校正後的待檢測圖像的邊緣位置處的圖元值做邊緣處理。 In one embodiment, the median filtering process for the corrected image to be detected includes: in the corrected image to be detected, by sliding a preset sliding window, updating the pixel value of each point in the corrected image to be detected to the median value of the pixel value in the sliding window; performing edge processing on the pixel value at the edge position of the corrected image to be detected.

電腦裝置可以設定所述滑動視窗的形狀,例如,設定所述滑動視窗的形狀為正方形,還可以設定為線狀、圓形、十字形、圓環形等形狀。 所述滑動視窗的大小可以固定不變也可以發生變化,所述滑動視窗中可以容納奇數個的圖元。 The computer device can set the shape of the sliding window, for example, the shape of the sliding window can be set to a square, or it can be set to a linear, circular, cross, ring, etc. The size of the sliding window can be fixed or changeable, and the sliding window can accommodate an odd number of graphics elements.

透過所述滑動視窗在所述校正後的待檢測圖像的滑動遍歷(例如,從左至右,從上至下),將所述校正後的待檢測圖像中的每一點的圖元值更新為所述滑動視窗中的圖元值的中值,以消除所述校正後的待檢測圖像中的孤立的雜訊圖元(例如,椒鹽雜訊、脈衝雜訊等)。 By sliding the sliding window over the corrected image to be detected (for example, from left to right, from top to bottom), the pixel value of each point in the corrected image to be detected is updated to the median value of the pixel value in the sliding window to eliminate isolated noise pixels (for example, pepper and salt noise, pulse noise, etc.) in the corrected image to be detected.

在對所述校正後的待檢測圖像的邊緣位置(例如,矩形圖像的四條邊)處的圖元值做邊緣處理時,電腦裝置可以將邊緣位置處的圖元值更新為與其距離最近的圖元的值。 When edge processing is performed on the pixel values at the edge positions of the corrected image to be detected (for example, the four edges of a rectangular image), the computer device can update the pixel values at the edge positions to the values of the pixel closest to them.

參閱圖4所示,將校正後的待檢測圖像4A進行中值濾波處理後,得到圖像4B。 As shown in FIG4 , the corrected image 4A to be detected is subjected to median filtering to obtain image 4B.

步驟21、對中值濾波處理後的待檢測圖像進行對比度調整。 Step 21: Adjust the contrast of the image to be detected after median filtering.

在一個實施例中,所述對中值濾波處理後的待檢測圖像進行對比度調整包括:獲取所述中值濾波處理後的待檢測圖像的亮度長條圖;設定均衡閾值K,依據所述均衡閾值K更新所述亮度長條圖;根據更新後的亮度長條圖,利用長條圖均衡化方法調整所述中值濾波處理後的待檢測圖像的對比度。 In one embodiment, the contrast adjustment of the image to be detected after the median filtering process includes: obtaining a brightness bar graph of the image to be detected after the median filtering process; setting an equalization threshold K , and updating the brightness bar graph according to the equalization threshold K ; and adjusting the contrast of the image to be detected after the median filtering process using a bar graph equalization method according to the updated brightness bar graph.

所述亮度長條圖的橫軸為圖元值v,所述亮度長條圖的縱軸為所述中值濾波處理後的待檢測圖像中對應圖元值v的圖元數量y v The horizontal axis of the brightness bar graph is the pixel value v , and the vertical axis of the brightness bar graph is the number of pixels y v corresponding to the pixel value v in the image to be detected after the median filtering process.

所述依據所述均衡閾值K更新所述亮度長條圖包括:確定所述亮度長條圖中大於所述均衡閾值K的圖元數量y v ,利用公式

Figure 111102258-A0305-02-0009-6
y v 獲得更新後的亮度長條圖,所述更新後的亮度長條圖的橫軸為圖元值v,所述更新後的亮度長條圖的縱軸為對應圖元值v的圖元數量y' v 。 The updating of the brightness bar graph according to the equalization threshold K comprises: determining the number of picture elements y v in the brightness bar graph that are greater than the equalization threshold K , using the formula
Figure 111102258-A0305-02-0009-6
y v obtains an updated brightness bar graph, wherein the horizontal axis of the updated brightness bar graph is the pixel value v , and the vertical axis of the updated brightness bar graph is the number of pixels y' v corresponding to the pixel value v .

所述截斷閾值K的選取與所述中值濾波處理後的待檢測圖像中圖元的總個數成正比,例如,當所述中值濾波處理後的待檢測圖像的寬的圖元的數量為640個,所述中值濾波處理後的待檢測圖像的高的圖元的數量為480個時,所述中值濾波處理後的待檢測圖像中圖元的總個數為640×480=307200個,所述截斷閾值K可以取值為2000。 The selection of the cutoff threshold K is proportional to the total number of picture elements in the image to be detected after the median filtering process. For example, when the number of wide picture elements in the image to be detected after the median filtering process is 640, and the number of high picture elements in the image to be detected after the median filtering process is 480, the total number of picture elements in the image to be detected after the median filtering process is 640×480=307200, and the cutoff threshold K can be 2000.

所述根據更新後的亮度長條圖,利用長條圖均衡化方法調整所述中值濾波處理後的待檢測圖像的對比度包括:計算累積分佈函數cdf(v),利用所述累積分佈函數cdf(v)對圖元值v進行更新,獲得更新後的圖元值k(v),所使用的公式為:

Figure 111102258-A0305-02-0009-7
,其中,round表示取整函數,M表示所述中值濾波處理後的待檢測圖像的寬的圖元的數量,N表示所述中值濾波處理後的待檢測圖像的高的圖元的數量。 The step of adjusting the contrast of the image to be detected after the median filtering process by using the histogram equalization method according to the updated brightness histogram includes: calculating the cumulative distribution function cdf ( v ), updating the pixel value v by using the cumulative distribution function cdf ( v ), and obtaining the updated pixel value k ( v ), wherein the formula used is:
Figure 111102258-A0305-02-0009-7
, wherein round represents a rounding function, M represents the number of wide pixels of the image to be detected after the median filtering process, and N represents the number of high pixels of the image to be detected after the median filtering process.

參閱圖4所示,將中值濾波處理後的待檢測圖像4B進行對比度調整後,得到圖像4C。 As shown in FIG4 , the image 4B to be detected after median filtering is subjected to contrast adjustment to obtain image 4C.

步驟22、對調整對比度後的待檢測圖像進行雙邊濾波處理。 Step 22: Perform bilateral filtering on the image to be detected after adjusting the contrast.

在一個實施例中,雙邊濾波是一種邊緣保護濾波方法。常用的高斯濾波以正態分佈為基礎,根據卷積範本內圖元點與目標圖元點的距離來計算權重,從而達到模糊效果,平滑的同時把圖像的邊緣細節也進行了模糊。為了保留邊緣細節,雙邊濾波加入了卷積範本內圖元點與目標圖元點的灰度權重分量。即加入了圖元點色差權重G r 與空間距離權重G S ,得到了雙邊濾波器I p ,具體公式表示為:

Figure 111102258-A0305-02-0010-8
Figure 111102258-A0305-02-0010-9
,其中p表示目標圖元,S表示濾波視窗(例如上述的滑動視窗)中的圖元群,即目標圖元的周圍的圖元群,q表示目標圖元的周圍的圖元群中的一個圖元,I q 表示q的圖元值,W p 表示濾波視窗內每個圖元值的權重和,用於權重的歸一化。 In one embodiment, bilateral filtering is an edge protection filtering method. Commonly used Gaussian filtering is based on normal distribution, and the weight is calculated according to the distance between the pixel point in the convolution template and the target pixel point, thereby achieving a blurring effect, and blurring the edge details of the image while smoothing. In order to retain the edge details, the bilateral filter adds the grayscale weight components of the pixel point in the convolution template and the target pixel point. That is , the pixel point color difference weight Gr and the spatial distance weight Gs are added to obtain the bilateral filter Ip , which is specifically expressed as:
Figure 111102258-A0305-02-0010-8
,
Figure 111102258-A0305-02-0010-9
, where p represents the target pixel, S represents the pixel group in the filtering window (such as the sliding window mentioned above), that is, the pixel group surrounding the target pixel, q represents a pixel in the pixel group surrounding the target pixel, I q represents the pixel value of q , and W p represents the weighted sum of each pixel value in the filtering window, which is used for weight normalization.

在所述調整對比度後的待檢測圖像的平坦區域,雙邊濾波器中每個圖元點的G r 值相近,空間距離權重G S 主導濾波效果。在所述調整對比度後的待檢測圖像的邊緣區域,邊緣同側的G r 值相近,且遠大於邊緣另一側的G r 值,此時另一側的圖元點的權重對濾波結果幾乎不影響,邊緣資訊得到保護,表現出了一定的自我調整性。 In the flat area of the image to be detected after the contrast adjustment, the Gr value of each pixel point in the bilateral filter is similar, and the spatial distance weight G S dominates the filtering effect. In the edge area of the image to be detected after the contrast adjustment, the Gr value on the same side of the edge is similar and much larger than the Gr value on the other side of the edge. At this time, the weight of the pixel point on the other side has almost no effect on the filtering result, and the edge information is protected, showing a certain degree of self-adjustment.

參閱圖4所示,將調整對比度後的待檢測圖像4C進行雙邊濾波處理後,得到圖像4D。 As shown in FIG4 , the image 4C to be detected after contrast adjustment is subjected to bilateral filtering to obtain image 4D.

步驟S3、電腦裝置對瑕疵增強處理後的待檢測圖像進行瑕疵檢測,獲得檢測結果。 Step S3: The computer device performs defect detection on the image to be detected after defect enhancement processing to obtain the detection result.

在一個實施例中,所述對瑕疵增強處理後的待檢測圖像進行瑕疵檢測,獲得檢測結果的細化流程可以參考圖5所示的如下流程。 In one embodiment, the defect detection is performed on the image to be detected after defect enhancement processing, and the detailed process of obtaining the detection result can refer to the following process shown in Figure 5.

步驟S30,利用預先訓練的圖像檢測模型對所述瑕疵增強處理後的待檢測圖像進行瑕疵檢測,獲得所述瑕疵增強處理後的待檢測圖像的瑕疵值。 Step S30, using the pre-trained image detection model to perform defect detection on the image to be detected after the defect enhancement processing, and obtain the defect value of the image to be detected after the defect enhancement processing.

在一個實施例中,可以將瑕疵增強處理後的待檢測圖像分為訓練集與驗證集(例如,按照7:3的比例進行劃分),利用訓練集作為訓練樣本 訓練神經網路(例如,卷積神經網路),獲得檢測模型;並判斷所述檢測模型是否達到預設的要求(例如,所述檢測模型的訓練過程達到1000Epochs),將達到所述預設的要求的檢測模型作為所述圖像檢測模型。將所述驗證集輸入所述圖像檢測模型進行檢測,獲得所述瑕疵值,所述瑕疵值的取值範圍可以是[0,1]。 In one embodiment, the image to be detected after defect enhancement processing can be divided into a training set and a verification set (for example, divided in a ratio of 7:3), and the training set is used as a training sample to train a neural network (for example, a convolutional neural network) to obtain a detection model; and it is determined whether the detection model meets the preset requirements (for example, the training process of the detection model reaches 1000 Epochs), and the detection model that meets the preset requirements is used as the image detection model. The verification set is input into the image detection model for detection to obtain the defect value, and the value range of the defect value can be [0, 1].

在其他實施例中,電腦裝置還可以獲取AOI檢測設備對所述瑕疵增強處理後的待檢測圖像進行瑕疵檢測得到的瑕疵值。 In other embodiments, the computer device can also obtain the defect value obtained by the AOI detection equipment performing defect detection on the image to be detected after the defect enhancement processing.

步驟S31,電腦裝置判斷所述瑕疵值是否超出預設的瑕疵閾值的範圍;當所述瑕疵值超出所述瑕疵值的範圍時,執行步驟S32;及當所述瑕疵值未超出所述瑕疵值的範圍時,執行步驟S33。 In step S31, the computer device determines whether the defect value exceeds the range of the preset defect threshold value; when the defect value exceeds the range of the defect value, step S32 is executed; and when the defect value does not exceed the range of the defect value, step S33 is executed.

在一個實施例中,所述預設的瑕疵閾值的範圍可以是大於0且小於等於0.05。 In one embodiment, the preset defect threshold value may be in the range of greater than 0 and less than or equal to 0.05.

步驟S32,電腦裝置確定所述待檢測圖像為有瑕疵圖像。 Step S32, the computer device determines that the image to be detected is a defective image.

在一個實施例中,當確定所述驗證集中的任一瑕疵增強處理後的待檢測圖像為有瑕疵圖像時,確定所述任一瑕疵增強處理後的待檢測圖像對應的最初的所述待檢測圖像(即步驟S1中獲取的待檢測圖像)為有瑕疵圖像。 In one embodiment, when it is determined that any image to be detected after defect enhancement processing in the verification set is a defective image, the original image to be detected corresponding to any image to be detected after defect enhancement processing (i.e., the image to be detected obtained in step S1) is determined to be a defective image.

步驟S33,電腦裝置確定所述待檢測圖像為無瑕疵圖像。 Step S33, the computer device determines that the image to be detected is a flawless image.

在一個實施例中,當確定所述驗證集中的任一瑕疵增強處理後的待檢測圖像為無瑕疵圖像時,確定所述任一瑕疵增強處理後的待檢測圖像對應的最初的所述待檢測圖像(即步驟S1中獲取的待檢測圖像)為無瑕疵圖像。 In one embodiment, when it is determined that any image to be detected after defect enhancement processing in the verification set is a flawless image, it is determined that the original image to be detected (i.e., the image to be detected obtained in step S1) corresponding to any image to be detected after defect enhancement processing is a flawless image.

上述圖1詳細介紹了本申請的影像處理與檢測方法,下面結合圖2,對實現所述影像處理與檢測方法的硬體裝置架構進行介紹。 The above Figure 1 introduces the image processing and detection method of this application in detail. The following is combined with Figure 2 to introduce the hardware device architecture for implementing the image processing and detection method.

應該瞭解,所述實施例僅為說明之用,在專利申請範圍上並不受此結構的限制。 It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.

參閱圖2所示,為本申請較佳實施例提供的電腦裝置的結構示意圖。在本申請較佳實施例中,所述電腦裝置3包括儲存器31、至少一個處理器32。本領域技術人員應該瞭解,圖2示出的電腦裝置的結構並不構成本申請實施例的限定,既可以是匯流排型結構,也可以是星形結構,所述電腦裝置3還可以包括比圖示更多或更少的其他硬體或者軟體,或者不同的部件佈置。 Refer to FIG. 2, which is a schematic diagram of the structure of a computer device provided in a preferred embodiment of the present application. In the preferred embodiment of the present application, the computer device 3 includes a memory 31 and at least one processor 32. Those skilled in the art should understand that the structure of the computer device shown in FIG. 2 does not constitute a limitation of the present embodiment, and can be a bus structure or a star structure. The computer device 3 can also include more or less other hardware or software than shown in the figure, or different component layouts.

在一些實施例中,所述電腦裝置3包括一種能夠按照事先設定或儲存的指令,自動進行數值計算和/或資訊處理的終端,其硬體包括但不限於微處理器、專用積體電路、可程式設計閘陣列、數位訊號處理器及嵌入式設備等。 In some embodiments, the computer device 3 includes a terminal capable of automatically performing numerical calculations and/or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, dedicated integrated circuits, programmable gate arrays, digital signal processors, and embedded devices, etc.

需要說明的是,所述電腦裝置3僅為舉例,其他現有的或今後可能出現的電子產品如可適應於本申請,也應包括在本申請的保護範圍以內,並以引用方式包括於此。 It should be noted that the computer device 3 is only an example. Other existing or future electronic products that are suitable for this application should also be included in the protection scope of this application and included here by reference.

在一些實施例中,所述儲存器31用於儲存程式碼和各種資料,例如安裝在所述電腦裝置3中的影像處理與檢測系統30,並在電腦裝置3的運行過程中實現高速、自動地完成程式或資料的存取。所述儲存器31包括唯讀記憶體(Read-Only Memory,ROM)、可程式設計唯讀記憶體(Programmable Read-Only Memory,PROM)、可抹除可程式設計唯讀記憶體(Erasable Programmable Read-Only Memory,EPROM)、一次可程式設計唯讀記憶體(One-time Programmable Read-Only Memory,OTPROM)、電子抹除式可複寫唯讀記憶體(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、唯讀光碟(Compact Disc Read-Only Memory,CD-ROM)或其他光碟儲存器、磁碟儲存器、磁帶儲存器、或者任何其他能夠用於攜帶或儲存資料的電腦可讀的儲存介質。 In some embodiments, the memory 31 is used to store program codes and various data, such as the image processing and detection system 30 installed in the computer device 3, and to achieve high-speed and automatic access to programs or data during the operation of the computer device 3. The storage device 31 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable storage medium that can be used to carry or store data.

在一些實施例中,所述至少一個處理器32可以由積體電路組成,例如可以由單個封裝的積體電路所組成,也可以是由多個相同功能或不同 功能封裝的積體電路所組成,包括一個或者多個中央處理器(Central Processing unit,CPU)、微處理器、數位訊號處理晶片、圖形處理器及各種控制晶片的組合等。所述至少一個處理器32是所述電腦裝置3的控制核心(Control Unit),利用各種介面和線路連接整個電腦裝置3的各個部件,透過運行或執行儲存在所述儲存器31內的程式或者模組,以及調用儲存在所述儲存器31內的資料,以執行電腦裝置3的各種功能和處理資料,例如執行圖1所示的影像處理與檢測的功能。 In some embodiments, the at least one processor 32 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital signal processing chips, graphics processors, and combinations of various control chips. The at least one processor 32 is the control core (Control Unit) of the computer device 3, and uses various interfaces and lines to connect the various components of the entire computer device 3, and executes or executes the programs or modules stored in the memory 31, and calls the data stored in the memory 31 to execute various functions of the computer device 3 and process data, such as executing the image processing and detection functions shown in Figure 1.

在一些實施例中,所述影像處理與檢測系統30運行於電腦裝置3中。所述影像處理與檢測系統30可以包括多個由程式碼段所組成的功能模組。所述影像處理與檢測系統30中的各個程式段的程式碼可以儲存於電腦裝置3的儲存器31中,並由至少一個處理器32所執行,以實現圖1所示的影像處理與檢測功能。 In some embodiments, the image processing and detection system 30 runs in a computer device 3. The image processing and detection system 30 may include a plurality of functional modules composed of program code segments. The program code of each program segment in the image processing and detection system 30 may be stored in a memory 31 of the computer device 3 and executed by at least one processor 32 to implement the image processing and detection functions shown in FIG1 .

儘管未示出,所述電腦裝置3還可以包括給各個部件供電的電源(比如電池),優選的,電源可以透過電源管理裝置與所述至少一個處理器32邏輯相連,從而透過電源管理裝置實現管理充電、放電、以及功耗管理等功能。電源還可以包括一個或一個以上的直流或交流電源、再充電裝置、電源故障檢測電路、電源轉換器或者逆變器、電源狀態指示器等任意元件。所述電腦裝置3還可以包括多種感測器、藍牙模組、Wi-Fi模組等,在此不再贅述。 Although not shown, the computer device 3 may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 32 through a power management device, so as to manage charging, discharging, and power consumption through the power management device. The power source may also include one or more DC or AC power sources, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The computer device 3 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be elaborated here.

應該瞭解,所述實施例僅為說明之用,在專利申請範圍上並不受此結構的限制。 It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.

上述以軟體功能模組的形式實現的集成的單元,可以儲存在一個電腦可讀取儲存介質中。上述軟體功能模組儲存在一個儲存介質中,包括若干指令用以使得一台電腦裝置(可以是伺服器、個人電腦等)或處理器(processor)執行本申請各個實施例所述方法的部分。 The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including several instructions for enabling a computer device (which can be a server, a personal computer, etc.) or a processor to execute a part of the method described in each embodiment of the present application.

在進一步的實施例中,結合圖2,所述至少一個處理器32可執 行所述電腦裝置3的操作裝置以及安裝的各類應用程式(如所述的影像處理與檢測系統30)、程式碼等,例如,上述的各個模組。 In a further embodiment, in conjunction with FIG. 2 , the at least one processor 32 can execute the operating device of the computer device 3 and various installed application programs (such as the image processing and detection system 30 ), program codes, etc., for example, the various modules mentioned above.

所述儲存器31中儲存有程式碼,且所述至少一個處理器32可調用所述儲存器31中儲存的程式碼以執行相關的功能。例如,所述的各個模組是儲存在所述儲存器31中的程式碼,並由所述至少一個處理器32所執行,從而實現所述各個模組的功能以達到圖1所示的影像處理與檢測的目的。 The memory 31 stores program codes, and the at least one processor 32 can call the program codes stored in the memory 31 to execute related functions. For example, each module is a program code stored in the memory 31 and executed by the at least one processor 32, thereby realizing the functions of each module to achieve the purpose of image processing and detection shown in Figure 1.

在本申請的一個實施例中,所述儲存器31儲存一個或多個指令(即至少一個指令),所述至少一個指令被所述至少一個處理器32所執行以實現圖1所示的影像處理與檢測的目的。 In one embodiment of the present application, the memory 31 stores one or more instructions (i.e., at least one instruction), and the at least one instruction is executed by the at least one processor 32 to achieve the purpose of image processing and detection shown in FIG1.

在本申請所提供的幾個實施例中,應該理解到,所揭露的裝置和方法,可以透過其它的方式實現。例如,以上所描述的裝置實施例僅僅是示意性的,例如,所述模組的劃分,僅僅為一種邏輯功能劃分,實際實現時可以有另外的劃分方式。 In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

所述作為分離部件說明的模組可以是或者也可以不是物理上分開的,作為模組顯示的部件可以是或者也可以不是物理單元,即可以位於一個地方,或者也可以分佈到多個網路單元上。可以根據實際的需要選擇其中的部分或者全部模組來實現本實施例方案的目的。 The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of this embodiment.

另外,在本申請各個實施例中的各功能模組可以集成在一個處理單元中,也可以是各個單元單獨物理存在,也可以兩個或兩個以上單元集成在一個單元中。上述集成的單元既可以採用硬體的形式實現,也可以採用硬體加軟體功能模組的形式實現。 In addition, each functional module in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional modules.

對於本領域技術人員而言,顯然本申請不限於上述示範性實施例的細節,而且在不背離本申請的精神或基本特徵的情況下,能夠以其他的具體形式實現本申請。因此,無論從哪一點來看,均應將實施例看作是示範性的,而且是非限制性的,本申請的範圍由所附請求項而不是上述說明 限定,因此旨在將落在請求項的等同要件的含義和範圍內的所有變化涵括在本申請內。不應將請求項中的任何附圖標記視為限制所涉及的請求項。此外,顯然“包括”一詞不排除其他單元或,單數不排除複數。裝置請求項中陳述的多個單元或裝置也可以由一個單元或裝置透過軟體或者硬體來實現。第一,第二等詞語用來表示名稱,而並不表示任何特定的順序。 It is obvious to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above and that the present application can be implemented in other specific forms without departing from the spirit or essential features of the present application. Therefore, no matter from which point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present application is limited by the attached claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "including" does not exclude other units or, and the singular does not exclude the plural. Multiple units or devices stated in the device claim may also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, not to indicate any particular order.

最後所應說明的是,以上實施例僅用以說明本申請的技術方案而非限制,儘管參照以上較佳實施例對本申請進行了詳細說明,本領域的普通技術人員應當理解,可以對本申請的技術方案進行修改或等同替換,而不脫離本申請技術方案的精神和範圍。 Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of this application and are not limiting. Although this application is described in detail with reference to the above preferred embodiments, ordinary technicians in this field should understand that the technical solution of this application can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of this application.

S1~S3:步驟 S1~S3: Steps

Claims (9)

一種影像處理與檢測方法,應用於電腦裝置,其中,所述方法包括:獲取待檢測圖像,對所述待檢測圖像進行校正;對校正後的待檢測圖像進行瑕疵增強處理,包括:對所述校正後的待檢測圖像進行中值濾波處理;對中值濾波處理後的待檢測圖像進行對比度調整,包括:獲取所述中值濾波處理後的待檢測圖像的亮度長條圖;設定均衡閾值K,依據所述均衡閾值K更新所述亮度長條圖;根據更新後的亮度長條圖,利用長條圖均衡化方法調整所述中值濾波處理後的待檢測圖像的對比度;對調整對比度後的待檢測圖像進行雙邊濾波處理;對瑕疵增強處理後的待檢測圖像進行瑕疵檢測,獲得檢測結果。 An image processing and detection method is applied to a computer device, wherein the method comprises: obtaining an image to be detected, correcting the image to be detected; performing defect enhancement processing on the corrected image to be detected, including: performing median filtering processing on the corrected image to be detected; adjusting the contrast of the image to be detected after the median filtering processing, including: obtaining the image to be detected after the median filtering processing; Detect the brightness bar graph of the image; set the equalization threshold K, and update the brightness bar graph according to the equalization threshold K; adjust the contrast of the image to be detected after the median filtering processing by using the bar graph equalization method according to the updated brightness bar graph; perform bilateral filtering processing on the image to be detected after the contrast adjustment; perform defect detection on the image to be detected after the defect enhancement processing, and obtain the detection result. 如請求項1所述的影像處理與檢測方法,其中,所述對所述待檢測圖像進行校正包括:獲取無瑕疵圖像,將所述無瑕疵圖像作為參考圖像對所述待檢測圖像進行位置校正。 As described in claim 1, the image processing and detection method, wherein the correction of the image to be detected includes: obtaining a flawless image, and using the flawless image as a reference image to perform position correction on the image to be detected. 如請求項1所述的影像處理與檢測方法,其中,所述對所述校正後的待檢測圖像進行中值濾波處理包括:在所述校正後的待檢測圖像中,透過滑動預設的滑動視窗,將所述校正後的待檢測圖像中的每一點的圖元值更新為所述滑動視窗中的圖元值的中值;對所述校正後的待檢測圖像的邊緣位置處的圖元值做邊緣處理。 The image processing and detection method as described in claim 1, wherein the median filtering process on the corrected image to be detected includes: in the corrected image to be detected, by sliding a preset sliding window, updating the pixel value of each point in the corrected image to be detected to the median value of the pixel value in the sliding window; performing edge processing on the pixel value at the edge position of the corrected image to be detected. 如請求項1所述的影像處理與檢測方法,其中,所述亮度長條圖的橫軸為圖元值v,所述亮度長條圖的縱軸為所述中值濾波處理後的待檢測圖像中對應圖元值v的圖元數量y v The image processing and detection method as described in claim 1, wherein the horizontal axis of the brightness bar graph is the pixel value v , and the vertical axis of the brightness bar graph is the number of pixels yv corresponding to the pixel value v in the image to be detected after the median filtering process. 如請求項4所述的影像處理與檢測方法,其中,所述依據所述 均衡閾值K更新所述亮度長條圖包括:確定所述亮度長條圖中大於所述均衡閾值K的圖元數量y v ,利用公式
Figure 111102258-A0305-02-0017-10
獲得更新後的亮度長條圖,所述更新後的亮度長條圖的橫軸為圖元值v,所述更新後的亮度長條圖的縱軸為對應圖元值v的圖元數量y' v
The image processing and detection method as claimed in claim 4, wherein updating the brightness bar graph according to the equalization threshold K comprises: determining the number of pixels y v in the brightness bar graph that are greater than the equalization threshold K , using the formula
Figure 111102258-A0305-02-0017-10
An updated brightness bar graph is obtained, wherein the horizontal axis of the updated brightness bar graph is the pixel value v , and the vertical axis of the updated brightness bar graph is the number of pixels y' v corresponding to the pixel value v .
如請求項4所述的影像處理與檢測方法,其中,所述根據更新後的亮度長條圖,利用長條圖均衡化方法調整所述中值濾波處理後的待檢測圖像的對比度包括:計算累積分佈函數cdf(v),利用所述累積分佈函數cdf(v)對圖元值v進行更新,獲得更新後的圖元值k(v),所使用的公式為:
Figure 111102258-A0305-02-0017-11
其中,round表示取整函數,M表示所述中值濾波處理後的待檢測圖像的寬的圖元的數量,N表示所述中值濾波處理後的待檢測圖像的高的圖元的數量。
The image processing and detection method as described in claim 4, wherein the adjusting the contrast of the image to be detected after the median filtering processing by using the histogram equalization method according to the updated brightness histogram comprises: calculating the cumulative distribution function cdf ( v ), updating the pixel value v by using the cumulative distribution function cdf ( v ), and obtaining the updated pixel value k ( v ), and the formula used is:
Figure 111102258-A0305-02-0017-11
Wherein, round represents a rounding function, M represents the number of wide pixels of the image to be detected after the median filtering process, and N represents the number of high pixels of the image to be detected after the median filtering process.
如請求項3所述的影像處理與檢測方法,其中,所述對瑕疵增強處理後的待檢測圖像進行瑕疵檢測,獲得檢測結果包括:利用預先訓練的影像處理與檢測模型對所述瑕疵增強處理後的待檢測圖像進行瑕疵檢測,獲得所述瑕疵增強處理後的待檢測圖像的瑕疵值;判斷所述瑕疵值是否超出預設的瑕疵閾值的範圍;當所述瑕疵值超出所述瑕疵值的範圍時,確定所述待檢測圖像為有瑕疵圖像;或當所述瑕疵值未超出所述瑕疵值的範圍時,確定所述待檢測圖像為無瑕疵圖像。 The image processing and detection method as described in claim 3, wherein the defect detection is performed on the image to be detected after defect enhancement processing to obtain the detection result, including: using a pre-trained image processing and detection model to perform defect detection on the image to be detected after defect enhancement processing to obtain the defect value of the image to be detected after defect enhancement processing; judging whether the defect value exceeds the range of a preset defect threshold value; when the defect value exceeds the range of the defect value, determining that the image to be detected is a defective image; or when the defect value does not exceed the range of the defect value, determining that the image to be detected is a non-defective image. 一種電腦可讀儲存介質,其中,所述電腦可讀儲存介質儲存有至少一個指令,所述至少一個指令被處理器執行時實現如請求項1至7中任意一項所述的影像處理與檢測方法。 A computer-readable storage medium, wherein the computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, the image processing and detection method as described in any one of claims 1 to 7 is implemented. 一種電腦裝置,其中,該電腦裝置包括儲存器和至少一個處理 器,所述儲存器中儲存有至少一個指令,所述至少一個指令被所述至少一個處理器執行時實現如請求項1至7中任意一項所述的影像處理與檢測方法。 A computer device, wherein the computer device includes a memory and at least one processor, wherein at least one instruction is stored in the memory, and when the at least one instruction is executed by the at least one processor, the image processing and detection method as described in any one of claims 1 to 7 is implemented.
TW111102258A 2022-01-19 2022-01-19 Image processing and detection method, computer device, and storage medium TWI843045B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW111102258A TWI843045B (en) 2022-01-19 2022-01-19 Image processing and detection method, computer device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW111102258A TWI843045B (en) 2022-01-19 2022-01-19 Image processing and detection method, computer device, and storage medium

Publications (2)

Publication Number Publication Date
TW202331643A TW202331643A (en) 2023-08-01
TWI843045B true TWI843045B (en) 2024-05-21

Family

ID=88558999

Family Applications (1)

Application Number Title Priority Date Filing Date
TW111102258A TWI843045B (en) 2022-01-19 2022-01-19 Image processing and detection method, computer device, and storage medium

Country Status (1)

Country Link
TW (1) TWI843045B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200529102A (en) * 2004-02-27 2005-09-01 Chi-Hao Yeh An image enhancement technique in inspecting visual defects of polarizers in TFT-LCD industry matrices
TWI456190B (en) * 2013-09-16 2014-10-11 Univ Nat Chunghsing Method of chip detects inspecting, system therefor, and computer program product thereof
CN107403422A (en) * 2017-08-04 2017-11-28 上海兆芯集成电路有限公司 To strengthen the method for picture contrast and its system
CN107657603A (en) * 2017-08-21 2018-02-02 北京精密机电控制设备研究所 A kind of industrial appearance detecting method based on intelligent vision
TW202127372A (en) * 2019-12-31 2021-07-16 大陸商鄭州富聯智能工坊有限公司 Method for defect level determination and computer readable storage medium thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200529102A (en) * 2004-02-27 2005-09-01 Chi-Hao Yeh An image enhancement technique in inspecting visual defects of polarizers in TFT-LCD industry matrices
TWI456190B (en) * 2013-09-16 2014-10-11 Univ Nat Chunghsing Method of chip detects inspecting, system therefor, and computer program product thereof
CN107403422A (en) * 2017-08-04 2017-11-28 上海兆芯集成电路有限公司 To strengthen the method for picture contrast and its system
CN107657603A (en) * 2017-08-21 2018-02-02 北京精密机电控制设备研究所 A kind of industrial appearance detecting method based on intelligent vision
TW202127372A (en) * 2019-12-31 2021-07-16 大陸商鄭州富聯智能工坊有限公司 Method for defect level determination and computer readable storage medium thereof

Also Published As

Publication number Publication date
TW202331643A (en) 2023-08-01

Similar Documents

Publication Publication Date Title
CN111340752B (en) Screen detection method and device, electronic equipment and computer readable storage medium
CN110476056B (en) Visual detection method, detection equipment and robot
US20080205755A1 (en) Method and apparatus for color matching
CN114066857A (en) Infrared image quality evaluation method and device, electronic equipment and readable storage medium
CN115861153A (en) Image detection method, computer device and storage medium
US20230214989A1 (en) Defect detection method, electronic device and readable storage medium
KR20220016245A (en) Apparatus and method for generating a defect image
CN111866501B (en) Camera module detection method and device, electronic equipment and medium
JP2004038885A (en) Image feature learning type defect detection method, defect detection device and defect detection program
WO2022130814A1 (en) Index selection device, information processing device, information processing system, inspection device, inspection system, index selection method, and index selection program
TWI843045B (en) Image processing and detection method, computer device, and storage medium
WO2024061194A1 (en) Sample label acquisition method and lens failure detection model training method
CN116503304A (en) Image processing and detecting method, computer device and storage medium
TWI795921B (en) Image detection method, computer device, and storage medium
TWI760934B (en) Mura compensation method for display panel, system, electronic device, and storage medium
JP2021148720A (en) Inspection system, learning device, learning program, learning method, inspection device, inspection program, and inspection method
CN117706815B (en) Method for detecting riding on adhesive tape, electronic equipment and storage medium
CN116188332B (en) Image processing method, device, equipment and storage medium
TWI788822B (en) Electronic device and method for inspecting defect in display area of display
TWI807854B (en) Method for detecting defects, computer device and storage medium
WO2021192627A1 (en) Inspection system, learning device, learning program, learning method, inspection device, inspection program, and inspection method
CN113658183B (en) Workpiece quality inspection method and device and computer equipment
TWI807536B (en) Inspection system and parameter setting method thereof
KR970012877A (en) Cathode ray tube screen inspection adjusting device and method
JP6815431B2 (en) Painted surface inspection equipment and programs