TWI831688B - Method for monitoring brightness chances in images and device thereof - Google Patents

Method for monitoring brightness chances in images and device thereof Download PDF

Info

Publication number
TWI831688B
TWI831688B TW112116580A TW112116580A TWI831688B TW I831688 B TWI831688 B TW I831688B TW 112116580 A TW112116580 A TW 112116580A TW 112116580 A TW112116580 A TW 112116580A TW I831688 B TWI831688 B TW I831688B
Authority
TW
Taiwan
Prior art keywords
image
brightness
mask
images
grayscale
Prior art date
Application number
TW112116580A
Other languages
Chinese (zh)
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 TW112116580A priority Critical patent/TWI831688B/en
Application granted granted Critical
Publication of TWI831688B publication Critical patent/TWI831688B/en

Links

Landscapes

  • Closed-Circuit Television Systems (AREA)

Abstract

A method for monitoring brightness changes in images and a device thereof are provided. The method includes: capturing and obtaining a plurality of first images from a capture area by an image capture device; generating an ignore mask according to the first images; generating a grayscale average image according to the first images, and masking the grayscale average image by the ignore mask to obtain a reference image; capturing a second image from the capturing area by the image capturing element; masking the second image by the ignore mask and subtracting grayscale values of each pixel position in the reference image from the second image masked by the ignore mask to obtain an image to be tested; and, judging whether brightness of the second image changes according to the image to be tested.

Description

監控圖像中亮度改變的方法及其裝置 Method and device for monitoring brightness changes in images

本發明是有關於一種應用於工業自動化的圖像識別技術,且特別是有關於一種監控圖像中亮度改變的方法及其裝置。 The present invention relates to an image recognition technology used in industrial automation, and in particular, to a method and device for monitoring brightness changes in an image.

在工業自動化(Automation)技術中,自動化設備機台常利用影像擷取技術進行物件檢測、圖像中特徵點擷取、工件對位...等操作,而影像的擷取會受到拍攝環境及影像擷取時使用的參數所影響。換言之,維持拍攝環境的穩定是影像擷取技術應用於工業自動化技術中的重要因素。 In industrial automation (Automation) technology, automated equipment machines often use image capture technology to perform operations such as object detection, feature point capture in images, workpiece alignment, etc. However, image capture will be affected by the shooting environment and Affected by the parameters used in image capture. In other words, maintaining the stability of the shooting environment is an important factor for the application of image capture technology in industrial automation technology.

目前可利用影像分析監測結合人員識別的方式來確認拍攝環境的穩定。舉例而言,可對拍攝影像的關鍵區域進行亮度或是銳利度等參數的監控,並讓人員確認以確保前述環境沒有因為外在因素(例如,人為調整/相機光圈設定被調整...等)而變異,或可透過人員識別來避開一些物料或背景在正常情況下即有亮度/銳利度的變異區域,確保所取得區域的圖像數值不受到前述因素影響而具備足夠的參考價值。然而,以人員識別的方式常有誤差, 甚至常有失誤發生,導致前述影像分析監測的準確率受到質疑。 Currently, image analysis monitoring combined with person identification can be used to confirm the stability of the shooting environment. For example, parameters such as brightness or sharpness can be monitored in key areas of the captured image, and personnel can be asked to confirm to ensure that the aforementioned environment has not been adjusted due to external factors (for example, manual adjustment/camera aperture setting, etc.) ) and variation, it may be possible to avoid areas where some materials or backgrounds have brightness/sharpness variations under normal circumstances through human identification, ensuring that the image values in the obtained areas are not affected by the aforementioned factors and have sufficient reference value. However, there are often errors in the way people are identified. Mistakes often occur, causing the accuracy of the aforementioned image analysis and monitoring to be questioned.

本發明提供一種監控圖像中亮度改變的方法及其裝置,其可自動地忽略圖像中不具參考價值或具備較低參考價值的區域,並利用圖像中具參考價值的區域來判斷圖像亮度是否改變,以在工業自動化技術中節約人力並降低人為錯誤的機率。 The present invention provides a method and device for monitoring brightness changes in an image, which can automatically ignore areas with no reference value or with lower reference value in the image, and use areas with reference value in the image to judge the image. Whether the brightness is changed to save labor and reduce the chance of human error in industrial automation technology.

本發明實施例所述的一種監控圖像中亮度改變的方法包括以下步驟:經由圖像擷取裝置以從擷取區域擷取並獲得多個第一圖像;依據所述多個第一圖像產生忽略遮罩;依據所述多個第一圖像產生灰階平均圖像,且藉由所述忽略遮罩遮蔽所述灰階平均圖像以獲得參考圖像;經由所述圖像擷取裝置從所述擷取區域擷取第二圖像;藉由所述忽略遮罩遮蔽所述第二圖像,並將經遮蔽的所述第二圖像減去所述參考圖像中各像素位置的灰階值以獲得待測圖像;以及依據所述待測圖像判斷所述第二圖像中的亮度是否改變。 A method for monitoring brightness changes in an image according to an embodiment of the present invention includes the following steps: capturing and obtaining a plurality of first images from a capture area through an image capture device; according to the multiple first images Generate an ignoring mask; generate a grayscale average image based on the plurality of first images, and mask the grayscale average image with the ignoring mask to obtain a reference image; capture the image through The capturing device captures a second image from the capture area; masks the second image by using the ignore mask, and subtracts each element in the reference image from the masked second image. The grayscale value of the pixel position is used to obtain the image to be measured; and it is determined whether the brightness in the second image changes based on the image to be measured.

本發明實施例所述的一種監控圖像中亮度改變的裝置包括圖像擷取裝置及處理器。圖像擷取裝置用以從擷取區域擷取多個第一圖像及第二圖像。處理器耦接所述圖像擷取裝置。處理器經配置以:經由所述圖像擷取裝置從擷取區域擷取並獲得多個第一圖像,依據所述多個第一圖像產生忽略遮罩,依據所述多個第一圖像產生灰階平均圖像,且藉由所述忽略遮罩遮蔽所述灰階平 均圖像以獲得參考圖像,經由所述圖像擷取裝置以從所述擷取區域擷取第二圖像,藉由所述忽略遮罩遮蔽所述第二圖像,並將經遮蔽的所述第二圖像減去所述參考圖像中各像素位置的灰階值以獲得待測圖像,以及依據所述待測圖像判斷所述第二圖像中的亮度是否改變。 A device for monitoring brightness changes in an image according to an embodiment of the present invention includes an image capturing device and a processor. The image capturing device is used to capture a plurality of first images and second images from the capturing area. The processor is coupled to the image capturing device. The processor is configured to: capture and obtain a plurality of first images from the capture area via the image capture device, generate an ignore mask based on the plurality of first images, and generate an ignore mask based on the plurality of first images. The image produces a grayscale average image, and the grayscale average is masked by the ignore mask. average the images to obtain a reference image, capture a second image from the capture area via the image capture device, mask the second image by the ignore mask, and store the masked image The gray scale value of each pixel position in the reference image is subtracted from the second image to obtain the image to be tested, and whether the brightness in the second image changes is determined based on the image to be tested.

基於上述,本發明實施例所述的監控圖像中亮度改變的方法及其裝置利用圖像擷取裝置所獲得的圖像自動地計算並產生不具參考價值或具備較低參考價值的圖像遮罩作為忽略遮罩,以去除掉圖像中可能誤判圖像亮度的區域。然後,利用此忽略遮罩來對其他圖像進行遮蔽及作為圖像的亮度改變的參考,以達到近乎全自動化監控圖像亮度,以節約人力並降低人為錯誤的機率。 Based on the above, the method and device for monitoring brightness changes in images described in embodiments of the present invention use images obtained by the image capture device to automatically calculate and generate image masks that have no reference value or have low reference value. Mask is used as an ignore mask to remove areas in the image that may misjudge the brightness of the image. Then, this ignore mask is used to mask other images and serve as a reference for brightness changes of the image, so as to achieve nearly fully automated monitoring of image brightness, thereby saving manpower and reducing the chance of human error.

100:監控圖像中亮度改變的裝置 100: Device for monitoring brightness changes in images

105:載具 105:Vehicle

107:物件 107:Object

109:擷取區域 109: Capture area

110:圖像擷取裝置 110:Image capture device

120:處理器 120: Processor

130:記憶體 130:Memory

S210~S270、S410~S445:監控圖像中亮度改變的方法的各步驟 S210~S270, S410~S445: Each step of the method of monitoring brightness changes in images

310:第一圖像 310: First image

315:忽略遮罩 315:Ignore mask

317:灰階平均圖像 317: Grayscale average image

319:參考圖像 319:Reference image

320:第二圖像 320: Second image

325:待測圖像 325: Image to be tested

510:差異圖像 510:Difference image

520:第一亮度遮罩 520: First brightness mask

530:第二亮度遮罩 530: Second brightness mask

540:測量不計圖像 540: Measurement does not include images

545:多張量測不計圖像的平均圖像 545: Average image of multiple images without measurement

X:灰階參考值 X: Grayscale reference value

圖1是依照本發明一實施例的一種監控圖像中亮度改變的裝置100的裝置示意圖。 FIG. 1 is a schematic diagram of a device 100 for monitoring brightness changes in an image according to an embodiment of the present invention.

圖2是依照本發明一實施例的一種監控圖像中亮度改變的方法200的流程圖。 FIG. 2 is a flowchart of a method 200 for monitoring brightness changes in an image according to an embodiment of the present invention.

圖3是方法200中各圖像的示意圖。 FIG. 3 is a schematic diagram of images in method 200.

圖4為圖2步驟S220的詳細流程圖。 FIG. 4 is a detailed flow chart of step S220 in FIG. 2 .

圖5是圖4中各圖像的示意圖。 Figure 5 is a schematic diagram of each image in Figure 4.

圖6是將量測不計圖像540中各個灰階值(於X軸呈現)所 具備的像素數量(於Y軸呈現)以直方圖呈現的示意圖。 Figure 6 shows each grayscale value (presented on the X-axis) in the measurement-excluding image 540. A schematic diagram showing the number of pixels (presented on the Y-axis) as a histogram.

圖1是依照本發明一實施例的一種監控圖像中亮度改變的裝置100的裝置示意圖。監控圖像中亮度改變的裝置100包括圖像擷取裝置110以及處理器120。圖像擷取裝置110用以從擷取區域109擷取圖像。詳細來說,如圖1所示,工業自動化設備具備載具105,載具105上方放置物件107(例如,PCB板)。擷取區域109中包括有載具105的一部分及物件107的一部分。 FIG. 1 is a schematic diagram of a device 100 for monitoring brightness changes in an image according to an embodiment of the present invention. The device 100 for monitoring brightness changes in an image includes an image capturing device 110 and a processor 120 . The image capture device 110 is used to capture images from the capture area 109 . Specifically, as shown in Figure 1, the industrial automation equipment is equipped with a carrier 105, and an object 107 (for example, a PCB board) is placed above the carrier 105. The capture area 109 includes a part of the carrier 105 and a part of the object 107 .

圖像擷取裝置110從擷取區域109擷取圖像,這些圖像在本實施例中可用於進行圖像中亮度改變的監控以外,還可用來作為進行物件檢測、圖像中特徵點擷取、工件對位...等工業自動化中影像處理技術所使用的圖像。 The image capture device 110 captures images from the capture area 109. In this embodiment, these images can be used not only for monitoring brightness changes in the image, but also for object detection and feature point capture in the image. Images used in image processing technology such as picking, workpiece alignment, etc. in industrial automation.

處理器120耦接並控制圖像擷取裝置110。記憶體130耦接處理器120以暫存圖像及正在處理中的相應資料。處理器120用以執行符合本發明實施例所述監控圖像中亮度改變的方法。 The processor 120 is coupled to and controls the image capturing device 110 . The memory 130 is coupled to the processor 120 to temporarily store images and corresponding data being processed. The processor 120 is used to execute a method for monitoring brightness changes in an image according to the embodiment of the present invention.

在正常情況下,因不同產品載具、物料或背景可能會有亮度/銳利度的變異或瑕疵區域,而這些區域在圖像上難以作為判斷圖像亮度改變的參考。另外,擷取區域109中的某些區域因為亮度已經飽和,若是亮度再提高,此些區域仍難以有明顯改變。同理,擷取區域109中的某些區域因為亮度已經過暗或極低,若是亮度再降低,此些區域仍難以有明顯改變。 Under normal circumstances, there may be brightness/sharpness variations or defective areas due to different product carriers, materials or backgrounds, and these areas in the image are difficult to use as a reference for judging changes in image brightness. In addition, some areas in the capture area 109 are already saturated in brightness. If the brightness is further increased, these areas will still be difficult to change significantly. Similarly, the brightness of some areas in the capture area 109 is already too dark or extremely low. If the brightness is further reduced, these areas will still be difficult to change significantly.

因此,本實施例所述監控圖像中亮度改變的裝置及方法透過比較所蒐集的圖像之間灰階差異較大的像素位置產生相對應的忽略遮罩,從而利用此忽略遮罩去除可能作為圖像亮度誤判的區域後,再將經由忽略遮罩遮蔽後的圖像與正常圖像的平均亮度進行比較,從而達成自動化監控圖像亮度是否改變的功能。 Therefore, the device and method for monitoring brightness changes in images described in this embodiment generate corresponding ignored masks by comparing pixel positions with large grayscale differences between the collected images, thereby utilizing the ignored masks to remove possible As the area of image brightness misjudgment, the image masked by ignoring the mask is compared with the average brightness of the normal image, thereby achieving the function of automatically monitoring whether the image brightness changes.

圖2是依照本發明一實施例的一種監控圖像中亮度改變的方法200的流程圖。圖3是方法200中各圖像的示意圖。圖2可適用於圖1監控圖像中亮度改變的裝置100,且方法200主要透過圖1處理器120實現。 FIG. 2 is a flowchart of a method 200 for monitoring brightness changes in an image according to an embodiment of the present invention. FIG. 3 is a schematic diagram of images in method 200. FIG. 2 can be applied to the device 100 for monitoring brightness changes in the image of FIG. 1 , and the method 200 is mainly implemented through the processor 120 of FIG. 1 .

請同時參閱圖2與圖3,於步驟S210中,圖1處理器120經由圖1圖像擷取裝置110以從擷取區域109擷取並獲得多個第一圖像310。本實施例所述的多個第一圖像310及後文所述的第二圖像320皆由圖1圖像擷取裝置110所擷取,為方便後續說明而將這些圖像以不同名稱標示。 Please refer to FIGS. 2 and 3 simultaneously. In step S210 , the processor 120 of FIG. 1 captures and obtains a plurality of first images 310 from the capture area 109 through the image capture device 110 of FIG. 1 . The plurality of first images 310 described in this embodiment and the second image 320 described below are all captured by the image capture device 110 in Figure 1. For the convenience of subsequent explanation, these images are named with different names. mark.

於步驟S220中,圖1處理器120依據這些第一圖像310計算並產生忽略遮罩315。本實施例是利用擷取時間相近的兩個第一圖像310作為本發明實施例中用以產生忽略遮罩315的基礎圖像。然則,只要是由圖1圖像擷取裝置110擷取的圖像,皆可作為本發明實施例產生忽略遮罩315的基礎圖像,並不受限於此。於後續實施例(如,圖4與圖5及相應描述)將詳細說明如何利用依序擷取的兩個第一圖像310計算並產生忽略遮罩315。 In step S220, the processor 120 of FIG. 1 calculates and generates the ignoring mask 315 based on the first images 310. In this embodiment, two first images 310 that are captured at a similar time are used as the basic images used to generate the ignore mask 315 in this embodiment of the present invention. However, any image captured by the image capture device 110 in FIG. 1 can be used as the basic image for generating the ignore mask 315 according to the embodiment of the present invention, and is not limited thereto. How to calculate and generate the ignore mask 315 using the two first images 310 captured sequentially will be described in detail in subsequent embodiments (eg, FIG. 4 and FIG. 5 and corresponding descriptions).

於步驟S230中,圖1處理器120依據這些第一圖像310 計算並產生灰階平均圖像317,並且藉由忽略遮罩315遮蔽灰階平均圖像317以獲得參考圖像319。本實施例是以經蒐集的多個第一圖像310中每個像素位置的灰階值進行平均以產生灰階平均圖像317,並且利用前述忽略遮罩315將灰階平均圖像317中參考價值低的區域遮蔽,從而產生參考圖像319。參考圖像319主要是記錄灰階平均圖像317中並未被忽略遮罩315所遮蔽的像素位置及其灰階值。未被忽略遮罩315遮蔽的這些像素位置用於作為判斷圖像中的亮度是否改變的參考價值較高。本實施例是先以第一圖像310將這些參考價值較高的像素位置及其灰階值先行整理成為此參考圖像319,以於後續判斷圖像中的亮度是否改變時使用。 In step S230, the processor 120 of FIG. 1 uses these first images 310 to A grayscale average image 317 is calculated and generated, and the grayscale average image 317 is masked by ignoring the mask 315 to obtain a reference image 319 . In this embodiment, the grayscale values of each pixel position in the collected first images 310 are averaged to generate the grayscale average image 317 , and the aforementioned ignore mask 315 is used to generate the grayscale average image 317 Areas with low reference value are masked, thereby generating a reference image 319 . The reference image 319 mainly records the pixel positions and their grayscale values in the grayscale average image 317 that are not obscured by the ignored mask 315 . These pixel positions that are not obscured by the ignored mask 315 are of high reference value for determining whether the brightness in the image changes. In this embodiment, the first image 310 is used to first organize the pixel positions and their grayscale values with higher reference values into the reference image 319, which can be used when subsequently determining whether the brightness in the image has changed.

至此,本實施例在步驟S240至步驟S270中便利用步驟S220的忽略遮罩315及步驟S230的參考圖像319來對其他圖像(如,第二圖像320)加以處理,從而判斷第二圖像320中的亮度是否改變。 So far, this embodiment uses the ignore mask 315 of step S220 and the reference image 319 of step S230 to process other images (such as the second image 320) in steps S240 to S270, thereby determining the second Whether the brightness in image 320 changes.

詳細來說,於步驟S240中,圖1處理器120經由圖1圖像擷取裝置110以從圖1擷取區域109擷取第二圖像320。於步驟S250中,圖1處理器120藉由忽略遮罩315遮蔽第二圖像320,以將參考價值低的區域忽略。於步驟S260中,圖1處理器120將經遮蔽的第二圖像320減去參考圖像319中各像素位置的灰階值取絕對值以獲得第二圖像320與參考圖像319間的差異圖像,即待測圖像325。於步驟S270中,圖1處理器120便依據待測圖像325判斷第二圖像320中的亮度是否改變。 Specifically, in step S240 , the processor 120 of FIG. 1 captures the second image 320 from the capture area 109 of FIG. 1 via the image capture device 110 of FIG. 1 . In step S250, the processor 120 of FIG. 1 masks the second image 320 by using the ignore mask 315 to ignore the areas with low reference value. In step S260, the processor 120 of FIG. 1 subtracts the grayscale value of each pixel position in the reference image 319 from the masked second image 320 to obtain an absolute value between the second image 320 and the reference image 319. The difference image is the image to be tested 325. In step S270, the processor 120 of FIG. 1 determines whether the brightness in the second image 320 changes according to the image 325 to be tested.

步驟S260的詳細步驟為,處理器計算待測圖像325中各像素的平均灰階值。需注意的是,待測圖像325有部分像素位置受到遮蔽,因此這些像素位置對應的灰階值不計算在前述平均灰階值中。接著,處理器判斷前述平均灰階值是否超過一個亮度閥值,此亮度閥值可由應用本發明實施例者設定,例如為『10』。當前述平均灰階值超過亮度閥值『10』時,處理器便進行提示操作,藉以利用此提示操作來呈現出「待測圖像的亮度已受到改變」的信息給相應人員。亮度閥值可為單一數值或數值範圍。 The detailed steps of step S260 are: the processor calculates the average grayscale value of each pixel in the image 325 to be measured. It should be noted that some pixel positions of the image to be measured 325 are obscured, so the grayscale values corresponding to these pixel positions are not calculated in the aforementioned average grayscale value. Next, the processor determines whether the average grayscale value exceeds a brightness threshold. The brightness threshold can be set by the user of the embodiment of the present invention, for example, "10". When the average grayscale value exceeds the brightness threshold "10", the processor will perform a prompt operation, thereby using this prompt operation to present the information that "the brightness of the image to be measured has been changed" to the corresponding person. The brightness threshold can be a single value or a range of values.

在此詳細說明圖2步驟S220中產生忽略遮罩315的詳細步驟。圖4為圖2步驟S220的詳細流程圖。圖5是圖4中各圖像的示意圖。 The detailed steps of generating the ignore mask 315 in step S220 of FIG. 2 will be described in detail here. FIG. 4 is a detailed flow chart of step S220 in FIG. 2 . Figure 5 is a schematic diagram of each image in Figure 4.

請同時參照圖4與圖5。於步驟S410中,處理器獲得依序擷取的兩個第一圖像310之間的差異圖像510。詳言之,處理器將兩個第一圖像310中每個像素位置對應的灰階值相減以產生差異圖像510。 Please refer to both Figure 4 and Figure 5. In step S410, the processor obtains the difference image 510 between the two first images 310 captured sequentially. In detail, the processor subtracts the grayscale values corresponding to each pixel position in the two first images 310 to generate the difference image 510 .

本實施例的步驟S420與步驟S430是擷取第一圖像310中極暗區域(例如,灰階值小於第一臨界灰階值(例如為『25』)的像素位置的集合)與極亮區域(例如,灰階值大於第二臨界灰階值(例如為『230』)的像素位置的集合),這兩個參考價值低的區域作為亮度遮罩,以排除參考價值低的像素。應用本實施例者可依其需求調整第一臨界灰階值與第二臨界灰階值的數值,例如第一臨界灰階值亦可以是『10』、第一臨界灰階值亦可以是『245』。 Steps S420 and S430 of this embodiment are to capture extremely dark areas (for example, a set of pixel locations with grayscale values less than a first critical grayscale value (for example, "25")) and extremely bright areas in the first image 310 Areas (for example, a set of pixel locations with grayscale values greater than the second critical grayscale value (for example, "230")), these two areas with low reference values serve as brightness masks to exclude pixels with low reference values. Those who apply this embodiment can adjust the values of the first critical gray scale value and the second critical gray scale value according to their needs. For example, the first critical gray scale value can also be "10", and the first critical gray scale value can also be " 245』.

詳細來說,在此以第一灰階值為25而第二灰階值為230為例,於步驟S420中,處理器比對第一圖像310的其中之一的每個像素位置的灰階值及第一臨界灰階值,以擷取第一圖像310小於第一臨界灰階值的區域,進而獲得第一亮度遮罩520。據此,第一圖像310中被第一亮度遮罩520遮蔽的每個像素的灰階值小於第一臨界灰階值。於步驟S430中,處理器比對第一圖像310的其中之一的每個像素位置的灰階值及第二臨界灰階值,以擷取第一圖像310大於第二臨界灰階值的區域,進而獲得第二亮度遮罩530。據此,第一圖像310中被第二亮度遮罩530遮蔽的每個像素的灰階值大於第二臨界灰階值。本實施例是將圖5中兩個第一圖像310靠左側的圖像作為『第一圖像310的其中之一』,應用本實施例者可依其需求將第一圖像310中任一圖像作為本實施例中步驟S410至步驟S440所述的『第一圖像310的其中之一』。 Specifically, here, taking the first grayscale value as 25 and the second grayscale value as 230 as an example, in step S420, the processor compares the grayscale of each pixel position in one of the first images 310. The level value and the first critical gray level value are used to capture the area of the first image 310 that is smaller than the first critical gray level value, thereby obtaining the first brightness mask 520 . Accordingly, the grayscale value of each pixel in the first image 310 that is obscured by the first brightness mask 520 is less than the first critical grayscale value. In step S430, the processor compares the grayscale value of each pixel position of one of the first images 310 with the second critical grayscale value to capture that the first image 310 is greater than the second critical grayscale value. area, and then obtain the second brightness mask 530. Accordingly, the gray level value of each pixel in the first image 310 that is blocked by the second brightness mask 530 is greater than the second critical gray level value. In this embodiment, the image on the left side of the two first images 310 in Figure 5 is regarded as "one of the first images 310". Those who apply this embodiment can use any of the first images 310 according to their needs. An image is used as "one of the first images 310" described in steps S410 to S440 in this embodiment.

於步驟S440中,處理器依據步驟S410的差異圖像510、步驟S420的第一亮度遮罩520及步驟S430的第二亮度遮罩530以計算獲得忽略遮罩315。本發明實施例中,最為簡便地產生忽略遮罩315的方式即是將差異圖像510、第一亮度遮罩520及第二亮度遮罩530相加總即可產生粗略的忽略遮罩315。本發明另一實施例中,則可由圖4中步驟S441至步驟S445來產生忽略遮罩315。 In step S440, the processor calculates and obtains the ignore mask 315 based on the difference image 510 of step S410, the first brightness mask 520 of step S420, and the second brightness mask 530 of step S430. In the embodiment of the present invention, the simplest way to generate the ignore mask 315 is to add the difference image 510, the first brightness mask 520 and the second brightness mask 530 to generate a rough ignore mask 315. In another embodiment of the present invention, the ignore mask 315 can be generated by step S441 to step S445 in FIG. 4 .

於步驟S441中,處理器將差異圖像510、第一亮度遮罩520及第二亮度遮罩530中各個像素位置的灰階值相加總以產生量測不計圖像540。 In step S441 , the processor adds the grayscale values of each pixel position in the difference image 510 , the first brightness mask 520 and the second brightness mask 530 to generate a measurement-free image 540 .

於步驟S442中,處理器依據量測不計圖像540中各像素的灰階值來計算一個灰階參考值X。詳細來說,請參見圖6,圖6是將量測不計圖像540中各個灰階值(於X軸呈現)所具備的像素數量(於Y軸呈現)以直方圖呈現的示意圖,亦即,以直方圖呈現每個灰階值對應的像素數量。圖6中灰階值愈小,表示此些像素位置對於圖像亮度的參考價值高、變異小。因此,本發明實施例從灰階值0開始計數及累加到某一像素數量,此像素數量可為圖像整體像素數量的30%且對應於步驟S442所計算的灰階參考值X。換句話說,灰階值0到此灰階參考值X的像素數目的總和約等於圖像整體像素數量的30%,表示灰階值低於灰階參考值X的對應區域為全部圖像面積的30%具備參考價值的區域。全部像素數量的30%是一亮度參考依據的區域,視拍攝情況不同,若已知亮度穩定區域極小,百分比數可能要往下調整。但若一般穩定區域大於30%,即可使用全部像素數量的30%作為參考區域。其中,上述「約等於」可以完全等於,也可以不完全等於(即在一容忍範圍內,例如正負10%以內)。 In step S442, the processor calculates a grayscale reference value X based on the grayscale value of each pixel in the measured image 540. For details, please refer to Figure 6. Figure 6 is a schematic diagram showing the number of pixels (presented on the Y-axis) of each grayscale value (presented on the X-axis) in the measured image 540 as a histogram, that is, , presenting the number of pixels corresponding to each grayscale value as a histogram. The smaller the grayscale value in Figure 6 is, it means that these pixel positions have high reference value and small variation for image brightness. Therefore, in this embodiment of the present invention, counting starts from the grayscale value 0 and accumulates to a certain number of pixels. This number of pixels can be 30% of the total number of pixels in the image and corresponds to the grayscale reference value X calculated in step S442. In other words, the sum of the number of pixels from grayscale value 0 to grayscale reference value 30% of the areas have reference value. 30% of the total number of pixels is a brightness reference area. Depending on the shooting situation, if the brightness stable area is known to be extremely small, the percentage may need to be adjusted downwards. However, if the general stable area is greater than 30%, 30% of the total number of pixels can be used as the reference area. Among them, the above-mentioned "approximately equal to" may be completely equal, or may not be completely equal (that is, within a tolerance range, for example, within plus or minus 10%).

回到圖4與圖5,於步驟S443中,處理器基於步驟S442的灰階參考值X來比對量測不計圖像540中各像素位置的灰階值。於步驟S444中,當量測不計圖像540中各像素位置的灰階值大於步驟S442的灰階參考值X時,處理器記錄對應的像素位置,並依據所記錄的這些像素位置產生忽略遮罩315。大於灰階參考值X的灰階值表示對於圖像亮度的參考價值小且變異高,所以在亮 度檢測尚可於以忽略。因此,步驟S441至步驟S444即產生忽略遮罩315。於本實施例中,為避免圖像飄移或誤差等因素,於步驟S445中,處理器會將忽略遮罩315中各區域適度地擴張一擴張像素值(例如,適度擴張『5』個像素),從而產生經擴張後的忽略遮罩315。 Returning to FIGS. 4 and 5 , in step S443 , the processor compares the grayscale values of each pixel position in the unmeasured image 540 based on the grayscale reference value X in step S442 . In step S444, when the grayscale value of each pixel position in the measurement ignore image 540 is greater than the grayscale reference value Hood 315. A grayscale value greater than the grayscale reference value The degree of detection can be ignored. Therefore, steps S441 to S444 generate the ignore mask 315. In this embodiment, in order to avoid factors such as image drift or errors, in step S445, the processor will appropriately expand each area in the ignored mask 315 by an expanded pixel value (for example, moderately expand "5" pixels) , thereby producing the dilated ignore mask 315.

