TWI427271B - Computer system and method for adjusting lights - Google Patents

Computer system and method for adjusting lights Download PDF

Info

Publication number
TWI427271B
TWI427271B TW97144112A TW97144112A TWI427271B TW I427271 B TWI427271 B TW I427271B TW 97144112 A TW97144112 A TW 97144112A TW 97144112 A TW97144112 A TW 97144112A TW I427271 B TWI427271 B TW I427271B
Authority
TW
Taiwan
Prior art keywords
illumination
level
image
light
adjustment
Prior art date
Application number
TW97144112A
Other languages
Chinese (zh)
Other versions
TW201018872A (en
Inventor
Chih Kuang Chang
Xian-Yi Chen
Zhong-Kui Yuan
Li Jiang
Yi-Rong Hong
Original Assignee
Hon Hai Prec Ind Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hon Hai Prec Ind Co Ltd filed Critical Hon Hai Prec Ind Co Ltd
Priority to TW97144112A priority Critical patent/TWI427271B/en
Publication of TW201018872A publication Critical patent/TW201018872A/en
Application granted granted Critical
Publication of TWI427271B publication Critical patent/TWI427271B/en

Links

Landscapes

  • Image Input (AREA)
  • Image Processing (AREA)

Description

光照調節方法及其電腦系統 Light adjustment method and computer system thereof

本發明涉及一種影像測量方法及其電腦系統,尤其涉及一種獲取工件表面影像的光照調節方法及其電腦系統。 The invention relates to an image measuring method and a computer system thereof, in particular to a light adjusting method for acquiring a surface image of a workpiece and a computer system thereof.

影像測量是目前精密量測領域中最廣泛使用的測量方法,該方法不僅精度高,而且測量速度快,對保證產品品質起著重要的作用。 Image measurement is currently the most widely used measurement method in the field of precision measurement. This method not only has high precision, but also has fast measurement speed, which plays an important role in ensuring product quality.

眾所週知,由於影像測量機台測量工件時的光源及光照角度不同,影像測量中的影像可被分為輪廓影像和表面影像。在此,僅對工件的表面影像進行描述。具體而言,在利用影像測量工件的表面特徵,如使用邊緣工具測量工件表面的邊緣、使用對焦工具測量物體表面的高度時,其重複性與精度受光照的影響大。過強或過弱的光照都有可能造成影像測量的誤差變大,甚至導致測量失敗。另外,在給工件拍照、影像拼接及焦點合成時,適當的光照獲取可使得工件的表面影像清晰、細節豐富。 It is well known that the image in the image measurement can be divided into a contour image and a surface image because the light source and the illumination angle are different when the image measuring machine measures the workpiece. Here, only the surface image of the workpiece is described. Specifically, when the surface features of the workpiece are measured using an image, such as using an edge tool to measure the edge of the workpiece surface, and using a focus tool to measure the height of the surface of the object, the repeatability and accuracy are greatly affected by the illumination. Excessive or weak illumination can cause errors in image measurement and even lead to measurement failure. In addition, when photographing the workpiece, splicing the image, and focusing the focus, proper illumination acquisition can make the surface image of the workpiece clear and rich in detail.

在影像測量過程中,傳統的測量方法一般是透過測量人員手動完成光源的調節,例如,在手動調節環光到最大值後仍不滿足要求時,再手動調節同軸光,過程繁瑣且容易產生主觀誤差。而且,手動調節所記錄的測量程式中的調節語句為固定值,對不同的影像測量機台,尤其是獲取表面影像需要的光照相差較大的機台, 該測量程式不具有通用性。 In the image measurement process, the traditional measurement method generally performs the adjustment of the light source manually by the measuring personnel. For example, when the manual adjustment of the ring light to the maximum value is still not satisfactory, the manual adjustment of the coaxial light is cumbersome and subjective. error. Moreover, manually adjusting the adjustment statement in the recorded measurement program to a fixed value, and for different image measuring machines, in particular, a machine having a large photogrammetry difference for obtaining a surface image, This measurement program is not versatile.

鑒於以上內容,有必要提供一種光照調節方法及其電腦系統,可提高影像測量的重複性與精度,避免人為調節所產生的誤差,降低勞動強度,使得影像測量程式更通用。 In view of the above, it is necessary to provide a light adjustment method and a computer system thereof, which can improve the repeatability and precision of image measurement, avoid the error caused by artificial adjustment, reduce the labor intensity, and make the image measurement program more versatile.

一種光照調節電腦系統,該電腦系統包括選取單元和光照調節單元。該選取單元用於選取待調節光的類型及選擇調節光照的方式,其中,所述待調節光的類型包括環光和同軸光,調節光照的方式包括清晰度的方式和灰度值的方式。所述光照調節單元用於當選取單元選擇清晰度的方式進行光照調節時,將影像測量機台的光照等級調整到一個初始等級後增加或降低光照等級,透過比對不同光照等級下工件的表面影像的平均清晰度,以調節出最佳光照所對應的等級。該光照調節單元還用於當選取單元選擇灰度值的方式進行光照調節時,設置光照調節過程中所涉及到的變數,並根據所述變數計算出工件的表面影像對應的最佳光照的等級。 A lighting adjustment computer system includes a selection unit and a light adjustment unit. The selecting unit is configured to select a type of light to be adjusted and a manner of selecting a light to be adjusted, wherein the type of the light to be adjusted includes ring light and coaxial light, and the manner of adjusting the light includes a manner of sharpness and a method of gray value. The illumination adjustment unit is configured to adjust the illumination level of the image measuring machine to an initial level and increase or decrease the illumination level when the selection unit selects the resolution to perform illumination adjustment, and compares the surface of the workpiece under different illumination levels. The average sharpness of the image to adjust the level of optimal illumination. The illumination adjustment unit is further configured to set a variable involved in the illumination adjustment process when the selection unit selects the gray value to perform the illumination adjustment, and calculate the optimal illumination level corresponding to the surface image of the workpiece according to the variable. .

一種光照調節方法,運行於電腦中,該電腦與一台影像測量機台相連。該方法包括:從影像測量機台獲取量測工件所得到的表面影像;在該表面影像中截取待調節光照的區域;選取待調節光的類型及選擇調節光照的方式;及根據所選取的待調節光的類型及調節光照的方式對上述區域進行光照調節。 A method of adjusting illumination, running in a computer, connected to an image measuring machine. The method comprises: obtaining a surface image obtained by measuring a workpiece from an image measuring machine; intercepting an area of the surface to be adjusted in the surface image; selecting a type of light to be adjusted and selecting a method for adjusting the illumination; and selecting the to-be-selected Adjust the light type and adjust the light to adjust the above areas.

相較於習知技術,所述光照調節方法及其電腦系統,能夠快速地將獲取工件的表面影像的光照調節到最佳值,並自動計算光照的強度,提高了影像測量的重複性與精度,避免了人為調節所產生的誤差,降低了勞動強度,使得影像測量程式更通用。 Compared with the prior art, the illumination adjustment method and the computer system thereof can quickly adjust the illumination of the surface image of the workpiece to the optimal value, and automatically calculate the intensity of the illumination, thereby improving the repeatability and accuracy of the image measurement. It avoids the error caused by artificial adjustment, reduces the labor intensity, and makes the image measurement program more versatile.

1‧‧‧影像測量機台 1‧‧‧Image measuring machine

2‧‧‧工件 2‧‧‧Workpiece

3‧‧‧電腦 3‧‧‧ computer

10‧‧‧光源調節器 10‧‧‧Light source regulator

12‧‧‧電荷耦合裝置 12‧‧‧Charge-coupled device

30‧‧‧光照調節系統 30‧‧‧Lighting adjustment system

300‧‧‧選取單元 300‧‧‧Selection unit

302‧‧‧影像處理單元 302‧‧‧Image Processing Unit

304‧‧‧光照調節單元 304‧‧‧Lighting adjustment unit

S30‧‧‧在工件的影像中截取需調節光照的區域 S30‧‧‧ Intercepting the area where the illumination needs to be adjusted in the image of the workpiece

S32‧‧‧選擇待調節光的類型 S32‧‧‧Select the type of light to be adjusted

S34‧‧‧對所選擇的待調節光的類型進行光照調節 S34‧‧‧Lighting adjustment of the type of light to be adjusted

S36‧‧‧在上述光照調節失敗後選擇其他類型的光並對其進行光照調節 S36‧‧‧Select other types of light and adjust the light after the above lighting adjustment fails

圖1係本發明光照調節電腦系統較佳實施例之運行環境圖。 1 is a diagram showing the operating environment of a preferred embodiment of the illumination adjustment computer system of the present invention.

圖2係本發明光照調節系統之功能單元圖。 Figure 2 is a functional unit diagram of the illumination adjustment system of the present invention.

圖3係本發明光照調節方法較佳實施例之作業流程圖。 Figure 3 is a flow chart showing the operation of the preferred embodiment of the illumination adjustment method of the present invention.

圖4係圖3中通過調節清晰度的方式來調節環光之作業流程圖。 Figure 4 is a flow chart showing the operation of adjusting the ring light by adjusting the sharpness in Figure 3.

圖5係圖3中通過調節灰度值的方式來調節環光之作業流程圖。 Figure 5 is a flow chart showing the operation of adjusting the ring light by adjusting the gray value in Figure 3.

圖6係圖5步驟S506中利用迭代逼近法計算最佳環光對應的等級之具體作業流程圖。 FIG. 6 is a specific operation flowchart of calculating the level corresponding to the optimal ring light by the iterative approximation method in step S506 of FIG. 5.

參閱圖1所示,係本發明光照調節電腦系統較佳實施例之運行環境圖。該運行環境圖包括影像測量機台1、被影像測量機台1測量的工件2及與該影像測量機台1相連的電腦3。所述影像測量機台1可以是型號為“VMS”系列的影像量測儀,其包括光源調節器10和電荷耦合裝置12。該電荷耦合裝置12用於對工件2進行成像,而光源調節器10可用於調節工件2成像時影像測量機台1所發出的環光和同軸光的光照強度。在本實施例中,該成像是指獲取工件2的表面影像。電腦3內儲存一個光照調節系統30用於控制光源調節器10,以進行光照調節。 Referring to Figure 1, there is shown an operational environment diagram of a preferred embodiment of the illumination adjustment computer system of the present invention. The operating environment map includes an image measuring machine 1, a workpiece 2 measured by the image measuring machine 1, and a computer 3 connected to the image measuring machine 1. The image measuring machine 1 may be an image measuring instrument of the "VMS" series, which includes a light source adjuster 10 and a charge coupled device 12. The charge coupled device 12 is used to image the workpiece 2, and the light source adjuster 10 can be used to adjust the illumination intensity of the ring light and the coaxial light emitted by the image measuring machine 1 when the workpiece 2 is imaged. In the present embodiment, the imaging refers to acquiring a surface image of the workpiece 2. A light adjustment system 30 is stored in the computer 3 for controlling the light source adjuster 10 for illumination adjustment.

在本實施例中,無論是環光還是同軸光,光源調節器10均利用“0~100”個等級來調節其光照的強弱,根據工件2的顏色及工件2所放置的背景顏色,每個等級對應一個光照的強度。也就是說,不同工件2或相同工件2放置在不同背景中,同一個等級所示意的光照的強度可能會不同。 In this embodiment, whether it is ring light or coaxial light, the light source adjuster 10 uses "0~100" levels to adjust the intensity of the light, according to the color of the workpiece 2 and the background color placed on the workpiece 2, each The level corresponds to the intensity of one light. That is to say, different workpieces 2 or the same workpiece 2 are placed in different backgrounds, and the intensity of the illumination indicated by the same level may be different.

另外,本實施例中的光照調節系統30可透過兩種方式對上述表面影像的光照進行調節:清晰度的方式和灰度值的方式。其中,按照清晰度的方式對光照進行調節一般用於對焦的光照調節,而按照灰度值的方式對光照進行調節一般用於獲取工件2的表面影像時的光照調節。在按照灰度值的方式進行光照強度調節時,該光照強度具體是指環光或同軸光的亮度。眾所週知,影像的灰度值範圍為0~255。當光源調節器10被調整到0等級時,工件2的影像必定為黑色,即影像的灰度值為0,光照強度低;而當光源調節器10被調整到100等級時,工件2的影像為白色,即影像的灰度值為255,光照強度高。 In addition, the illumination adjustment system 30 in this embodiment can adjust the illumination of the surface image in two ways: the manner of sharpness and the manner of gray value. Among them, the adjustment of the illumination according to the definition is generally used for the illumination adjustment of the focus, and the adjustment of the illumination according to the gray value is generally used for the illumination adjustment when acquiring the surface image of the workpiece 2. When the illumination intensity is adjusted according to the gradation value, the illumination intensity specifically refers to the brightness of the ring light or the coaxial light. As we all know, the gray value of the image ranges from 0 to 255. When the light source adjuster 10 is adjusted to the 0 level, the image of the workpiece 2 must be black, that is, the gray value of the image is 0, and the light intensity is low; and when the light source adjuster 10 is adjusted to the 100 level, the image of the workpiece 2 It is white, that is, the gray value of the image is 255, and the light intensity is high.

參閱圖2所示,係本發明光照調節系統30之功能單元圖。該光照調節系統30為電腦程式,按照功能可劃分為選取單元300、影像處理單元302和光照調節單元304,其功能可透過圖4和圖5所述的流程圖進行具體描述。 Referring to Figure 2, there is shown a functional unit diagram of the illumination adjustment system 30 of the present invention. The illumination adjustment system 30 is a computer program, and can be divided into a selection unit 300, an image processing unit 302, and a light adjustment unit 304 according to functions. The functions of the illumination adjustment system 30 can be specifically described through the flowcharts shown in FIG. 4 and FIG.

參閱圖3所示,係本發明光照調節方法較佳實施例之作業流程圖。 Referring to Figure 3, there is shown a flow chart of a preferred embodiment of the illumination adjustment method of the present invention.

步驟S30,電荷耦合裝置12對工件2進行成像,獲取該工件2的表面影像,用戶利用選取單元300從該表面影像中截取需調節光照的區域。 In step S30, the charge coupled device 12 images the workpiece 2 to acquire a surface image of the workpiece 2. The user uses the selection unit 300 to intercept an area of the surface image from which the illumination needs to be adjusted.

如上所述,本實施例中的光照調節包括環光調節和同軸光調節,因此,步驟S32,選取單元300從該兩種光照調節類型中選取一種待調節光的類型,如選取環光調節,並選擇調節光照的方式。 As described above, the illumination adjustment in this embodiment includes ring light adjustment and coaxial light adjustment. Therefore, in step S32, the selection unit 300 selects a type of light to be adjusted from the two types of illumination adjustments, such as selecting ring light adjustment. And choose how to adjust the lighting.

步驟S34,光照調節單元304根據步驟S32中所選擇的待調節光的 類型與調節光照的方式進行光照調節。本實施例中的光照調節方式將在圖4和圖5中進行詳細描述。 Step S34, the light adjustment unit 304 is based on the light to be adjusted selected in step S32. The type is adjusted with the way the light is adjusted. The illumination adjustment mode in this embodiment will be described in detail in FIGS. 4 and 5.

步驟S36,當步驟S32中所選取的待調節光調節失敗後,選取單元300可從上述兩種光照類型中選擇另外一種光照類型作為待調節光的類型,如同軸光調節,並對其進行光照調節。 In step S36, after the adjustment of the light to be adjusted selected in step S32 fails, the selecting unit 300 may select another illumination type from the above two illumination types as the type of the light to be adjusted, such as coaxial light adjustment, and illuminate the light. Adjustment.

其中,本實施例在選擇光照類型時不受上述選擇的限制,也就是說,可以於步驟S32中先選擇同軸光調節,然後於步驟S36中選擇環光調節。而本實施例中的光照類型可以不限於上述兩種類型,還可以為其他類型的光源。 Wherein, the embodiment is not limited by the above selection when selecting the illumination type, that is, the coaxial light adjustment may be selected first in step S32, and then the ring light adjustment is selected in step S36. However, the type of illumination in this embodiment may not be limited to the above two types, and may be other types of light sources.

另外,本實施例可以透過清晰度的方式和灰度值的方式對工件2的表面影像進行光照調節。其中,同軸光的調節方法和環光的調節方法相同。本實施例將以環光調節為例,透過圖4和圖5對這兩種方式進行具體描述:參閱圖4所示,係圖3中透過調節清晰度的方式來調節環光之作業流程圖。利用清晰度的方式進行環光調節是指:將影像測量機台1的光照等級調整到一個初始等級後增加或降低光照等級,透過比對不同光照等級下工件2的表面影像的平均清晰度,以調節出最佳環光所對應的等級。具體步驟如下:步驟S400,用戶透過手動調節光源調節器10,使得影像測量機台1的環光被調整到一個初始等級Vo,獲取該初始等級Vo下的影像,並計算所截取區域的影像的平均清晰度Do。本實施例中,在該初始等級Vo下的影像為用戶可識別的影像,本較佳實施例中的初始等級Vo為“5等級”。 In addition, in this embodiment, the surface image of the workpiece 2 can be adjusted in illumination by means of sharpness and gray scale values. Among them, the method of adjusting the coaxial light is the same as the method of adjusting the ring light. In this embodiment, the ring light adjustment is taken as an example, and the two modes are specifically described through FIG. 4 and FIG. 5. Referring to FIG. 4, the flow chart of adjusting the ring light by adjusting the sharpness in FIG. 3 is shown. . The use of the definition of the ring light adjustment means that the illumination level of the image measuring machine 1 is adjusted to an initial level to increase or decrease the illumination level, and the average sharpness of the surface image of the workpiece 2 under different illumination levels is compared. To adjust the level corresponding to the best ring light. The specific steps are as follows: in step S400, the user manually adjusts the light source adjuster 10 so that the ring light of the image measuring machine 1 is adjusted to an initial level Vo, acquires an image of the initial level Vo, and calculates an image of the intercepted area. Average clarity Do. In this embodiment, the image at the initial level Vo is a user-recognizable image, and the initial level Vo in the preferred embodiment is “5 levels”.

步驟S402,光照調節單元304在上一次所調等級的基礎上,將該光照等級增加10個等級,獲取該等級下的影像,並計算所截取區域的影像的平均清晰度D1。 In step S402, the illumination adjustment unit 304 increases the illumination level by 10 levels on the basis of the last adjusted level, acquires the image under the level, and calculates the average sharpness D1 of the image of the intercepted area.

步驟S404,判斷當前的光照等級是否大於100。若判斷的結果為是,則進入步驟S408;若判斷的結果為否,則進入步驟S406。 In step S404, it is determined whether the current illumination level is greater than 100. If the result of the determination is YES, the process proceeds to step S408; if the result of the determination is no, the process proceeds to step S406.

步驟S406,判斷所述平均清晰度D1是否大於Do。若判斷的結果為是,則轉入步驟S402,將光照等級再增加10個等級。否則,若判斷的結果為否,則進入步驟S408。 In step S406, it is determined whether the average sharpness D1 is greater than Do. If the result of the determination is YES, the process proceeds to step S402, and the illumination level is further increased by 10 levels. Otherwise, if the result of the determination is no, the process proceeds to step S408.

步驟S408,將該光照等級減少5個等級,獲取該等級下的影像,並計算所截取區域的影像的平均清晰度Dn。 In step S408, the illumination level is reduced by 5 levels, the image under the level is acquired, and the average sharpness Dn of the image of the intercepted area is calculated.

步驟S410,在步驟S408所調等級的基礎上,將光照等級增加2個等級,獲取該等級下的影像,並計算所截取區域的影像的平均清晰度Dn`。 In step S410, based on the level adjusted in step S408, the illumination level is increased by two levels, the image under the level is acquired, and the average sharpness Dn' of the image of the intercepted area is calculated.

步驟S412,判斷上述平均清晰度Dn`是否大於Dn。若判斷的結果為是,則返回步驟S410將光照等級再增加2個等級並獲取影像;否則,若判斷的結果為否,則進入步驟S414。 In step S412, it is determined whether the average sharpness Dn' is greater than Dn. If the result of the determination is YES, then returning to step S410, the illumination level is further increased by 2 levels and the image is acquired; otherwise, if the result of the determination is no, the process proceeds to step S414.

步驟S414,判斷光照的當前等級是否等於100。 In step S414, it is determined whether the current level of illumination is equal to 100.

若當前等級不等於100,則步驟S416,光照調節單元304確定此次環光調節成功,也就是說,此時,光照的當前等級為最佳環光對應的等級。 If the current level is not equal to 100, then in step S416, the illumination adjusting unit 304 determines that the ring light adjustment is successful, that is, at this time, the current level of the illumination is the level corresponding to the optimal ring light.

若當前等級等於100,則步驟S418,光照調節單元304確定此次環光調節失敗。 If the current level is equal to 100, then in step S418, the illumination adjustment unit 304 determines that the ring light adjustment failed this time.

參閱圖5所示,係圖3中透過調節灰度值的方式來調節環光之作業流程圖。利用灰度值的方式進行光照調節是指:根據設置的環光調節過程中所涉及到的變數,計算出所述工件2的表面影像對應的最佳環光的等級。如下述步驟:步驟S500,光照調節單元304將影像測量機台1的環光調整到一個初始等級。在本實施例中,該初始等級不可能太低或太高,於該初始等級下的影像一定為用戶可識別的影像,例如,其不可能為“0等級”或“100等級”,本較佳實施例中的初始等級為“10等級”。 Referring to FIG. 5, a flow chart of adjusting the ring light by adjusting the gray value in FIG. 3 is shown. The illumination adjustment by means of the gradation value means that the level of the optimal ring light corresponding to the surface image of the workpiece 2 is calculated according to the variables involved in the set ring light adjustment process. As follows: Step S500, the light adjustment unit 304 adjusts the ring light of the image measuring machine 1 to an initial level. In this embodiment, the initial level may not be too low or too high, and the image at the initial level must be a user-recognizable image, for example, it may not be “0 level” or “100 level”. The initial level in the preferred embodiment is "10 levels."

步驟S502,影像處理單元302獲取該初始等級下所截取區域的影像,並對該影像進行平均值過濾和二值化處理,以減少或消除影像雜訊的影響,改善影像的品質,使得工件2的影像能夠感應環光,也就是說,處理後的影像的灰度值可隨著環光的強弱而改變。其中,所述二值化處理是指將一幅多個灰度級的影像轉化為只有兩個灰度級的影像,以便於特徵的突出以及圖形的識別,處理後的影像為黑白色,即灰度值為0和255。 Step S502, the image processing unit 302 acquires an image of the intercepted area under the initial level, and performs average filtering and binarization processing on the image to reduce or eliminate the influence of image noise, improve image quality, and make the workpiece 2 The image can sense the ring light, that is, the gray value of the processed image can change with the intensity of the ring light. The binarization process refers to converting a plurality of grayscale images into images having only two gray levels, so as to facilitate feature highlighting and graphic recognition, and the processed image is black and white, that is, Gray values are 0 and 255.

步驟S504,光照調節單元304設置環光調節過程中所涉及到的變數,該變數包括最佳光照對應的等級Vp的上臨近等級Vm、下臨近等級Vn及當前等級Vc。 In step S504, the illumination adjusting unit 304 sets a variable involved in the ring light adjustment process, and the variable includes an upper adjacent level Vm, a lower adjacent level Vn, and a current level Vc of the level Vp corresponding to the optimal illumination.

步驟S506,光照調節單元304根據上述變數利用迭代逼近法計算出所述處理後的影像的最佳光照所對應的等級Vp。 In step S506, the illumination adjusting unit 304 calculates the level Vp corresponding to the optimal illumination of the processed image by using the iterative approximation method according to the above variable.

步驟S508,光照調節單元304根據所計算出的等級Vp自動調節影像測量機台1的環光。 In step S508, the illumination adjusting unit 304 automatically adjusts the ring light of the image measuring machine 1 according to the calculated level Vp.

參閱圖6,係步驟S506中的利用迭代逼近法計算等級Vp之具體作業流程圖。 Referring to Fig. 6, a specific operation flow chart for calculating the level Vp by the iterative approximation method in step S506 is shown.

步驟S600,光照調節單元304初始化環光調節過程中所涉及到的各變數,即設置所述上臨近等級Vm=100,下臨近等級Vn=2。 In step S600, the illumination adjusting unit 304 initializes the variables involved in the ring light adjustment process, that is, sets the upper adjacent level Vm=100, and the lower adjacent level Vn=2.

步驟S602,將光照當前等級Vc調節至Vc=(Vm+Vn)/2,獲取該當前等級Vc下的影像,並計算影像的灰度值Gc。具體而言,光照調節單元304獲取影像中每個圖元的灰度,將所有圖元的灰度相加,然後除以圖元的總個數所得到的值就是影像的灰度值Gc。在影像的數位化處理過程中,影像資料是未壓縮的,其透過連續的記憶體區域進行保存,通常,影像中每個圖元的灰度值可透過指針進行存取,例如,若寬為W,高為H的8位元灰度影像的影像資料的第一個圖元位址為pixel,則第(i,j)個圖元的灰度值可以透過“pixel[j*W+i]”或“*(pixel+j*W+i)”進行讀取。 In step S602, the illumination current level Vc is adjusted to Vc=(Vm+Vn)/2, the image under the current level Vc is acquired, and the gray value Gc of the image is calculated. Specifically, the illumination adjustment unit 304 acquires the gradation of each primitive in the image, adds the gradations of all the primitives, and then divides the total number of primitives to obtain the grayscale value Gc of the image. During the digitization process of the image, the image data is uncompressed, and is saved through a continuous memory area. Generally, the gray value of each primitive in the image can be accessed through the pointer, for example, if the width is W, the first primitive address of the image data of the 8-bit grayscale image with height H is pixel, and the gray value of the (i, j)th primitive can be transmitted through "pixel[j*W+i ]" or "*(pixel+j*W+i)" for reading.

步驟S604,判斷灰度值Gc是否小於所述最佳光照下影像的灰度值Gp。該灰度值Gp可取0~255的中間值。在本較佳實施例中,Gp取125。若Gc<Gp,則進入步驟S606;若Gc>Gp,則進入步驟S608;若Gc=Gp,則進入步驟S612。 In step S604, it is determined whether the gradation value Gc is smaller than the gradation value Gp of the image under the optimal illumination. The gray value Gp can take an intermediate value of 0 to 255. In the preferred embodiment, Gp takes 125. If Gc < Gp, the process proceeds to step S606; if Gc > Gp, the process proceeds to step S608; if Gc = Gp, the process proceeds to step S612.

於步驟S606,光照調節單元304以當前等級Vc為下臨近等級,即使得Vn=Vc,然後進入步驟S610。 In step S606, the illumination adjusting unit 304 takes the current level Vc as the next adjacent level, that is, makes Vn=Vc, and then proceeds to step S610.

於步驟S608,光照調節單元304以當前等級Vc為上臨近等級,即使得Vm=Vc,然後進入步驟S610。 In step S608, the illumination adjusting unit 304 takes the current level Vc as the upper adjacent level, that is, makes Vm=Vc, and then proceeds to step S610.

步驟S610,光照調節單元304比對當前的上臨近等級Vm與當前的下臨近等級Vn之差(Vm-Vn)是否小於一個最佳預定值Vo。本較 佳實施例中,該最佳預定值Vo等於2。 In step S610, the illumination adjusting unit 304 compares whether the difference (Vm-Vn) between the current upper adjacent level Vm and the current lower adjacent level Vn is less than a optimal predetermined value Vo. This comparison In a preferred embodiment, the optimal predetermined value Vo is equal to two.

若(Vm-Vn)<Vo,則於步驟S612,光照調節單元304確認本次環光調節成功,並表明上述計算與調節後的等級為最佳光照所對應的等級Vp。 If (Vm - Vn) < Vo, then in step S612, the illumination adjusting unit 304 confirms that the current ring light adjustment is successful, and indicates that the above-mentioned calculation and the adjusted level are the level Vp corresponding to the optimal illumination.

反之,若Vm-Vn>=2,則返回步驟S602,以當前的上臨近等級Vm與當前的下臨近等級Vn為計算條件調用迭代逼近公式Vc=(Vm+Vn)/2重新進行計算與調節。例如,若步驟S602中計算出的灰度值為Gc1,則光照調節單元304還需透過當前的上臨近等級Vm與當前的下臨近等級Vn計算出Vc2,然後獲取等級為Vc2的影像的灰度值Gc2,重複執行步驟S604至步驟S612,直到計算與調節出最佳光照所對應的等級Vp為止。 On the other hand, if Vm-Vn>=2, the process returns to step S602, and the current upper adjacent level Vm and the current lower adjacent level Vn are used as calculation conditions to call the iterative approximation formula Vc=(Vm+Vn)/2 to recalculate and adjust. . For example, if the gradation value calculated in step S602 is Gc1, the illumination adjustment unit 304 further calculates Vc2 from the current upper adjacent level Vm and the current lower adjacent level Vn, and then acquires the gradation of the image of the level Vc2. The value Gc2 is repeatedly executed in steps S604 to S612 until the level Vp corresponding to the optimum illumination is calculated.

本發明雖以較佳實施例揭露如上,然其並非用以限定本發明。任何熟悉此項技藝之人士,在不脫離本發明之精神及範圍內,當可做更動與潤飾,因此本發明之保護範圍當視後附之申請專利範圍所界定者為準。 The present invention has been described above in terms of preferred embodiments, and is not intended to limit the invention. Any person skilled in the art will be able to make changes and refinements without departing from the spirit and scope of the invention, and the scope of the invention is defined by the scope of the appended claims.

S30‧‧‧在工件的影像中截取需調節光照的區域 S30‧‧‧ Intercepting the area where the illumination needs to be adjusted in the image of the workpiece

S32‧‧‧選擇待調節光的類型 S32‧‧‧Select the type of light to be adjusted

S34‧‧‧對所選擇的待調節光的類型進行光照調節 S34‧‧‧Lighting adjustment of the type of light to be adjusted

S36‧‧‧在上述光照調節失敗後選擇其他類型的光並對其進行光照調節 S36‧‧‧Select other types of light and adjust the light after the above lighting adjustment fails

Claims (9)

一種光照調節方法,運行於電腦中,該電腦與一台影像測量機台相連,該方法包括:從影像測量機台獲取量測工件所得到的表面影像;在該表面影像中截取待調節光照的區域;選取待調節光的類型及選擇調節光照的方式;根據所選取的待調節光的類型及調節光照的方式對上述區域進行光照調節;當選擇調節光照的方式為灰度值調節時,所述光照調節的步驟包括:將光照調節到一個初始等級;獲取該初始等級下需調節光照的區域的影像,並對該影像進行平均值過濾和二值化處理;設置光照調節過程中所涉及到的變數;根據上述變數計算所述影像的最佳光照對應的等級;及根據所計算出的等級自動調節光照。 A method for adjusting illumination, running in a computer, the computer being connected to an image measuring machine, the method comprising: obtaining a surface image obtained by measuring the workpiece from the image measuring machine; and intercepting the light to be adjusted in the surface image Area; select the type of light to be adjusted and select the mode of adjusting the illumination; adjust the illumination according to the selected type of light to be adjusted and the way of adjusting the illumination; when the method of adjusting the illumination is adjusted for the gray value, The step of adjusting the illumination includes: adjusting the illumination to an initial level; acquiring an image of the area where the illumination needs to be adjusted at the initial level, and performing average filtering and binarization on the image; setting the process involved in the illumination adjustment a variable; a level corresponding to the optimal illumination of the image is calculated based on the above variables; and the illumination is automatically adjusted based on the calculated level. 如申請專利範圍第1項所述的光照調節方法,其中所述待調節光的類型包括環光和同軸光。 The illumination adjustment method of claim 1, wherein the type of the light to be modulated comprises ring light and coaxial light. 如申請專利範圍第2項所述的光照調節方法,其中,當選擇調節光照的方式為清晰度調節時,所述光照調節的步驟包括:(a)將光照等級調整到一個初始等級,獲取影像並計算影像的平均清晰度Do;(b)將光照等級增加10個等級,獲取影像並計算影像的平均清晰度D1;(c)當所述平均清晰度D1大於Do時,返回步驟(b)將光照等級再增加 10個等級,然後將該再增加10個等級後的影像的平均清晰度與上一次所調等級下的影像的平均清晰度進行比較;(d)當所述平均清晰度D1不大於Do時,將光照等級減少5個等級,獲取影像並計算影像的平均清晰度Dn;(e)在步驟(d)的基礎上,將光照等級增加2個等級,獲取影像並計算影像的平均清晰度Dn`;(f)當所述平均清晰度Dn、大於Dn時,返回步驟(e)將光照等級再增加2個等級並獲取影像;(g)當所述平均清晰度Dn`不大於Dn且當前光照等級不等於100,表明光照調節成功且該當前光照等級為最佳光照所對應的等級;及(h)當所述平均清晰度Dn`不大於Dn且當前光照等級等於100時,表明光照調節失敗。 The illumination adjustment method of claim 2, wherein when the manner of adjusting the illumination is selected as the sharpness adjustment, the step of adjusting the illumination comprises: (a) adjusting the illumination level to an initial level, and acquiring the image. And calculate the average sharpness of the image Do; (b) increase the illumination level by 10 levels, acquire the image and calculate the average sharpness D1 of the image; (c) when the average sharpness D1 is greater than Do, return to step (b) Increase the light level 10 levels, then compare the average sharpness of the image after adding another 10 levels with the average sharpness of the image at the last adjusted level; (d) when the average sharpness D1 is not greater than Do, Reduce the illumination level by 5 levels, acquire the image and calculate the average sharpness Dn of the image; (e) on the basis of step (d), increase the illumination level by 2 levels, acquire the image and calculate the average sharpness of the image Dn. (f) when the average sharpness Dn is greater than Dn, return to step (e) to increase the illumination level by another 2 levels and acquire an image; (g) when the average sharpness Dn' is not greater than Dn and current illumination The level is not equal to 100, indicating that the lighting adjustment is successful and the current lighting level is the level corresponding to the optimal lighting; and (h) when the average sharpness Dn` is not greater than Dn and the current lighting level is equal to 100, indicating that the lighting adjustment fails . 如申請專利範圍第3項所述的光照調節方法,該方法在步驟(b)與步驟(c)之間包括如下步驟:判斷光照等級是否大於100;若判斷的結果為是,則進入步驟(d);及若判斷的結果為否,則進入步驟(c)。 The light adjustment method according to claim 3, wherein the method includes the following steps between the step (b) and the step (c): determining whether the illumination level is greater than 100; if the result of the determination is yes, proceeding to the step ( d); and if the result of the determination is no, proceed to step (c). 如申請專利範圍第3項所述的光照調節方法,其中所述光照的等級包括0~100個等級,其中,所述初始等級介於0~100個等級之間。 The illumination adjustment method of claim 3, wherein the level of illumination comprises 0 to 100 levels, wherein the initial level is between 0 and 100 levels. 申請專利範圍第2項所述的光照調節方法,其中所述步驟根據上述變數計算出所述影像的最佳光照對應的等級包括以下步驟:(A)初始化各變數,該變數包括最佳光照對應的等級的上臨近等級Vm和下臨近等級Vn,即使得該上臨近等級Vm=100,下臨近等級Vn=2;(B)將光照等級調節至Vc=(Vm+Vn)/2;(C)獲取該等級Vc下的影像及該影像的灰度值Gc; (D)判斷該灰度值Gc是否小於所述最佳光照下的影像的灰度值Gp,其中,Gp可取0~255的中間值;(E)若Gc<Gp,則以所述等級Vc為下臨近等級,即使得Vn=Vc,若Gc>Gp,則以所述等級Vc為上臨近等級,即使得Vm=Vc;(F)比較當前的上臨近等級Vm與下臨近等級Vn之差(Vm-Vn)是否小於一個最佳預定值V0,其中,V0=2;及(G)若Vm-Vn<V0,則表明上述計算與調節後的等級為最佳光照所對應的等級;及(H)若Vm-Vn>=V0,則返回步驟(B)。 The illumination adjustment method of claim 2, wherein the step of calculating a level corresponding to the optimal illumination of the image according to the variable includes the following steps: (A) initializing each variable, the variable including an optimal illumination corresponding The upper level of the level Vm and the lower adjacent level Vn, that is, the upper adjacent level Vm=100, the next adjacent level Vn=2; (B) the light level is adjusted to Vc=(Vm+Vn)/2; Obtaining an image of the level Vc and a gray value Gc of the image; (D) determining whether the gray value Gc is smaller than the gray value Gp of the image under the optimal illumination, wherein Gp may take an intermediate value of 0 to 255; (E) if Gc < Gp, the level Vc For the next adjacent level, that is, let Vn=Vc, if Gc>Gp, then the level Vc is the upper adjacent level, that is, make Vm=Vc; (F) compare the difference between the current upper adjacent level Vm and the lower adjacent level Vn. Whether (Vm-Vn) is less than a best predetermined value V0, wherein V0=2; and (G) if Vm-Vn<V0, indicating that the above calculation and the adjusted level are the levels corresponding to the optimal illumination; (H) If Vm-Vn>=V0, return to step (B). 申請專利範圍第6項所述的光照調節方法,其中所述步驟(D)還包括步驟:若Gc=Gp,則表明調節成功。 The illumination adjustment method of claim 6, wherein the step (D) further comprises the step of: if Gc=Gp, indicating that the adjustment is successful. 一種光照調節電腦系統,該電腦系統包括:選取單元,用於選取待調節光的類型及選擇調節光照的方式,其中,所述待調節光的類型包括環光和同軸光,調節光照的方式包括清晰度的方式和灰度值的方式;光照調節單元,用於當選取單元選擇清晰度的方式進行光照調節時,將影像測量機台的光照等級調整到一個初始等級後增加或降低光照等級,通過比較不同光照等級下工件的表面影像的平均清晰度,以調節出最佳光照所對應的等級;所述光照調節單元還用於當選取單元選擇灰度值的方式進行光照調節時,設置光照調節過程中所涉及到的變數,並根據所述變數計算出所述工件的表面影像對應的最佳光照的等級;當選擇調節光照的方式為灰度值調節時,所述光照調節的步驟包括:將光照調節到一個初始等級;獲取該初始等級下需調節光照的區域的影像,並對該影像進行平均值過 濾和二值化處理;設置光照調節過程中所涉及到的變數;根據上述變數計算所述影像的最佳光照對應的等級;及根據所計算出的等級自動調節光照。 A lighting adjustment computer system, comprising: a selecting unit, configured to select a type of light to be adjusted and a method of selecting an adjustment light, wherein the type of the light to be adjusted comprises ring light and coaxial light, and the method for adjusting illumination comprises The mode of sharpness and the way of gray value; the light adjusting unit is used to adjust the light level of the image measuring machine to an initial level and then increase or decrease the light level when the light is adjusted by selecting the unit to select the sharpness. By comparing the average sharpness of the surface image of the workpiece under different illumination levels, the level corresponding to the optimal illumination is adjusted; the illumination adjustment unit is further configured to set the illumination when the selection unit selects the gray value to perform illumination adjustment. Adjusting the variables involved in the process, and calculating the optimal illumination level corresponding to the surface image of the workpiece according to the variable; when the mode of adjusting the illumination is grayscale value adjustment, the step of adjusting the illumination includes : Adjust the light to an initial level; obtain an image of the area where the light needs to be adjusted at the initial level And the average value over image Filtering and binarization processing; setting variables involved in the illumination adjustment process; calculating a level corresponding to the optimal illumination of the image according to the above variables; and automatically adjusting the illumination according to the calculated level. 申請專利範圍第8項所述的電腦系統,還包括一個影像處理單元,用於獲取初始等級下所截取區域的影像,並對需調節光照的區域的影像進行平均值過濾和二值化處理。 The computer system of claim 8 further includes an image processing unit configured to acquire an image of the region intercepted at the initial level, and perform average filtering and binarization processing on the image of the region to be adjusted.
TW97144112A 2008-11-14 2008-11-14 Computer system and method for adjusting lights TWI427271B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW97144112A TWI427271B (en) 2008-11-14 2008-11-14 Computer system and method for adjusting lights

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW97144112A TWI427271B (en) 2008-11-14 2008-11-14 Computer system and method for adjusting lights

Publications (2)

Publication Number Publication Date
TW201018872A TW201018872A (en) 2010-05-16
TWI427271B true TWI427271B (en) 2014-02-21

Family

ID=44831466

Family Applications (1)

Application Number Title Priority Date Filing Date
TW97144112A TWI427271B (en) 2008-11-14 2008-11-14 Computer system and method for adjusting lights

Country Status (1)

Country Link
TW (1) TWI427271B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200607987A (en) * 2004-07-12 2006-03-01 August Technology Corp Camera module for an optical inspection system and related method of use
TW200732650A (en) * 2006-02-07 2007-09-01 Hantech Co Ltd Apparatus and method for detecting defects in wafer using line sensor camera
TW200819770A (en) * 2006-10-17 2008-05-01 Machvision Inc Adjustable illumination apparatus and AOI system using the same

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200607987A (en) * 2004-07-12 2006-03-01 August Technology Corp Camera module for an optical inspection system and related method of use
TW200732650A (en) * 2006-02-07 2007-09-01 Hantech Co Ltd Apparatus and method for detecting defects in wafer using line sensor camera
TW200819770A (en) * 2006-10-17 2008-05-01 Machvision Inc Adjustable illumination apparatus and AOI system using the same

Also Published As

Publication number Publication date
TW201018872A (en) 2010-05-16

Similar Documents

Publication Publication Date Title
US8913127B2 (en) Calibration of imaging device for biological/chemical samples
RU2009140389A (en) DEVICE AND METHODS OF EXAMINATION, EVALUATION AND CLASSIFICATION OF PRECIOUS STONES
KR101284268B1 (en) Color lighting control method for improving image quality of vision system
US10234673B2 (en) Confocal microscope apparatus, stitched image construction method and computer-readable medium
CN101726247B (en) Light irradiation regulating method and computer system thereof
KR101694621B1 (en) Apparatus and method for estimating brightness using image sensor of auto exposure data
TWI427271B (en) Computer system and method for adjusting lights
KR101298974B1 (en) Apparatus and method for processing images through light sources control and image calibration
JP3305576B2 (en) Image quality measurement method
JP6570816B2 (en) Color headlight tester and light / dark branch line search method
JP2009058377A (en) Inspection apparatus
TWI427262B (en) Computer system and method for adjusting profile light
KR101653649B1 (en) 3D shape measuring method using pattern-light with uniformity compensation
KR101767174B1 (en) The pattern search method in controlling a mixed color light source for improving quality of wide images
TW201600223A (en) Tool inspection method and tool inspection device
KR101841528B1 (en) A method for controlling a mixed color light source for improving quality of wide images
JP6548879B2 (en) Color headlight tester and test method of headlight by color image processing
JP6649439B2 (en) Adjusting the light source
JP6991600B2 (en) Image measurement system, image measurement method, image measurement program and recording medium
JP7262800B2 (en) 3D image generation system, 3D image generation method, 3D image generation program, and recording medium
WO2022163002A1 (en) Imaging condition setting system, imaging condition setting method, and program
EP3835721A1 (en) A method for measuring a height map of a test surface
JPH11503892A (en) White adjustment method
KR20200006863A (en) Apparatus and method for measuring density of metal product using optical microscope image
CN118067735A (en) Detection method, detection device, detection equipment, detection system and storage medium

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees