1292851 九、發明說明: <相關申請案之交互參考> • 本申請案與同在申請中之中華民國專利申請案「影像 • 擷取裝置之對焦方法」(案號94106016)有關,且具有相同 的申請人。 【發明所屬之技術領域】 本發明係有關於影像擷取,尤指一種影像擷取裝置之 ^ 對焦方法。 【先前技術】 習用數位相機(或數位攝影機)在進行對焦時,係利用 步進馬達將鏡頭内之對焦鏡片前後移動(所移動的距離以 步數(step)來表示),由感光元件(如電荷耦合元件(CCD)) 接收射過對焦鏡片的光線,並藉由一數位訊號處理器 (DSP)計算對焦鏡片在不同位置時,所對應之一對比值 (contrast value)或評價值。圖一係數位相機在進行對焦 • 時,其對焦步數(f〇cus step)與對比值之典型對應關係的示 圖圖一之横轴為對焦步數,其值大小係相對於對焦鏡 片之一參考位置(圖示之原點)而言;縱轴則為對比值,係 由數位訊號處理器依據感光元件之感光量計算所得。在圖 中’此對應關係係顯示為一具有一峰值的曲線,而此峰 值即為最大對比值。在一般情形下,此最大對比值所對應 的橫軸之值即為最佳對焦步數,相機在此最佳對焦步數下 進行拍攝,應可獲得最佳解析度。 5 1292851 ^然而,由於前述之習用技術在對焦時,其對比值之計 算僅針對感光元件之感光區(sensor area)中預先選定之乃 部區域’因而所得之最大對比值(即圖一之峰值)無法代表 整個感光區。目此’依據該最大耻值職之對焦步數所 拍攝出的影像,可能會有部分區域(如某-邊或肖落)較為 模糊的現象,造成整個影像之解析度不平衡。在這種情形 下,該最大對比值所對應的對焦步數,就非,,最佳,,對焦牛 數。 “、、乂1292851 IX. Invention Description: <Reciprocal Reference of Related Applications> • This application is related to the application of the Republic of China patent application "focus method of image capturing device" (Case No. 94160016) and has The same applicant. [Technical Field] The present invention relates to image capture, and more particularly to a focus method of an image capture device. [Prior Art] When a digital camera (or digital camera) is used for focusing, a stepping motor is used to move the focus lens in the lens back and forth (the distance moved is expressed in steps), by the photosensitive element (such as A charge coupled device (CCD) receives light passing through the focus lens and calculates a contrast value or evaluation value corresponding to the focus lens at different positions by a digital signal processor (DSP). Figure 1 shows the ratio of the number of focus steps (f〇cus step) to the contrast value. The horizontal axis of the graph is the number of focus steps. The value is relative to the focus lens. A reference position (the origin of the figure); the vertical axis is the contrast value, which is calculated by the digital signal processor based on the sensitivity of the photosensitive element. In the figure, this correspondence is shown as a curve with a peak, and this peak value is the maximum contrast value. In the normal case, the value of the horizontal axis corresponding to the maximum contrast value is the optimal number of focus steps. The camera should shoot at this best focus step, and the best resolution should be obtained. 5 1292851 ^ However, due to the aforementioned conventional techniques, the contrast value is calculated only for the pre-selected region of the photosensitive area of the photosensitive element, thus obtaining the maximum contrast value (ie, the peak value of Figure 1). ) can not represent the entire photosensitive area. According to the image taken by the number of focus steps of the maximum shame value, there may be a phenomenon in which some areas (such as a certain side or a corner) are blurred, resulting in an imbalance in the resolution of the entire image. In this case, the maximum contrast value corresponds to the number of focus steps, which is not, and the best, the number of focus. ",, 乂
【發明内容】 /本發明的目的之一,在於提出一種對焦方法,適用於 影像擷取裝置(如數位相機或數位攝影機),可改善其解析 度失衡問題,以提昇整體解析度及效能。 本發明之另一目的,在於提出一種鏡頭對焦步數之調 整^法’適用於數位相機或數位攝影機,可將其鏡頭調整 至最佳的對步數,以提高鏡頭對焦時之整體解析度。 為達前述目的,本發明之影像娜裝置對焦方法係包 含下列步驟:進行-對焦程序以決定影像操取裝置之對焦 ^之第-位置,其中第一位置係對應於第一對比值;; 1、鏡片分別設定於複數個不同位置,於每一位置各拍攝 一對應之對焦圖片;依據各對焦圖片之複數個週邊區域 之對應圖檔大小(fllesize),從該些不同位置中決定第二位 f,比較第—與第二位置,以產生-調整步數;以及依據 该調整步數調整對焦鏡片之位置。 1292851 另一方面,本發明之鏡頭對焦步數調整方法係用於一 數位影像裝置中,該數位影像裝置包含一對焦鏡片。此調 整方法包含下列步驟:進行一對焦程序以決定對焦鏡片之 第一步數’其中第一步數係對應於第一對比值;將對焦鏡 片分別設定於複數個不同步數,於每一步數各拍攝一 之對焦圖片;依據各對焦圖片之複數個週邊區域之對應 圖檔大小,從該些不同步數中決定第二步數;比較第一與 第二步數,以產生一調整步數;以及依據該調整步數調^ 對焦鏡片之對焦步數。 ° & 為使貴審查委員對於本發明能有更進一步的了解 與涊同,茲配合圖式詳述本發明的實施方式如后。 【實施方式】 圖二係本發明之對焦方法之一較佳實施例的流程 圖。此對f、方法_於影像齡裝置,例如數_機或數 攝心機。衫像_取裝置具有一鏡頭,内含_對焦鏡片, 可於對鱗前後軸,移__大小細步數來表示。 如圖二所示,此流程包含下列步驟·· 步驟21 ··進行—對餘序以決定對焦鏡片之第一位 置; 乂驟22 ·將對焦鏡片分別設定於複數個不同位置, 於每一不同位置各拍攝一對應之對焦圖 片; 义驟23 ·依據各對賴片之複數個週邊區域之對應 7 1292851 圖播大小,從該些不同位置中紗第二位 - 置; , ㈣24:比較第一與第二位置,以產生一調整步數; 以及 步驟25 :依據該調整步數調整對焦鏡片之位置。 步驟21中’對焦程序係將對焦鏡片分別設定於複數 ,同位置,並計算每-位置所對應之對比值。在這些計 • 算所仔之對比值中,最大者所對應之位置即為第-位置。 —步驟22與23係在進行一校準(calibrati〇n)程序以決 疋出校準後對紐片之最佳位置(即第二位置)。在此最佳 位置進行賴’即可·最佳之整贿體,避免失衡。 該校準程序係依據”影像之解析度與其對細槽之大小成 正=的原理來進行。此處圖槽之槽案格式,可為任何業 界f用之規格’如JPEG。步驟22於賴對_片時,係 以-樣本圖(pattemchart)為對象來拍攝。此樣本圖係配合 籲 對’、、、圖片的劃分方式(下文詳述)*設計’以碟保所劃分區 ^之^應騎大小—致,亦即,在相同拍攝條件下,不同 區,若面積相同,其對應圖檔大小也相同。在步驟22針 對每個不同位置拍攝對焦圖片後,步驟23即對這些對焦 圖片進行分析。分析方式如下:首先,將每張對焦圖片畫; 分為九個大小相同區域,其中包含一中心區域與八個週邊 區域’如圖三所示。每個區域可視為一子圖片,具有一對 應之圖檔大小。依據所有對焦圖片之中心區域(標示為A) 8 1292851 之對應圖檔大小的最大值,將滿足,,其中心區域之對應圖 檔大小相對於該最大值之百分比值高於一臨界值,,之對焦 圖片保留下來,其餘不予考慮。該臨界值(如95%)係一經 驗值,可隨實際狀況而調整。 其次,就所保留之每張對焦圖片之四個角落週邊區域 (左上、左下、右上及右下依序標示為B、c、D及E),選 取其中兩個之對應圖檔大小為最小者。在一實施例中,計 算每一保留圖片被選取之兩週邊區域之對應圖檔大小之 馨和,並以此和為最大者之保留圖片所對應的位置為第二位 置。在另一實施例中,計算每一保留圖片被選取之兩週邊 區域之對應圖檔大小之差,並以此差為最小者之保留圖片 所對應的位置為第二位置。在又一實施例中,則分別計算 每一保留圖片被選取之兩週邊區域之對應圖檔大小之和 與差。接著,選取前N張圖檔大小之和最大的對焦圖片, 再從此N張對焦圖片中,選取對應圖檔大小之差為最小 者,其保留圖片所對應之位置即為第二位置。其中,N係 • 一經驗值,可隨實際狀況而調整。 、 ’、 一值传注意的是,步驟23在分析對焦圖片時,除了 二的劃分方式,其他賴分方式亦可適用。只要對焦圖片 至少劃分有-個中心區域及兩個週邊區域(形狀、二 方位皆不限),且有相配合之樣本圖以供拍攝對焦圖片, 就能利用前述分析方式來決定第二位置。 在圖二之實施例中,步驟22之該些 第一位置,且相鄰位置之間隔步數相同。例如, 9 1292851 位置可選擇以第一位置為中心,前後各5步的範圍,而相 鄰位置之間隔為1步。由於對焦鏡片之每個位置可用一對 應之對焦步數來代表,因此,在決定第一與第二位置後, 於步驟23中,可直接計算這兩個位置之對應對焦步數間 之步數差距,而得到調整步數。 在經過校準並取得調整步數後,於步驟24中,便可 依據此調整步數來調整對焦鏡片之位置,以獲致最佳之整 體解析度。例如,於後續進行對焦時,在進行完對焦程序 後(此時對焦鏡片位於,,理論上,,具有最大對比值之位置), 再將對焦德置修正—調整錄,便可將鏡頭調整至 最佳整體解減。在-實施例巾,係將此調整步數存於影 像擷取裝置之-記㈣巾,關於後續進行難時可取^ 使用。 則述調整步數之大小,更可隨著影像榻取裝置之不同 拍攝參數_動α此,在本發明之對焦方法之另 實施例中,除了步驟21至25,更進一步選取一或多 攝參數,財㈣賴參_奴訂,重 21至24 ’產生對應之調整步數,並可將拍攝參數與= 步數之對應_儲存於影軸取裝置之記絲+。在 25中’可依顧鱗各麵錄之設枝,從雜體^ 出對應之罐步數,據以調整對焦刻之位置。物 參,視所要達成之精確度喊: 的參數越多,所達成之整體解析度就越好。在選取 中,係選取鏡頭段數與拍攝距離兩個參數。貫知例 1292851 圖四係本發明之鏡頭步數調整方法之一較佳實 ===梅胁—紐_置,如數 二::或數位攝衫機。該數位影像裝置具有一鏡頭,内含 =來、=Ί於對焦時前後移動,移動距離的大小係以 步數來表不。如__,歧程包含下列步驟: 4 41 ·進仃—對焦程序以決定對焦鏡片之第一步 •數,其中第-步數係對應於第一對比值; /騾42 ·將,焦鏡片分別設定於複數個不同步數, 於母一步數各拍攝一對應之對焦圖片; 步驟43 .依據各對焦圖片之複數個週邊區域之對應 圖槽大小,從該些不同步數巾蚊第二步 數; 步驟44:比較第一與第二步數,以產生—調整步數; 以及 步驟45 ··依據該調整步數調整對焦鏡片之對焦步數。 步驟42中’該些不同步數係包含第—步數,且相鄰 γ數之間隔相同。步驟43係以類似於圖二步騾幻的方弋 來分析步驟42所狀職_,贱據錢_片被選 取之兩個週邊區域之對應_大小之和或差,決定第二+ 數。步騾44巾,計算第一與第二步數間之差距即:二 整步數。在-實_中’雜此碰步數存於數位影像裝 置之一記憶體中’以利於後續進行對鱗可取出使用。、 在本發明之鏡頭對焦步數調整方法之另一較佳實施 1292851 例中,除了步驟41至45,φ、备土 數,以在獨賴細/m桃拍攝參 ^数的叹疋值下’重複執行步驟41至 岸調整步數’並將拍攝參數與調整步數之對 應關係儲存於數位影像裝置之記憶體中。在步驟衫令, 各絲錄之設賴,觀鋪㈣對應之 數’據以調整龍制之位置。在-實施例中,係 k取鏡頭段數與拍攝距離兩個參數來實施此調整方法。SUMMARY OF THE INVENTION One of the objects of the present invention is to provide a focusing method suitable for an image capturing device (such as a digital camera or a digital camera), which can improve the resolution imbalance problem and improve the overall resolution and performance. Another object of the present invention is to provide an adjustment method for the number of steps of the lens to be applied to a digital camera or a digital camera, which can adjust the lens to the optimal number of steps to improve the overall resolution of the lens when focusing. In order to achieve the foregoing objective, the image capturing method of the present invention comprises the following steps: performing a focusing process to determine a first position of a focus of the image capturing device, wherein the first position corresponds to the first contrast value; The lens is respectively set at a plurality of different positions, and each of the positions is photographed with a corresponding focus picture; and the second position is determined from the different positions according to the corresponding image size (fllesize) of the plurality of surrounding areas of each of the focus pictures. f, comparing the first and second positions to generate - adjusting the number of steps; and adjusting the position of the focus lens according to the adjustment step. 1292851 In another aspect, the lens focus step adjustment method of the present invention is used in a digital image device that includes a focus lens. The adjustment method comprises the following steps: performing a focusing process to determine the first step of the focusing lens' wherein the first step corresponds to the first contrast value; and the focusing lens is respectively set to the plurality of unsynchronized numbers, at each step Shooting a focused picture; determining a second step number from the number of unsynchronized numbers according to the corresponding image size of the plurality of surrounding areas of each focused picture; comparing the first and second step numbers to generate an adjustment step And adjust the number of focus steps of the focus lens according to the adjustment step. ° &amplitude of the present invention will be further described in conjunction with the drawings. [Embodiment] Fig. 2 is a flow chart showing a preferred embodiment of the focusing method of the present invention. The pair f, method _ is an image age device, such as a digital machine or a digital camera. The shirt image_taking device has a lens with a _focus lens, which can be expressed on the front and rear axles of the scales, and the number of small steps is shifted. As shown in FIG. 2, the flow includes the following steps: Step 21 · Performing - determining the first position of the focus lens for the residual sequence; Step 22 - Setting the focus lens to a plurality of different positions, respectively Each position of the camera is photographed with a corresponding focus picture; Step 23: According to the corresponding number of surrounding areas of each pair of sheets, the corresponding size of the 12 1292851, from the different positions, the second position of the yarn - set; (4) 24: compare first And the second position to generate an adjustment step; and step 25: adjusting the position of the focus lens according to the adjustment step. In step 21, the 'focusing process sets the focusing lens to the complex position and the same position, and calculates the contrast value corresponding to each position. Among the comparison values of these calculations, the position corresponding to the largest one is the first position. - Steps 22 and 23 are performing a calibration procedure to determine the optimum position (i.e., the second position) of the tab after calibration. In this best position, you can do the best and avoid the imbalance. The calibration procedure is based on the principle that the resolution of the image is positive with the size of the slot. The slot format of the slot here can be any industry specification such as JPEG. Step 22 is based on _ In the case of film, the sample is taken with the sample map (pattemchart). This sample image is matched with the designation of ',, and picture (described in detail below) * Designed by the disc insurance area ^^ The size is the same, that is, under the same shooting conditions, different areas, if the area is the same, the corresponding image size is also the same. After taking the in-focus picture for each different position in step 22, step 23 analyzes the in-focus pictures. The analysis method is as follows: First, each focused picture is drawn; divided into nine equal-sized areas, including a central area and eight surrounding areas as shown in Figure 3. Each area can be regarded as a sub-picture with one Corresponding image file size. According to the maximum value of the corresponding image size of the center area of all the in-focus images (labeled A) 8 1292851, the corresponding image size of the center area is 100% relative to the maximum value. The ratio is higher than a critical value, and the focus image is retained, and the rest is not considered. The threshold (such as 95%) is an empirical value, which can be adjusted according to the actual situation. Secondly, each focused image is retained. The four corner peripheral areas (upper left, lower left, upper right, and lower right are sequentially labeled as B, c, D, and E), and the corresponding image size of the two is selected to be the smallest. In one embodiment, each reservation is calculated. The picture is selected as the sum of the image size of the two surrounding areas, and the position corresponding to the largest retained picture is the second position. In another embodiment, each reserved picture is selected to be selected. The difference between the size of the corresponding image of the two surrounding areas, and the position corresponding to the reserved picture with the smallest difference is the second position. In still another embodiment, the two surrounding areas where each reserved picture is selected are respectively calculated. The sum and difference of the size of the corresponding image file. Then, the focus picture with the largest sum of the size of the first N pictures is selected, and then the difference between the size of the corresponding picture files is selected from the N focus pictures, and the reserved picture corresponds to The position is the second position. Among them, the N system • an empirical value can be adjusted according to the actual situation. , ', one value transmission is noted, step 23 in the analysis of the focus picture, in addition to the second division, other points The method can also be applied. As long as the focused image is divided into at least one central area and two surrounding areas (the shape and the two orientations are not limited), and the matching sample map is used for shooting the focused image, the aforementioned analysis method can be utilized. The second position is determined. In the embodiment of Fig. 2, the first positions of step 22 and the interval between adjacent positions are the same. For example, 9 1292851 positions can be selected centered on the first position, 5 steps in front and rear. The range of the adjacent positions is one step. Since each position of the focus lens can be represented by a corresponding number of focus steps, after determining the first and second positions, in step 23, the calculation can be directly performed. The difference in the number of steps between the two steps corresponds to the number of steps, and the number of adjustment steps is obtained. After calibrating and obtaining the number of adjustment steps, in step 24, the position of the focus lens can be adjusted according to the number of adjustment steps to obtain the best overall resolution. For example, in the subsequent focus, after the focus program is completed (the focus lens is located, in theory, the position with the largest contrast value), and then the focus is corrected - adjust the recording, the lens can be adjusted to The best overall solution. In the embodiment towel, the adjustment step is stored in the image capture device (four) towel, and it can be used for subsequent difficulties. The size of the adjustment step is further described, and the shooting parameter of the image reclining device is different. In another embodiment of the focusing method of the present invention, in addition to steps 21 to 25, one or more cameras are further selected. Parameters, Cai (four) Lai Shen _ slave order, weight 21 to 24 'produce the corresponding adjustment steps, and the corresponding parameters of the shooting parameters and = step number _ stored in the shadow axis device. In the 25th section, the number of cans can be adjusted according to the scales of the scales, and the number of cans corresponding to the scales can be adjusted accordingly. The ginseng, depending on the accuracy to be achieved, the more parameters you have, the better the overall resolution achieved. In the selection, the parameters of the number of shot segments and the shooting distance are selected.知知例 1292851 Figure 4 is one of the lens step number adjustment methods of the present invention is better === Meixue-New Zealand, such as number two:: or digital camera. The digital image device has a lens containing = to, = Ί moving forward and backward when focusing, and the magnitude of the moving distance is represented by the number of steps. For example, __, the ambiguity includes the following steps: 4 41 · 仃 仃 - focus program to determine the first step of the focus lens • number, where the number of steps corresponds to the first contrast value; / 骡 42 · will, focus lens Set each of the plurality of unsynchronized numbers, and take a corresponding focus picture for each step of the parent step; Step 43. According to the corresponding picture slot size of the plurality of surrounding areas of each focus picture, the second step from the unsynchronized number Step 44: Compare the first and second step numbers to generate - adjust the number of steps; and step 45 · adjust the number of focus steps of the focus lens according to the adjustment step number. In step 42, the number of unsynchronized numbers includes the first step number, and the intervals of adjacent γ numbers are the same. Step 43 analyzes the position _ in step 42 in a manner similar to the illusion of Fig. 2, and determines the second + number according to the sum or difference of the corresponding _ sizes of the two surrounding areas selected by the money _ slice. Step 44, calculate the difference between the first and second steps: two full steps. The number of hits in the real-medium is stored in the memory of the digital image device to facilitate subsequent use of the scale. In another preferred embodiment of the lens focusing step adjustment method of the present invention, in the example 1292851, except for steps 41 to 45, φ and the number of soils are prepared to take the sigh value of the photographing parameter. 'Repeat step 41 to the shore adjustment step number' and store the correspondence between the shooting parameters and the adjustment step number in the memory of the digital image device. In the step of the shirt order, each silk record is set, and the number of the corresponding (4) corresponds to the position of the dragon system. In the embodiment, the adjustment method is implemented by taking two parameters of the number of shot segments and the shooting distance.
以上所述係彻触實關詳細·本發明,而非限 制本U之範圍。大凡熟知此類技藝人士皆能 各 而作些微驗變及機,_不失本㈣之要義所在,; 不脫離本發明之精神和範圍。綜上所述,本發明實施之具 f性’誠已符合專利法巾所規定之發明專利要件,謹請 貝審查委員惠予審視,並賜准專利為禱。 【圖式簡單說明】 圖一係數位相機在進行對焦時,其對焦步數與對比值 • 之典型對應關係的示意圖。 圖二係本發明之對焦方法之一較佳實施例的流程圖。 圖二係圖二實施例中,對焦圖片之劃分方式的示意 圖。 圖四係本發明之鏡頭對焦步數調整方法之一較佳實 施例的流程圖。 【主要元件符號說明】 21〜25 :影像擷取裝置對焦方法之一較佳實施例的流程 41〜45 :鏡頭對焦步數調整方法之一較佳實施例的流程 12The above is a thorough description of the present invention and is not intended to limit the scope of the present invention. Anyone who is familiar with such a skilled person can make some micro-invariances and machines, without losing the essence of this (4); without departing from the spirit and scope of the present invention. In summary, the invention has been implemented in accordance with the patents required by the patent law towel, and I would like to ask the review committee to give a review and grant the patent as a prayer. [Simple diagram of the diagram] Figure 1 is a schematic diagram of the typical correspondence between the number of steps and the contrast value of the camera when the focus is being focused. Figure 2 is a flow chart of a preferred embodiment of the focusing method of the present invention. Figure 2 is a schematic diagram showing the manner in which the in-focus picture is divided in the second embodiment. Figure 4 is a flow chart showing a preferred embodiment of a lens focus step adjustment method of the present invention. [Main component symbol description] 21 to 25: Image capturing device focusing method Flow of a preferred embodiment 41 to 45: Flow of lens focusing step adjustment method Flow of a preferred embodiment 12