本實施例在圖4與圖5的步驟S441至步驟S445雖然是以依序擷取的兩個第一圖像310經由差異圖像510、第一亮度遮罩520、第二亮度遮罩530來產生量測不計圖像540,應用本實施例者亦可從多個第一圖像310中的任意兩個來產生與蒐集大量的量測不計圖像540並將這些量測不計圖像540進行平均以產生多張量測不計圖像的平均圖像545,並利用此平均圖像545按照前述步驟S444的方式產生與調整忽略遮罩315。 In this embodiment, in steps S441 to S445 of FIG. 4 and FIG. 5 , the two first images 310 are acquired sequentially through the difference image 510 , the first brightness mask 520 , and the second brightness mask 530 . To generate the measurement-excluding images 540, those who apply this embodiment can also generate and collect a large number of measurement-excluding images 540 from any two of the plurality of first images 310, and perform these measurement-excluding images 540. Average to generate an average image 545 of multiple omission images, and use this average image 545 to generate and adjust the ignore mask 315 in the manner of the aforementioned step S444.

所述待測圖像判斷所述第二圖像中的亮度是否改變包括下列步驟。先計算所述待測圖像中各像素的平均灰階值,再判斷所述平均灰階值是否超過亮度閥值。當所述平均灰階值超過所述亮度閥值時,進行提示操作,所述提示操作用以呈現所述待測圖像的亮度已受到改變。 Determining whether the brightness in the second image changes in the image to be tested includes the following steps. First, calculate the average gray scale value of each pixel in the image to be measured, and then determine whether the average gray scale value exceeds the brightness threshold. When the average grayscale value exceeds the brightness threshold, a prompt operation is performed, and the prompt operation is used to present that the brightness of the image to be measured has been changed.

綜上所述,本發明實施例所述的監控圖像中亮度改變的方法及其裝置利用圖像擷取裝置所獲得的圖像自動地計算並產生不具參考價值或具備較低參考價值的圖像遮罩作為忽略遮罩,以去除掉圖像中可能誤判圖像亮度的區域。然後,利用此忽略遮罩來對其他圖像進行遮蔽及作為圖像的亮度改變的參考,以達到近 乎全自動化監控圖像亮度,以節約人力並降低人為錯誤的機率。 In summary, the method and device for monitoring brightness changes in images described in embodiments of the present invention use images obtained by the image capture device to automatically calculate and generate images that have no reference value or have low reference value. Image mask is used as an ignore mask to remove areas of the image that may misjudge the brightness of the image. Then, use this ignore mask to mask other images and use it as a reference for the brightness change of the image to achieve close range. It fully automatically monitors image brightness to save manpower and reduce the chance of human error.

S210~S270:監控圖像中亮度改變的方法的各步驟 S210~S270: Each step of the method for monitoring brightness changes in images

Claims (10)

