TWI397668B - System and method for correcting an image - Google Patents
System and method for correcting an image Download PDFInfo
- Publication number
- TWI397668B TWI397668B TW96105029A TW96105029A TWI397668B TW I397668 B TWI397668 B TW I397668B TW 96105029 A TW96105029 A TW 96105029A TW 96105029 A TW96105029 A TW 96105029A TW I397668 B TWI397668 B TW I397668B
- Authority
- TW
- Taiwan
- Prior art keywords
- image
- measurement reference
- point
- reference point
- value
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims description 34
- 238000005259 measurement Methods 0.000 claims description 61
- 238000003702 image correction Methods 0.000 claims description 28
- 230000003287 optical effect Effects 0.000 claims description 22
- 238000003384 imaging method Methods 0.000 claims description 5
- 230000008878 coupling Effects 0.000 claims description 3
- 238000010168 coupling process Methods 0.000 claims description 3
- 238000005859 coupling reaction Methods 0.000 claims description 3
- 101150030337 CCD7 gene Proteins 0.000 description 9
- 238000010586 diagram Methods 0.000 description 7
- PCTMTFRHKVHKIS-BMFZQQSSSA-N (1s,3r,4e,6e,8e,10e,12e,14e,16e,18s,19r,20r,21s,25r,27r,30r,31r,33s,35r,37s,38r)-3-[(2r,3s,4s,5s,6r)-4-amino-3,5-dihydroxy-6-methyloxan-2-yl]oxy-19,25,27,30,31,33,35,37-octahydroxy-18,20,21-trimethyl-23-oxo-22,39-dioxabicyclo[33.3.1]nonatriaconta-4,6,8,10 Chemical compound C1C=C2C[C@@H](OS(O)(=O)=O)CC[C@]2(C)[C@@H]2[C@@H]1[C@@H]1CC[C@H]([C@H](C)CCCC(C)C)[C@@]1(C)CC2.O[C@H]1[C@@H](N)[C@H](O)[C@@H](C)O[C@H]1O[C@H]1/C=C/C=C/C=C/C=C/C=C/C=C/C=C/[C@H](C)[C@@H](O)[C@@H](C)[C@H](C)OC(=O)C[C@H](O)C[C@H](O)CC[C@@H](O)[C@H](O)C[C@H](O)C[C@](O)(C[C@H](O)[C@H]2C(O)=O)O[C@H]2C1 PCTMTFRHKVHKIS-BMFZQQSSSA-N 0.000 description 5
- 238000006243 chemical reaction Methods 0.000 description 5
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003321 amplification Effects 0.000 description 1
- 238000003199 nucleic acid amplification method Methods 0.000 description 1
Landscapes
- Image Processing (AREA)
Description
本發明涉及一種影像校正系統及方法。 The invention relates to an image correction system and method.
在精密影像量測中,標準工業電荷耦合裝置(Charge Coupled Device,簡稱CCD)搭配特殊的鏡頭可以得到高清晰影像,但由於CCD和鏡頭特性,拍攝到的影像與真實圖像在高誤差放大比例下相對比會有一定的變形,對精密量測結果有一定的影響。參閱圖1與圖2所示,分別為一線格圖形的實際圖像與透過標準CCD成像後的影像,可見圖2中的線格有一定的變形。為了克服這種機械造成的影像變形,需要提供一種可以對影像進行校正的方法。 In precision image measurement, the standard industrial charge coupled device (CCD) with a special lens can get high-definition images, but due to CCD and lens characteristics, the captured image and the real image are in high error amplification ratio. There will be a certain deformation in the lower relative ratio, which has a certain influence on the precision measurement results. Referring to FIG. 1 and FIG. 2, the actual image of the one-line grid pattern and the image imaged by the standard CCD are respectively visible, and the line grid in FIG. 2 is somewhat deformed. In order to overcome such mechanical image distortion, it is necessary to provide a method for correcting images.
鑒於以上內容,有必要提出一種影像校正系統及方法,其採用格線補正的方法,補償機械誤差,對影像進行校正。 In view of the above, it is necessary to propose an image correction system and method which uses a grid correction method to compensate for mechanical errors and correct images.
一種影像校正系統,包括電腦及影像量測機台。其中,所述電腦包括影像擷取卡,所述影像量測機台安裝有電荷耦合裝置,所述電荷耦合裝置搭配一個工業光學鏡頭,用於獲取待測工件的影像,並將該影像傳送至電腦的影像擷取卡中。所述電腦還包括:影像校正程式,用於對上述的待測工件的影像進行校正,該影像校正程式包括:偏差值計算模組,用於計算測量參考點的偏差值;及影像校正模組,用於根據上述計算的測量參考點的偏 差值對待測工件的影像上的點進行校正計算。 An image correction system includes a computer and an image measuring machine. The computer includes an image capture card, and the image measuring machine is equipped with a charge coupled device. The charge coupled device is coupled with an industrial optical lens for acquiring an image of the workpiece to be tested, and transmitting the image to the image. The image of the computer is captured in the card. The computer further includes: an image correction program for correcting the image of the workpiece to be tested, the image correction program comprising: a deviation value calculation module for calculating a deviation value of the measurement reference point; and an image correction module For the bias of the measurement reference point calculated according to the above The difference is calculated on the point on the image of the workpiece to be measured.
進一步的,所述的測量參考點是將所述的電荷耦合裝置搭配工業光學鏡頭的成像範圍分割成的多個方格圖形的格線交叉點;所述的測量參考點的偏差值是該測量參考點的實際值與測量值之差。 Further, the measurement reference point is a grid intersection of a plurality of grid patterns into which the charge coupling device is divided into an imaging range of the industrial optical lens; the deviation value of the measurement reference point is the measurement The difference between the actual value of the reference point and the measured value.
一種影像校正方法,其利用電腦對透過影像量測機台的電荷耦合裝置量測得到的待測工件的影像進行校正。該方法包括步驟:選擇所述影像上的一個點P0;將該點P0的機械座標轉換為所述電荷耦合裝置的座標;獲取距離該點P0最近的四個測量參考點;計算該點P0到上述四個測量參考點的距離D0,D1,D2,D3;獲取上述四個測量參考點的偏差值A0,A1,A2,A3;根據上述計算出的D0,D1,D2,D3及獲取的偏差值A0,A1,A2,A3計算該點P0的偏差值;及根據所述偏差值對該點P0進行校正計算。 An image correction method for correcting an image of a workpiece to be tested measured by a charge coupled device of an image measuring machine by a computer. The method includes the steps of: selecting a point P0 on the image; converting the mechanical coordinate of the point P0 to a coordinate of the charge coupled device; acquiring four measurement reference points closest to the point P0; calculating the point P0 to The distances D0, D1, D2, D3 of the above four measurement reference points; the deviation values A0, A1, A2, A3 of the above four measurement reference points are obtained; D0, D1, D2, D3 and the obtained deviations are calculated according to the above The values A0, A1, A2, A3 calculate the deviation value of the point P0; and perform correction calculation on the point P0 based on the deviation value.
進一步的,所述的測量參考點是將影像量測機台上的電荷耦合裝置搭配工業光學鏡頭的成像範圍分割成的多個方格圖形的格線交叉點。 Further, the measurement reference point is a grid intersection of a plurality of grid patterns into which the charge coupling device on the image measuring machine is divided into the imaging range of the industrial optical lens.
相較于習知技術,本發明所提供的影像校正系統及方法採用格線補正的方法,對影像進行補償校正,有效的消除或減少了機械本身的誤差影響。 Compared with the prior art, the image correction system and method provided by the present invention adopts a grid correction method to compensate and correct the image, thereby effectively eliminating or reducing the influence of the error of the machine itself.
參閱圖3所示,係本發明影像校正系統較佳實施例的硬體架構圖。該影像校正系統包括電腦1及放置待測工件5的 影像量測機台6。其中,所述影像量測機台6的Z軸上還安裝有用於採集連續影像的電荷耦合裝置(Charged Coupled Device,CCD)7,該CCD7裝有工業光學鏡頭。CCD7搭配所述工業光學鏡頭可以使待測工件5成像。進一步的,為了影像校正的需要,所述待測工件5的下方還要放置一個校正片4,其相當於一個帶有刻度的,且精度很高的直尺,可以用來量測待測工件5的實際長度。所述電腦1裝有影像擷取卡10及影像校正程式11。其中CCD7透過影像資料線與所述影像擷取卡10相連,將從影像量測機台6獲取的待測工件5的影像傳送到影像擷取卡10上,並顯示於電腦1的顯示屏幕(未示出)上。所述影像校正程式11主要用於對所獲取的待測工件5的影像進行校正計算。 Referring to Figure 3, there is shown a hardware architecture diagram of a preferred embodiment of the image correction system of the present invention. The image correction system includes a computer 1 and a workpiece 5 to be tested. Image measuring machine 6. The Z-axis of the image measuring machine 6 is further equipped with a Charged Coupled Device (CCD) 7 for collecting continuous images, and the CCD 7 is equipped with an industrial optical lens. The CCD 7 can be used to image the workpiece 5 to be tested in conjunction with the industrial optical lens. Further, for the purpose of image correction, a calibration piece 4 is placed under the workpiece 5 to be tested, which is equivalent to a scaled and highly accurate ruler, which can be used to measure the workpiece to be tested. The actual length of 5. The computer 1 is equipped with an image capture card 10 and an image correction program 11. The CCD 7 is connected to the image capturing card 10 through the image data line, and the image of the workpiece 5 to be tested acquired from the image measuring machine 6 is transmitted to the image capturing card 10 and displayed on the display screen of the computer 1 ( Not shown). The image correction program 11 is mainly used for performing correction calculation on the acquired image of the workpiece 5 to be tested.
參閱圖4所示,係圖3中影像校正程式11的功能模組圖。本發明所稱的各模組是所述影像校正程式11中完成特定功能的各個程式段,比程式本身更適合於描述軟體在電腦中的執行過程,因此本發明對軟體的描述都以模組描述。 Referring to FIG. 4, it is a functional module diagram of the image correction program 11 in FIG. Each module referred to in the present invention is a program segment of the image correction program 11 that performs a specific function, and is more suitable for describing the execution process of the software in the computer than the program itself. Therefore, the description of the software in the present invention is a module. description.
所述影像校正程式11主要包括:偏差值計算模組110及影像校正模組111。 The image correction program 11 mainly includes an offset value calculation module 110 and an image correction module 111.
所述偏差值計算模組110用於計算測量參考點的偏差值。本發明較佳實施例是採用格線補正的方法補正機械誤差,對影像進行校正的。所述格線補正是將CCD7與所述工業光學鏡頭分別在不同的物鏡與不同倍率下搭配組合,通常情況下,所述CCD7可以調節到1倍物鏡及2倍物鏡兩 種情況,而所述工業光學鏡頭可以有1倍倍率、2倍倍率及3倍倍率三種情況,於是CCD7與工業光學鏡頭可以有6種組合搭配使用,分別為:1倍物鏡搭配1倍倍率、1倍物鏡搭配2倍倍率、1倍物鏡搭配3倍倍率、2倍物鏡搭配1倍倍率、2倍物鏡搭配2倍倍率及2倍物鏡搭配3倍倍率。在每一種搭配組合情況下,將其可以成像的範圍分割成似圖2所示的方格,其中的格線交叉點即為影像校正的測量參考點。所述測量參考點的偏差值是該測量參考點的實際值(即實際座標值)與測量值(即測量座標值)之差。其中,每一組搭配組合情況下的測量參考點的偏差值都可以記錄在一個如圖7所示的表格對應的位置上。 The deviation value calculation module 110 is configured to calculate a deviation value of the measurement reference point. In a preferred embodiment of the present invention, the grid error is used to correct the mechanical error and correct the image. The grid line complements the CCD 7 and the industrial optical lens respectively under different objective lenses and different magnifications. In general, the CCD 7 can be adjusted to 1× objective lens and 2× objective lens. In this case, the industrial optical lens can be used in the case of 1x magnification, 2x magnification and 3x magnification, so the CCD7 can be used in combination with the industrial optical lens in six combinations: 1x objective lens with 1x magnification, 1x objective lens with 2x magnification, 1x objective with 3x magnification, 2x objective with 1x magnification, 2x objective with 2x magnification and 2x objective with 3x magnification. In the case of each combination, the range in which it can be imaged is divided into squares as shown in Fig. 2, where the intersection of the grid lines is the measurement reference point for image correction. The deviation value of the measurement reference point is the difference between the actual value of the measurement reference point (ie, the actual coordinate value) and the measured value (ie, the measured coordinate value). The deviation value of the measurement reference point in each group combination can be recorded in a position corresponding to the table shown in FIG. 7.
所述的影像校正模組111用於根據上述計算的測量參考點的偏差值對待測工件5的影像上的點進行校正計算。當對影像進行校正計算時,若該影像上的點正好落在格線交叉點即所述測量參考點上時,則可以直接利用所述表格中記錄的對應的偏差值對該點進行校正,即利用該點的測量值加上該點對應的記錄在所述表格中的偏差值計算出該點的實際值;若該影像上的點落在所述方格內部時,則透過距該點最近的四個格線交叉點計算出該點的偏移量,對該點進行校正,校正方法如下:首先找出距該點最近的四個格線交叉點;再計算出該點到上述四個格線交叉點的距離D0,D1,D2,D3;從上述表格中獲取所述四個格線交叉點的偏差值A0,A1,A2,A3;利用公式
計算出該點的偏差值A;最後利用該點的偏差值A加上該點的測量值計算出該點的實際值,完成對該點的校正。 Calculate the deviation value A of the point; finally, use the deviation value A of the point plus the measured value of the point to calculate the actual value of the point, and complete the correction of the point.
參閱圖5所示,係本發明影像校正方法較佳實施例中利用偏差值計算模組110計算測量參考點的偏差值的實施流程圖。 Referring to FIG. 5, it is a flowchart of an implementation of calculating the deviation value of the measurement reference point by using the deviation value calculation module 110 in the preferred embodiment of the image correction method of the present invention.
通常,在一台影像量測機台6生產出來,並將其上的元件(如CCD7等)固定之後,相關的校正工程師就會計算CCD7與工業光學鏡頭分別在不同的物鏡(1倍物鏡及2倍物鏡)與不同倍率(1倍倍率、2倍倍率及3倍倍率)搭配情況下的測量參考點的偏差值,並將每一組搭配情況下的測量參考點的偏差值對應的記錄在如圖7所示的表格中。本較佳實施例以1倍物鏡的CCD7搭配1倍倍率的工業光學鏡頭的情況為例說明,其實施步驟如下: Usually, after an image measuring machine 6 is produced and the components on it (such as CCD7, etc.) are fixed, the relevant calibration engineer will calculate the CCD7 and the industrial optical lens respectively in different objective lenses (1x objective lens and 2x objective lens) The deviation value of the measurement reference point in the case of a combination of different magnifications (1x magnification, 2x magnification, and 3x magnification), and the deviation value of the measurement reference point in each group of matching cases is recorded in In the table shown in Figure 7. The preferred embodiment is described by taking the case of a CCD 7 with a 1x objective lens and a 1x magnification industrial optical lens as an example. The implementation steps are as follows:
步驟S100,將CCD7調節到1倍物鏡及將工業光學鏡頭調節到1倍倍率,將其成像範圍分成似圖2所示的若干方格圖形。 In step S100, the CCD 7 is adjusted to a 1× objective lens and the industrial optical lens is adjusted to 1× magnification, and the imaging range thereof is divided into several square patterns as shown in FIG. 2 .
步驟S101,根據上述的方格圖形生成一個初始的表格,用於記錄各格線交叉點的偏差值。其中該表格內各偏差值的初始值為0。 In step S101, an initial table is generated according to the above-mentioned checkered pattern for recording the deviation value of each grid intersection. The initial value of each deviation value in the table is 0.
步驟S102,選擇一個格線交叉點作為測量參考點。 In step S102, a grid intersection is selected as the measurement reference point.
步驟S103,將該點的座標轉換為CCD7的座標。所述的轉換包括:座標系的轉換及單位的轉換。所述的座標系的轉換是將如圖3所示的機台6台面左上角標示的機械座標系轉換成以CCD7的中心為原點,X軸方向與上述機械座標系相同,且Y軸方向與上述機械座標系相反的座標系;所述單位的轉換是將機械座標系的尺寸單位以一個固定的比率值轉換為CCD7座標系的圖元單位。 In step S103, the coordinates of the point are converted into coordinates of the CCD 7. The conversion includes: conversion of coordinate systems and conversion of units. The coordinate system is converted by converting the mechanical coordinate system indicated by the upper left corner of the table 6 as shown in FIG. 3 to the center of the CCD 7, and the X-axis direction is the same as the mechanical coordinate system, and the Y-axis direction. The coordinate system opposite to the above-mentioned mechanical coordinate system; the unit conversion is to convert the dimensional unit of the mechanical coordinate system into a unit unit of the CCD 7 coordinate system by a fixed ratio value.
步驟S104,所述影像校正程式11計算出該點在CCD7座標系下的的測量值(即測量座標值),及所述校正片4測量出該點在CCD7座標系下的實際值(即實際座標值)。 Step S104, the image correction program 11 calculates the measured value of the point under the coordinate system of the CCD 7 (ie, the measured coordinate value), and the calibration piece 4 measures the actual value of the point under the coordinate system of the CCD 7 (ie, actual Coordinate value).
步驟S105,計算該測量參考點偏差值,即計算該測量參考點的實際值與測量值之差。 Step S105, calculating the measurement reference point deviation value, that is, calculating the difference between the actual value of the measurement reference point and the measured value.
步驟S106,將該點的偏差值記錄在所述的初始表格對應的位置上。 In step S106, the deviation value of the point is recorded in the position corresponding to the initial table.
步驟S107,判斷是否所有的格線交叉點都已經計算完畢。 In step S107, it is determined whether all the intersections of the ruled lines have been calculated.
若不是所有的點都測量完畢,則返回步驟S102,選擇下一個格線交叉點作為測量參考點。 If not all the points have been measured, the process returns to step S102, and the next ruled line intersection is selected as the measurement reference point.
若所有的點都已經測量完畢,則結束流程。 If all the points have been measured, the process ends.
在上述流程結束後,所述的記錄各格線交叉點偏差值的表格可以保存在一個特殊的加密檔中,需要相關校正工程師輸入解密密碼才可以開啟該表格,進行表格資料的查看或者修改,以防止其他用戶對該表格中資料的意外 修改而增加校正工程師的校正工作量。 After the above process ends, the table for recording the deviation value of each grid line intersection point can be saved in a special encryption file, and the relevant correction engineer needs to input the decryption password to open the table and view or modify the form data. To prevent other users from accidentally accessing the information in the form. Modifications increase the calibration workload of the calibration engineer.
同樣的,在1倍物鏡的CCD7搭配2倍倍率的工業光學鏡頭、1倍物鏡的CCD7搭配3倍倍率的工業光學鏡頭、2倍物鏡的CCD7搭配1倍倍率的工業光學鏡頭、2倍物鏡的CCD7搭配2倍倍率的工業光學鏡頭及2倍物鏡的CCD7搭配3倍倍率的工業光學鏡頭的情況下,計算測量參考點的偏差值的流程與上述所描述的流程相同。因此,透過重複實施上述流程可以產生6個表格分別對應CCD7與工業光學鏡頭的每一組搭配組合。 Similarly, the CCD7 with 1x objective lens is matched with 2x magnification industrial optical lens, 1x objective lens CCD7 with 3x magnification industrial optical lens, 2x objective lens CCD7 with 1x magnification industrial optical lens, 2x objective lens In the case where the CCD 7 is equipped with a 2x magnification industrial optical lens and a 2x objective lens CCD7 with a 3x magnification industrial optical lens, the flow for calculating the deviation value of the measurement reference point is the same as the flow described above. Therefore, by repeatedly performing the above process, six tables can be generated corresponding to each combination of the CCD 7 and the industrial optical lens.
通常,在實際量測工作中,所述的影像量測機台6可能會根據測量的需要從一個實驗室移動到另一個實驗室或者距離上一次校正的時間較長,都可能造成該機台上的元件距原來的位置有所偏離,繼而造成上述表格中的計算出的偏差值不精確,因此要對上述表格中記錄的偏差值進行校正。對偏差值校正的流程參閱圖6所示。 Generally, in the actual measurement work, the image measuring machine 6 may move from one laboratory to another according to the needs of the measurement or may take a long time from the last calibration, which may cause the machine to be caused. The upper component deviates from the original position, which in turn causes the calculated deviation value in the above table to be inaccurate, so the deviation value recorded in the above table is corrected. The flow of the offset value correction is shown in Figure 6.
圖6係本發明影像校正方法較佳實施例中利用偏差值計算模組110校正測量參考點的偏差值的實施流程圖。本發明以校正1倍物鏡的CCD7搭配1倍倍率的工業光學鏡頭的情況所對應的一個測量參考點為例進行說明:首先,步驟S200,所述校正工程師輸入解秘密碼。通常,為了更好的保護該表格資料,可以對所述的加密檔設置多重密碼。 FIG. 6 is a flow chart showing an implementation of correcting the deviation value of the measurement reference point by using the deviation value calculation module 110 in the preferred embodiment of the image correction method of the present invention. The present invention is described by taking a measurement reference point corresponding to the case where the CCD 7 of the 1x objective lens is matched with the industrial optical lens of 1× magnification as an example. First, in step S200, the correction engineer inputs the decryption code. Generally, in order to better protect the form data, multiple passwords can be set for the encrypted file.
步驟S201,驗證該密碼是否有效。若密碼無效,則於步驟S202中,提示密碼錯誤,並重新返回步驟S200。 In step S201, it is verified whether the password is valid. If the password is invalid, in step S202, the password is incorrect, and the process returns to step S200.
若密碼有效,則加密檔被解瑣,步驟S203,校正工程師選擇一個需要校正的表格。在本實施例中,校正工程師選擇1倍物鏡CCD7與1倍倍率工業光學鏡頭所對應的表格。 If the password is valid, the encrypted file is untied, and in step S203, the correction engineer selects a form to be corrected. In the present embodiment, the correction engineer selects a table corresponding to the 1x objective lens CCD7 and the 1x magnification industrial optical lens.
步驟S204,選擇一個測量參考點,即格線交叉點進行補正。所述的對格線交叉點進行補正即對該格線交叉點的偏差值進行重新計算。其方法與圖5中計算偏差值的方法相同,包括:將所選擇的格線交叉點的機械座標值轉換為CCD7的座標值;測量該參考點的實際值,並計算該點的測量值;計算該點的偏差值。 In step S204, a measurement reference point is selected, that is, a grid line intersection is corrected. The correction of the intersection of the grid lines is performed by recalculating the deviation value of the intersection of the grid lines. The method is the same as the method for calculating the deviation value in FIG. 5, comprising: converting the mechanical coordinate value of the selected grid intersection to the coordinate value of the CCD 7, measuring the actual value of the reference point, and calculating the measured value of the point; Calculate the deviation value for this point.
步驟S205,在上述選擇的表格對應的位置修改該測量參考點的偏差值。 Step S205, modifying the deviation value of the measurement reference point at a position corresponding to the selected table.
步驟S206,保存所述修改後的表格。 Step S206, saving the modified table.
根據校正的需要,在對該點校正結束後,該校正工程師可以選擇其他的測量參考點按照此流程進行校正計算。 同時,在對該表格的資料全部校正完之後,也可以選擇其他的5個表格按照此流程進行校正。 According to the needs of the calibration, after the calibration of the point is completed, the calibration engineer can select other measurement reference points to perform correction calculation according to this procedure. At the same time, after the data of the form is completely corrected, the other five tables can also be selected to be corrected according to this process.
參閱圖7所示,係本發明較佳實施例中所述表格資料的示意圖。該表格分別將各參考點在X軸與Y軸的偏差值分開兩個表格記錄。以如圖所示的字母Y為首的一橫行資料作為分界線,在上面一部分表格中,字母X為首的一橫行數字表示各參考點在X軸方向的實際值,以字母X為首的一豎列數字表示各參考點對應的在Y軸方向的實際值,某點在X軸方向實際值與Y軸方向實際值的交叉值為該點在X軸 方向的偏差值。同理,在下面一部分表格中,字母Y為首的一橫行數字表示上述各參考點在X軸方向的實際值,以字母Y為首的一豎列數字表示上述各參考點對應的在Y軸方向的實際值,某點在X軸方向實際值與Y軸方向實際值的交叉值為該點在Y軸方向的偏差值。 Referring to Figure 7, there is shown a schematic diagram of the form data in the preferred embodiment of the present invention. The table records the deviation values of the reference points on the X-axis and the Y-axis separately in two tables. A horizontal line of data represented by the letter Y as shown in the figure is used as a dividing line. In the above part of the table, a horizontal line of the letter X indicates the actual value of each reference point in the X-axis direction, and a vertical column headed by the letter X. The number indicates the actual value in the Y-axis direction corresponding to each reference point. The intersection of the actual value of a point in the X-axis direction and the actual value in the Y-axis direction is the point on the X-axis. The deviation value of the direction. Similarly, in the following part of the table, a horizontal line of the letter Y indicates the actual value of each of the reference points in the X-axis direction, and a vertical column number represented by the letter Y indicates the corresponding reference point in the Y-axis direction. The actual value, the intersection of the actual value of a point in the X-axis direction and the actual value of the Y-axis direction is the deviation value of the point in the Y-axis direction.
例如,如圖7所示的某參考點的實際值為(0,0),由表格資料可知,該點在X軸方向與Y軸方向的偏差值分別為-0.0007與0.0002。 For example, the actual value of a reference point as shown in FIG. 7 is (0, 0). As can be seen from the table data, the deviation values of the point in the X-axis direction and the Y-axis direction are -0.0007 and 0.0002, respectively.
參閱圖8所示,係本發明影像校正方法較佳實施例中利用影像校正模組111對影像進行校正計算的實施流程圖。本發明以對影像上的一個點進行校正為例進行說明:首先,步驟S300,選擇待測工件5的影像上的一點P0進行校正測量。 Referring to FIG. 8 , it is a flowchart of an implementation of correcting and calculating an image by using the image correcting module 111 in the preferred embodiment of the image correcting method of the present invention. The present invention is described by taking an example of correcting a point on an image. First, in step S300, a point P0 on the image of the workpiece 5 to be tested is selected for calibration measurement.
步驟S301,將點P0的機械座標轉換為CCD座標。所述的轉換與圖5中的S103相同,包括:將機台6的機械座標系轉換成以CCD7中心為原點,X軸方向與上述機械座標系相同,且Y軸方向與上述機械座標系相反的座標系;及將機械座標系的尺寸單位以一個固定的比率值轉換為CCD7座標系的圖元單位。 In step S301, the mechanical coordinate of the point P0 is converted into a CCD coordinate. The conversion is the same as S103 in FIG. 5, including: converting the mechanical coordinate system of the machine table 6 to the center of the CCD 7 as the origin, the X-axis direction is the same as the mechanical coordinate system, and the Y-axis direction and the mechanical coordinate system are The opposite coordinate system; and converts the dimensional unit of the mechanical coordinate system into a primitive unit of the CCD7 coordinate system at a fixed ratio value.
步驟S302,計算距離點P0最近的四個格線交叉點。參閱圖9所示,是計算距離點P0最近的四個格線交叉點的示意圖。其中,點P0的CCD座標為(0.5,0.5),影像校正模組111計算與點P0最近的四個方格的格線交叉點,可以計算出點P0落在方格ABCD內。 In step S302, four grid intersections closest to the point P0 are calculated. Referring to FIG. 9, it is a schematic diagram of calculating four grid line intersections closest to the point P0. Wherein, the CCD coordinates of the point P0 are (0.5, 0.5), and the image correction module 111 calculates the intersection of the grid lines of the four squares closest to the point P0, and it can be calculated that the point P0 falls within the square ABCD.
步驟S303,影像校正模組111計算點P0到方格ABCD四個頂點的距離D0,D1,D2,D3。 In step S303, the image correction module 111 calculates the distances D0, D1, D2, and D3 of the four vertices from the point P0 to the square ABCD.
步驟S304,計算點P0的偏差值A。 In step S304, the deviation value A of the point P0 is calculated.
計算點P0的偏差值的公式為:
其中,A0,A1,A2,A3分別表示記錄在前述表格中的方格ABCD四個頂點的偏差值,在計算點P0在X方向的偏差值時,A0,A1,A2,A3分別為方格ABCD四個頂點在X軸方向的偏差值,同理,計算點P0在Y方向的偏差值時,A0,A1,A2,A3分別為方格ABCD四個頂點在Y軸方向的偏差值。 Among them, A0, A1, A2, and A3 respectively represent the deviation values of the four vertices of the square ABCD recorded in the above table. When calculating the deviation value of the point P0 in the X direction, A0, A1, A2, and A3 are squares, respectively. The deviation value of the four vertices of the ABCD in the X-axis direction. Similarly, when calculating the deviation value of the point P0 in the Y direction, A0, A1, A2, and A3 are the deviation values of the four vertices of the square ABCD in the Y-axis direction, respectively.
對上述公式進行轉化,一般可以在公式的上下同時乘以D0*D1*D2*D3,而將公式轉化為:
則公式可以化簡為:
因此,計算出了點P0的偏差值A。 Therefore, the deviation value A of the point P0 is calculated.
步驟S305,根據上述計算出的偏差值A對該點P0進行校正計算。所述校正是利用點P0的測量值,即上述的CCD座標值(0.5,0.5),加上該點的偏差值A得到該點實際值。 In step S305, the correction calculation is performed on the point P0 according to the calculated deviation value A. The correction is obtained by using the measured value of the point P0, that is, the above-mentioned CCD coordinate value (0.5, 0.5), and adding the deviation value A of the point to obtain the actual value of the point.
本發明較佳實施例描述了計算測量參考點的偏差值,及根據測量參考點的偏差值對影像上的點進行校正的一個較為完整的流程,在實際對一個待測工件的影像進行校正時,若已經存在如圖7所示的表格記錄著每一個測量參考點的偏差值,且每一個測量參考點的偏差值都準確的情況下,可以直接利用表格中的資料實施如圖8所示的流程對影像進行校正,而不需要所述偏差值計算模組110重新計算每一個測量參考點的偏差值。 The preferred embodiment of the present invention describes a relatively complete process for calculating the deviation value of the measurement reference point and correcting the point on the image according to the deviation value of the measurement reference point, when actually correcting the image of a workpiece to be tested If there is already a table as shown in Figure 7 that records the deviation value of each measurement reference point, and the deviation value of each measurement reference point is accurate, you can directly use the data in the table to implement as shown in Figure 8. The process corrects the image without the deviation value calculation module 110 recalculating the deviation value of each measurement reference point.
本發明所提供的影像校正系統及方法採用格線補正的方法,對影像進行補償校正,有效的消除或減少了機械本身的誤差影響;並且將校正資料存放在一個特殊的加密檔中,可以防止用戶任意修改。 The image correction system and method provided by the invention adopts the method of grid correction to compensate and correct the image, effectively eliminating or reducing the influence of the error of the machine itself; and storing the correction data in a special encryption file can prevent The user can modify it at will.
以上所述僅為本發明之較佳實施例而已,且已達廣泛之使用功效,凡其他未脫離本發明所揭示之精神下所完成之均等變化或修飾,均應包含在下述之申請專利範圍內。 The above is only the preferred embodiment of the present invention, and has been used in a wide range of applications. Any other equivalent changes or modifications which are not departing from the spirit of the present invention should be included in the following claims. Inside.
1‧‧‧電腦 1‧‧‧ computer
4‧‧‧校正片 4‧‧‧ calibration film
5‧‧‧工件 5‧‧‧Workpiece
6‧‧‧影像量測機台 6‧‧‧Image measuring machine
7‧‧‧電荷耦合裝置 7‧‧‧Charge-coupled device
10‧‧‧影像擷取卡 10‧‧‧Image Capture Card
11‧‧‧影像校正程式 11‧‧‧Image Correction Program
110‧‧‧偏差值計算模組 110‧‧‧ Deviation value calculation module
111‧‧‧影像校正模組 111‧‧‧Image Correction Module
S300‧‧‧選擇影像上的一個點P0 S300‧‧‧Select a point on the image P0
S301‧‧‧將點P0轉換成CCD座標 S301‧‧‧ Convert point P0 to CCD coordinates
S302‧‧‧計算出距離點P0最近的四個格線交叉點 S302‧‧‧ Calculate the four grid intersections closest to point P0
S303‧‧‧計算點P0到上述四個格線交叉點的距離D0,D1,D2,D3 S303‧‧‧ Calculate the distance from point P0 to the intersection of the above four grid lines D0, D1, D2, D3
S304‧‧‧計算點P0的偏差值A S304‧‧‧ Calculate the deviation value A of point P0
S305‧‧‧對點P0進行校正計算 S305‧‧‧Correct calculation for point P0
圖1係一方格圖形的實際圖像。 Figure 1 is the actual image of a one-frame graphic.
圖2係圖1中的方格圖形透過CCD成像後的影像。 FIG. 2 is an image of the square pattern in FIG. 1 imaged by a CCD.
圖3係本發明影像校正系統較佳實施例的硬體架構圖。 3 is a hardware architecture diagram of a preferred embodiment of the image correction system of the present invention.
圖4係圖3中影像校正程式的功能模組圖。 FIG. 4 is a functional block diagram of the image correction program in FIG. 3.
圖5係本發明影像校正方法較佳實施例中計算測量參考點的偏差值的實施流程圖。 FIG. 5 is a flow chart showing an implementation of calculating a deviation value of a measurement reference point in a preferred embodiment of the image correction method of the present invention.
圖6係本發明影像校正方法較佳實施例中校正測量參考點的偏差值的實施流程圖。 6 is a flow chart showing an implementation of correcting a deviation value of a measurement reference point in a preferred embodiment of the image correction method of the present invention.
圖7係本發明較佳實施例中表格的示意圖。 Figure 7 is a schematic illustration of a table in a preferred embodiment of the invention.
圖8係本發明影像校正方法較佳實施例中對影像進行校正計算的實施流程圖。 FIG. 8 is a flow chart showing an implementation of correcting an image in a preferred embodiment of the image correcting method of the present invention.
圖9係計算距離影像上的一點最近的格線交叉點的示意圖。 Figure 9 is a schematic diagram of calculating the intersection of the nearest grid lines at a point on the distance image.
S300‧‧‧選擇影像上的一個點P0 S300‧‧‧Select a point on the image P0
S301‧‧‧將點P0轉換成CCD座標 S301‧‧‧ Convert point P0 to CCD coordinates
S302‧‧‧計算出距離點P0最近的四個格線交叉點 S302‧‧‧ Calculate the four grid intersections closest to point P0
S303‧‧‧計算點P0到上述四個格線交叉點的距離D0,D1,D2,D3 S303‧‧‧ Calculate the distance from point P0 to the intersection of the above four grid lines D0, D1, D2, D3
S304‧‧‧計算點P0的偏差值A S304‧‧‧ Calculate the deviation value A of point P0
S305‧‧‧對點P0進行校正計算 S305‧‧‧Correct calculation for point P0
Claims (6)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW96105029A TWI397668B (en) | 2007-02-12 | 2007-02-12 | System and method for correcting an image |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW96105029A TWI397668B (en) | 2007-02-12 | 2007-02-12 | System and method for correcting an image |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| TW200834032A TW200834032A (en) | 2008-08-16 |
| TWI397668B true TWI397668B (en) | 2013-06-01 |
Family
ID=44819330
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW96105029A TWI397668B (en) | 2007-02-12 | 2007-02-12 | System and method for correcting an image |
Country Status (1)
| Country | Link |
|---|---|
| TW (1) | TWI397668B (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| TWI554100B (en) * | 2012-12-27 | 2016-10-11 | Metal Ind Res &Development Ct | Correction sheet design for correcting a plurality of image capturing apparatuses and correction methods of a plurality of image capturing apparatuses |
| TWI517670B (en) | 2012-12-28 | 2016-01-11 | 財團法人工業技術研究院 | Automatic calibration for vehicle camera and image conversion method and device applying the same |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6538691B1 (en) * | 1999-01-21 | 2003-03-25 | Intel Corporation | Software correction of image distortion in digital cameras |
| TW538232B (en) * | 2001-12-31 | 2003-06-21 | China Steel Corp | Automatic particle diameter measurement equipment by on-line optical analysis |
| US20030169918A1 (en) * | 2002-03-06 | 2003-09-11 | Fuji Jukogyo Kabushiki Kaisha | Stereoscopic image characteristics examination system |
-
2007
- 2007-02-12 TW TW96105029A patent/TWI397668B/en not_active IP Right Cessation
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6538691B1 (en) * | 1999-01-21 | 2003-03-25 | Intel Corporation | Software correction of image distortion in digital cameras |
| TW538232B (en) * | 2001-12-31 | 2003-06-21 | China Steel Corp | Automatic particle diameter measurement equipment by on-line optical analysis |
| US20030169918A1 (en) * | 2002-03-06 | 2003-09-11 | Fuji Jukogyo Kabushiki Kaisha | Stereoscopic image characteristics examination system |
Also Published As
| Publication number | Publication date |
|---|---|
| TW200834032A (en) | 2008-08-16 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP6863954B2 (en) | Camera calibration device and camera calibration method | |
| CN110163918A (en) | A kind of line-structured light scaling method based on projective geometry | |
| JP2011118553A (en) | Image processing apparatus, image processing method and computer program | |
| JP2012202694A (en) | Camera calibration method | |
| JP6576664B2 (en) | Edge detection bias correction value calculation method, edge detection bias correction method, and program | |
| CN102782721A (en) | Systems and methods for runtime determination of camera calibration error | |
| JPWO2018168757A1 (en) | Image processing apparatus, system, image processing method, article manufacturing method, program | |
| CN101726246A (en) | Correcting sheet and correcting method | |
| CN109003312B (en) | Camera calibration method based on nonlinear optimization | |
| JP4270949B2 (en) | Calibration chart image display device, calibration device, and calibration method | |
| JP5998532B2 (en) | Correction formula calculation method, correction method, correction apparatus, and imaging apparatus | |
| JP2006098065A (en) | Calibration device and method, and three-dimensional modelling device and system capable of using the same | |
| CN101242546A (en) | Image correction system and method | |
| JP4250620B2 (en) | Information processing method and apparatus | |
| JP2011155412A (en) | Projection system and distortion correction method in the same | |
| CN116297181A (en) | Method for rapidly and accurately correcting laser scanning galvanometer through calibration plate | |
| TW201326776A (en) | Lens test device and method | |
| TWI397668B (en) | System and method for correcting an image | |
| WO2010013289A1 (en) | Camera calibration image creation apparatus and camera calibration image creation program | |
| CN115205129A (en) | Depth camera based on structured light and method of use | |
| JPH05248819A (en) | Calibrating method of data of calibration object for measuring three dimensional position of object by camera and measuring method of three dimensional position | |
| TW202241660A (en) | Program generation device and robot control device | |
| CN116164661A (en) | Line Structured Light Measuring Method, Device and Measuring Equipment Based on Telecentric Camera Model | |
| CN112907462A (en) | Distortion correction method and system for ultra-wide-angle camera device and shooting device comprising distortion correction system | |
| CN112927305A (en) | Geometric dimension precision measurement method based on telecentricity compensation |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| MM4A | Annulment or lapse of patent due to non-payment of fees |