一種監控圖像中亮度改變的方法,包括:經由一圖像擷取裝置從一擷取區域擷取並獲得多個第一圖像;依據所述多個第一圖像產生一忽略遮罩;依據所述多個第一圖像產生一灰階平均圖像,且藉由所述忽略遮罩遮蔽所述灰階平均圖像以獲得一參考圖像;經由所述圖像擷取裝置從所述擷取區域擷取一第二圖像;藉由所述忽略遮罩遮蔽所述第二圖像,並將經遮蔽的所述第二圖像減去所述參考圖像中各像素位置的灰階值以獲得一待測圖像;以及依據所述待測圖像判斷所述第二圖像中的一亮度是否改變。 A method for monitoring changes in brightness in an image, including: capturing and obtaining a plurality of first images from a capture area through an image capture device; generating an ignore mask based on the plurality of first images; A grayscale average image is generated based on the plurality of first images, and the grayscale average image is masked by the ignoring mask to obtain a reference image; and the image capturing device is used to obtain a grayscale average image from all the grayscale average images. The capture area captures a second image; the second image is masked by the ignore mask, and the masked second image is subtracted from the reference image at each pixel position. The grayscale value is used to obtain an image to be measured; and it is determined whether a brightness in the second image changes according to the image to be measured. 如請求項1所述的方法,依據所述多個第一圖像產生所述忽略遮罩包括:獲得所述多個第一圖像中的其中之二之間的一差異圖像;比對所述多個第一圖像的其中之一的每個像素位置的灰階值及一第一臨界灰階值以獲得一第一亮度遮罩,其中所述第一圖像被所述第一亮度遮罩所遮蔽的每個像素的灰階值小於所述第一臨界灰階值;比對所述多個第一圖像的其中之一的每個像素位置的灰階值及一第二臨界灰階值以獲得一第二亮度遮罩,其中所述第一圖像被所述第二亮度遮罩所遮蔽的每個像素的灰階值大於所述第二臨 界灰階值,且所述第一臨界灰階值小於所述第二臨界灰階值;以及依據所述差異圖像、所述第一亮度遮罩及所述第二亮度遮罩獲得所述忽略遮罩。 According to the method of claim 1, generating the ignoring mask based on the plurality of first images includes: obtaining a difference image between two of the plurality of first images; comparing The grayscale value of each pixel position of one of the plurality of first images and a first critical grayscale value are used to obtain a first brightness mask, wherein the first image is covered by the first The grayscale value of each pixel blocked by the brightness mask is less than the first critical grayscale value; comparing the grayscale value of each pixel position in one of the plurality of first images with a second A critical grayscale value is obtained to obtain a second brightness mask, wherein the grayscale value of each pixel of the first image obscured by the second brightness mask is greater than the second critical grayscale value. boundary gray level value, and the first critical gray level value is less than the second critical gray level value; and obtaining the said difference image, the first brightness mask and the second brightness mask according to the difference image, the first brightness mask and the second brightness mask Masks are ignored. 如請求項2所述的方法,依據所述差異圖像、所述第一亮度遮罩及所述第二亮度遮罩獲得所述忽略遮罩包括:將所述差異圖像、所述第一亮度遮罩及所述第二亮度遮罩中各個像素位置的灰階值相加總以產生一量測不計圖像;依據所述量測不計圖像中各像素的灰階值計算一灰階參考值;基於所述灰階參考值比對所述量測不計圖像中各像素位置的灰階值;以及當所述量測不計圖像中各像素位置的灰階值大於所述灰階參考值時,記錄對應的所述像素位置,並依據所記錄的所述像素位置產生所述忽略遮罩。 According to the method of claim 2, obtaining the ignore mask based on the difference image, the first brightness mask and the second brightness mask includes: combining the difference image, the first brightness mask The grayscale values of each pixel position in the brightness mask and the second brightness mask are added together to generate a measurement-free image; a grayscale is calculated based on the grayscale value of each pixel in the measurement-free image. Reference value; compare the gray scale value of each pixel position in the measurement-excluding image based on the gray-scale reference value; and when the gray-scale value of each pixel position in the measurement-excluding image is greater than the gray level When the reference value is used, the corresponding pixel position is recorded, and the ignore mask is generated based on the recorded pixel position. 如請求項1所述的方法,其中所述多個第一圖像以及所述第二圖像中包含物件的一部分。 The method according to claim 1, wherein the plurality of first images and the second images include a part of the object. 如請求項1所述的方法,依據所述待測圖像判斷所述第二圖像中的所述亮度是否改變包括:計算所述待測圖像中各像素的一平均灰階值;判斷所述平均灰階值是否超過一亮度閥值;以及當所述平均灰階值超過所述亮度閥值時,進行一提示操作, 所述提示操作用以呈現所述第二圖像中的所述亮度已受到改變。 According to the method of claim 1, determining whether the brightness in the second image has changed based on the image to be tested includes: calculating an average grayscale value of each pixel in the image to be tested; determining Whether the average gray scale value exceeds a brightness threshold; and when the average gray scale value exceeds the brightness threshold, a prompt operation is performed, The prompt operation is used to present that the brightness in the second image has been changed. 一種監控圖像中亮度改變的裝置,包括:一圖像擷取裝置,用以從一擷取區域擷取多個第一圖像及一第二圖像;以及一處理器,耦接所述圖像擷取裝置,其中所述處理器經配置以:經由所述圖像擷取裝置從所述擷取區域擷取並獲得所述多個第一圖像,依據所述多個第一圖像產生一忽略遮罩,依據所述多個第一圖像產生一灰階平均圖像,且藉由所述忽略遮罩遮蔽所述灰階平均圖像以獲得一參考圖像,經由所述圖像擷取裝置從所述擷取區域擷取所述第二圖像,藉由所述忽略遮罩遮蔽所述第二圖像,並將經遮蔽的所述第二圖像減去所述參考圖像中各像素位置的灰階值以獲得一待測圖像,以及,依據所述待測圖像判斷所述第二圖像中的一亮度是否改變。 A device for monitoring brightness changes in an image, including: an image capture device for capturing a plurality of first images and a second image from a capture area; and a processor coupled to the An image capture device, wherein the processor is configured to: capture and obtain the plurality of first images from the capture area via the image capture device, according to the plurality of first images An ignore mask is generated, a grayscale average image is generated based on the plurality of first images, and the grayscale average image is masked by the ignore mask to obtain a reference image. The image capture device captures the second image from the capture area, masks the second image by the ignore mask, and subtracts the masked second image from the masked second image. Referring to the grayscale value of each pixel position in the image to obtain an image to be tested, and judging whether a brightness in the second image changes based on the image to be tested. 如請求項6所述的裝置,其中所述處理器還經配置以:獲得所述多個第一圖像中的其中之二之間的一差異圖像,比對所述多個第一圖像的其中之一的每個像素位置的灰階值及一第一臨界灰階值以獲得一第一亮度遮罩,其中所述第一圖像被所述第一亮度遮罩所遮蔽的每個像素的灰階值小於所述第一臨 界灰階值,比對所述多個第一圖像的其中之一的每個像素位置的灰階值及一第二臨界灰階值以獲得一第二亮度遮罩,其中所述第一圖像被所述第二亮度遮罩所遮蔽的每個像素的灰階值大於所述第二臨界灰階值,且所述第一臨界灰階值小於所述第二臨界灰階值,以及,依據所述差異圖像、所述第一亮度遮罩及所述第二亮度遮罩獲得所述忽略遮罩。 The device of claim 6, wherein the processor is further configured to: obtain a difference image between two of the plurality of first images, compare the plurality of first images The grayscale value of each pixel position of one of the images and a first critical grayscale value are used to obtain a first brightness mask, wherein each part of the first image obscured by the first brightness mask The grayscale value of pixels is smaller than the first adjacent boundary grayscale value, comparing the grayscale value of each pixel position of one of the plurality of first images with a second critical grayscale value to obtain a second brightness mask, wherein the first The grayscale value of each pixel of the image obscured by the second brightness mask is greater than the second critical grayscale value, and the first critical grayscale value is less than the second critical grayscale value, and , the ignore mask is obtained based on the difference image, the first brightness mask and the second brightness mask. 如請求項7所述的裝置,其中所述處理器還經配置以:將所述差異圖像、所述第一亮度遮罩及所述第二亮度遮罩中各個像素位置的灰階值相加總以產生一量測不計圖像,依據所述量測不計圖像中各像素的灰階值計算一灰階參考值,基於所述灰階參考值比對所述量測不計圖像中各像素位置的灰階值,以及,當所述量測不計圖像中各像素位置的灰階值大於所述灰階參考值時,記錄對應的所述像素位置,並依據所記錄的所述像素位置產生所述忽略遮罩。 The device of claim 7, wherein the processor is further configured to: compare the grayscale values of each pixel position in the difference image, the first brightness mask and the second brightness mask. Summing up to generate a measurement-excluding image, calculating a gray-scale reference value based on the gray-scale value of each pixel in the measurement-excluding image, and comparing the values in the measurement-excluding image based on the gray-scale reference value The grayscale value of each pixel position, and when the grayscale value of each pixel position in the measured image is greater than the grayscale reference value, record the corresponding pixel position, and based on the recorded The pixel position that produces the ignore mask. 如請求項6所述的裝置,其中所述多個第一圖像以及所述第二圖像中包含物件的一部分。 The device of claim 6, wherein the plurality of first images and the second images include a part of the object. 如請求項6所述的裝置,其中所述處理器還經配置以:計算所述待測圖像中各像素的一平均灰階值;判斷所述平均灰階值是否超過一亮度閥值;以及當所述平均灰階值超過所述亮度閥值時,進行一提示操作,所述提示操作用以呈現所述第二圖像中的所述亮度已受到改變。 The device of claim 6, wherein the processor is further configured to: calculate an average grayscale value of each pixel in the image to be measured; determine whether the average grayscale value exceeds a brightness threshold; And when the average grayscale value exceeds the brightness threshold, a prompt operation is performed, and the prompt operation is used to present that the brightness in the second image has been changed.
TW112116580A 2023-05-04 2023-05-04 Method for monitoring brightness chances in images and device thereof TWI831688B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW112116580A TWI831688B (en) 2023-05-04 2023-05-04 Method for monitoring brightness chances in images and device thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW112116580A TWI831688B (en) 2023-05-04 2023-05-04 Method for monitoring brightness chances in images and device thereof

Publications (1)

Publication Number Publication Date
TWI831688B true TWI831688B (en) 2024-02-01

Family

ID=90824603

Family Applications (1)

Application Number Title Priority Date Filing Date
TW112116580A TWI831688B (en) 2023-05-04 2023-05-04 Method for monitoring brightness chances in images and device thereof

Country Status (1)

Country Link
TW (1) TWI831688B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI386866B (en) * 2007-08-31 2013-02-21 Casio Computer Co Ltd Gradation correction device, gradation correction method and gradation correction program
US20190309409A1 (en) * 2016-06-27 2019-10-10 Saint-Gobain Glass France Method and device for locating the origin of a defect affecting a stack of thin layers deposited on a substrate
CN110706182A (en) * 2019-10-10 2020-01-17 普联技术有限公司 Method and device for detecting flatness of shielding case, terminal equipment and storage medium
WO2021160522A1 (en) * 2020-02-12 2021-08-19 Asml Netherlands B.V. Method for determining a mask pattern comprising optical proximity corrections using a trained machine learning model
TW202147277A (en) * 2020-02-07 2021-12-16 日商半導體能源研究所股份有限公司 Image processing system
TW202201380A (en) * 2020-06-16 2022-01-01 南韓商矽工廠股份有限公司 Dimming value filtering device and image data processing
CN115564682A (en) * 2022-07-18 2023-01-03 芯动微电子科技(珠海)有限公司 Uneven-illumination image enhancement method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI386866B (en) * 2007-08-31 2013-02-21 Casio Computer Co Ltd Gradation correction device, gradation correction method and gradation correction program
US20190309409A1 (en) * 2016-06-27 2019-10-10 Saint-Gobain Glass France Method and device for locating the origin of a defect affecting a stack of thin layers deposited on a substrate
CN110706182A (en) * 2019-10-10 2020-01-17 普联技术有限公司 Method and device for detecting flatness of shielding case, terminal equipment and storage medium
TW202147277A (en) * 2020-02-07 2021-12-16 日商半導體能源研究所股份有限公司 Image processing system
WO2021160522A1 (en) * 2020-02-12 2021-08-19 Asml Netherlands B.V. Method for determining a mask pattern comprising optical proximity corrections using a trained machine learning model
TW202201380A (en) * 2020-06-16 2022-01-01 南韓商矽工廠股份有限公司 Dimming value filtering device and image data processing
CN115564682A (en) * 2022-07-18 2023-01-03 芯动微电子科技(珠海)有限公司 Uneven-illumination image enhancement method and system

Similar Documents

Publication Publication Date Title
WO2018010391A1 (en) Board inspection method and device
JP3329805B2 (en) Automatic visual inspection device and visual inspection method
WO2017071406A1 (en) Method and system for detecting pin of gold needle element
KR20210038211A (en) Method of inspection using image masking operation
CN113269769A (en) Defect detection method, system and equipment based on image registration
US20160100146A1 (en) Imaging apparatus, image processing method, and medium
TWI831688B (en) Method for monitoring brightness chances in images and device thereof
JP2008009938A (en) Moving image data processor, moving image data processing method, moving image data processing program and storage medium recording the program
JPH11125514A (en) Bending angle detecting device
CN109785343B (en) Definition-based face matting picture optimization method and device
TWI793035B (en) Image noise identification method and image analysis device
CN114964032B (en) Blind hole depth measurement method and device based on machine vision
JP5983033B2 (en) Position relationship determination program, position relationship determination method, and position relationship determination device
KR101126759B1 (en) Method of teaching for electronic parts information in chip mounter
CN118898561A (en) Method and device for monitoring brightness change in image
JPH06294633A (en) Method and equipment for automatically inspecting fastener
JP4860452B2 (en) Mark positioning method and apparatus using template matching
KR101793091B1 (en) Method and apparatus for detecting defective pixels
JPH08159712A (en) Pattern recognition method
JP4865204B2 (en) Image processing method, image processing apparatus, and semiconductor inspection apparatus
JPH08145904A (en) Inspection equipment of bright defect/dark defect
US20240281948A1 (en) Image processing device, and image processing method
JP2747396B2 (en) Appearance inspection equipment for electronic components
JP3041056B2 (en) Semiconductor pellet detection method
JPH0514898A (en) Image monitor device