TW202405520A - Lens focusing method and system performing the same - Google Patents

Lens focusing method and system performing the same Download PDF

Info

Publication number
TW202405520A
TW202405520A TW111129095A TW111129095A TW202405520A TW 202405520 A TW202405520 A TW 202405520A TW 111129095 A TW111129095 A TW 111129095A TW 111129095 A TW111129095 A TW 111129095A TW 202405520 A TW202405520 A TW 202405520A
Authority
TW
Taiwan
Prior art keywords
focus
focal length
image
focusing
module
Prior art date
Application number
TW111129095A
Other languages
Chinese (zh)
Other versions
TWI815584B (en
Inventor
陳韋安
管益章
Original Assignee
大陸商業成科技(成都)有限公司
大陸商業成光電(深圳)有限公司
大陸商業成光電(無錫)有限公司
英特盛科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 大陸商業成科技(成都)有限公司, 大陸商業成光電(深圳)有限公司, 大陸商業成光電(無錫)有限公司, 英特盛科技股份有限公司 filed Critical 大陸商業成科技(成都)有限公司
Application granted granted Critical
Publication of TWI815584B publication Critical patent/TWI815584B/en
Publication of TW202405520A publication Critical patent/TW202405520A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30204Marker
    • G06T2207/30208Marker matrix
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30244Camera pose

Abstract

A Lens focusing method and a system performing the same are provided. The lens focusing method performs steps by a computer unit during focusing. The steps are as followings: whenever a focus length position of an image module is adjusted, capturing a focused object image to generate a focused image by the image module; obtaining pixel grayscale values in a local position or a whole position of the focused image; computing a discrete distribution degree of the pixel grayscale values and an average-standard-deviation value of the discrete distribution degree; and after all the average-standard-deviation values respectively corresponding to the focus length positions of the image module are computed, determining a maximum of the average-standard-deviation values as an object focus length position.

Description

鏡頭調焦方法及其系統Lens focusing method and system

本發明有關於對焦方法,尤其一種利用鏡頭取得影像的最大平均標準差進行對焦的方法。The present invention relates to a focusing method, in particular to a method of focusing using a lens to obtain the maximum average standard deviation of an image.

以傳統的板上晶片型(Chip On Board,簡稱:COB)的攝影模組而言,其包括電路板(或稱基板)、影像擷取裸晶、鏡頭載座及光學鏡頭,影像擷取裸晶設置在電路板上,鏡頭載座設置在電路板上對應影像擷取裸晶的位置,光學鏡頭則活動設置在鏡頭載座上,讓光學鏡頭可以在鏡頭載座上移動而調整光學鏡頭與影像擷取裸晶之間的距離,進而達到調整影像擷取裸晶在取像的對焦位置進行調焦的目的。In terms of the traditional Chip On Board (COB) photography module, it includes a circuit board (or substrate), an image capture die, a lens mount and an optical lens. The image capture die The crystal is set on the circuit board, the lens holder is set on the circuit board at the position corresponding to the image capture die, and the optical lens is movably set on the lens holder, so that the optical lens can move on the lens holder and adjust the optical lens and The distance between the image capturing die is adjusted to achieve the purpose of adjusting the focus position of the image capturing die.

再進一步以光學鏡頭調焦而言,請參閱圖1或2所示,當光學鏡頭進行焦距調整時,通常是將攝影模組啟用擷取影像,再以人眼判斷所擷取的影像是否清晰或者是模糊不清,若是模糊不清則調整光學鏡頭與影像擷取裸晶之間的距離,直到人眼判斷認為已經達到影像清晰的目的。Taking the focus of the optical lens further, please refer to Figure 1 or 2. When the optical lens adjusts the focus, the photography module is usually activated to capture images, and then the human eye is used to judge whether the captured images are clear. Or it is blurry. If it is blurry, adjust the distance between the optical lens and the image capture die until the human eye judges that the image has been clear.

但是現在攝影模組的解析度越來越高,使用人工調焦的方式可能容易誤判或者攝影模組的焦距一致性有誤差,另一種光學鏡頭調焦方式為離焦深度法(DFD,Depth From  Defocus)。離焦深度法是透過擷取兩個或兩個以上不同離焦位置的影像,結合事先對攝影模組建立合適的數學模型,結合攝影模組的各種參數,推算出目標物體的離焦深度,從而判斷出焦點位置實現調焦。再一種為對焦深度法(DFF,Depth  From Focus),對焦深度法則是通過電腦(或者專用的電路系統)採集到一系列從模糊到清晰的的數位影像,對每一幀影像進行清晰度的評價函數處理,判斷調焦是否準確,即成像是否清晰,並給出回饋信號控制光學鏡頭的焦距,直到採集的數位影像達到最清晰,最終完成調焦。However, now that the resolution of photography modules is getting higher and higher, manual focusing may be easy to misjudge or the focal length consistency of the photography module may be inconsistent. Another optical lens focusing method is Depth From Defocus (DFD). Defocus). The defocus depth method is to calculate the defocus depth of the target object by capturing two or more images at different defocus positions, establishing a suitable mathematical model for the photography module in advance, and combining various parameters of the photography module. Thereby judging the focus position and adjusting the focus. Another method is Depth From Focus (DFF). The Depth From Focus method collects a series of digital images from blur to clear through a computer (or a dedicated circuit system), and evaluates the clarity of each frame of image. Function processing determines whether the focus adjustment is accurate, that is, whether the image is clear, and gives a feedback signal to control the focal length of the optical lens until the collected digital image reaches the clearest level, and finally completes the focus adjustment.

常用的評價函數有梯度評價函數、頻譜評價函數和統計學評價函數。梯度函數用來提取影像的邊緣資訊,對焦程度高的影像更清晰,呈現出更明顯的尖銳邊緣,影像具有更大的梯度函數值;頻譜評價函數中給出了離散余弦變換和傅立葉變換兩種函數,提取出影像中的高頻分量作為評價函數;統計學評價函數中主要有交流功率函數、直流功率函數、Range函數、Menmay函數、Masgrn函數以及影像灰階方差函數,以其中一種影像灰階方差函數(D(f))而言,當完全聚焦時影像最清晰,比模糊影像具有更大的灰階差異,故可將灰階變化作為聚焦評價的依據,其公式如下: 其中,x為水平方向像素點座標位置,y為垂直方向像素點座標位置, 為影像中某個位置像素點 的灰階值, 為整幅影像的平均灰階值。 Commonly used evaluation functions include gradient evaluation function, spectrum evaluation function and statistical evaluation function. The gradient function is used to extract the edge information of the image. The image with a high degree of focus is clearer, showing more obvious sharp edges, and the image has a larger gradient function value; the spectrum evaluation function provides two types of discrete cosine transform and Fourier transform Function, extract the high-frequency components in the image as the evaluation function; the statistical evaluation functions mainly include AC power function, DC power function, Range function, Menmay function, Masgrn function and image grayscale variance function. One of the image grayscale In terms of the variance function (D(f)), the image is the clearest when it is fully focused and has a greater grayscale difference than a blurred image. Therefore, the grayscale change can be used as the basis for focus evaluation. The formula is as follows: Among them, x is the coordinate position of the pixel point in the horizontal direction, y is the coordinate position of the pixel point in the vertical direction, is the grayscale value of a pixel at a certain position in the image, is the average grayscale value of the entire image.

據上所述,影像灰階方差函數自動調焦過程需要採集許多的影像,而灰階方差處理資料是為了讓灰階差異加大,在實際應用中,平方差的計算還是屬於較複雜的運算處理方式,因此如何讓計算簡單化,以達到快速、高效的處理要求,將是目前亟待解決的問題。According to the above, the automatic focusing process of the image grayscale variance function requires the collection of many images, and the grayscale variance processing data is to increase the grayscale difference. In practical applications, the calculation of the squared difference is still a relatively complex operation. Processing methods, so how to simplify calculations to achieve fast and efficient processing requirements will be an urgent problem to be solved.

有鑑於先前技術的問題,本發明的目的是提供一種調焦過程以更簡易更快速的評估過程,找出攝影模組的目標焦距位置。In view of the problems of the prior art, the purpose of the present invention is to provide a focusing process to facilitate a simpler and faster evaluation process to find the target focal length position of the photography module.

根據本發明之目的,提供一種鏡頭調焦方法,在調焦的過程中利用電子計算單元進行下列步驟,攝影模組擷取對調焦目標圖像產生調焦影像,影像處理模組對調焦影像分析取出全部位置或局部位置的像素點的灰階值,調焦分析模組計算所取得的各像素點的灰階值的離散分布程度,及計算離散分布程度的平均標準差,每次調整攝影模組的焦距位置即循環依次進行前述的所有步驟,直到取得攝影模組的全部焦距位置的平均標準差,自動調焦模組再找出所有平均標準差中最大者,此平均標準差中最大者所對應的焦距位置,即為目標焦距位置。According to the purpose of the present invention, a lens focusing method is provided. During the focusing process, an electronic computing unit is used to perform the following steps. The photography module captures the focusing target image to generate a focusing image, and the image processing module performs the focusing process. Image analysis extracts the grayscale values of pixels at all locations or local locations. The focus analysis module calculates the discrete distribution degree of the obtained grayscale values of each pixel point and calculates the average standard deviation of the discrete distribution degree. Each adjustment The focal length position of the photography module performs all the aforementioned steps in sequence until the average standard deviation of all focal length positions of the photography module is obtained. The automatic focusing module then finds the largest average standard deviation among all average standard deviations. The focal length position corresponding to the largest one is the target focal length position.

其中,調焦目標圖像為縱向與橫向分別由深色方格與淺色方格交錯排列形成,其中深色棋格為黑色棋格,淺色棋格為白色棋格所組成為佳。或者調焦目標圖像為不同粗細大小的一維條碼,有或者調焦目標圖像是二維條碼,或者調焦目標圖像為一維條碼與二維條碼的組合。Wherein, the focusing target image is composed of dark squares and light squares arranged vertically and horizontally respectively, preferably the dark squares are black squares and the light squares are white squares. Either the focus adjustment target image is a one-dimensional barcode of different thicknesses, or the focus adjustment target image is a two-dimensional barcode, or the focus adjustment target image is a combination of a one-dimensional barcode and a two-dimensional barcode.

其中,計算所取得的各像素點的灰階值的離散分布程度的方式係計算所有各像素點的灰階值予以平均取得平均灰階值,其公式表示如下: 其中 表示平均灰階值,m為調焦影像的橫向座標值,n為調焦影像的橫向座標值, 為座標 的灰階值。 再將各所有各像素點的灰階值與平均灰階值相減取絕對值作為離散分布程度,其公式表示如下: 其中 為各像素點的灰階值的離散分布程度, 為座標 的灰階值, 表示平均灰階值。 Among them, the way to calculate the degree of discrete distribution of the obtained gray-scale values of each pixel is to calculate the gray-scale values of all pixels and average them to obtain the average gray-scale value. The formula is expressed as follows: in represents the average gray level value, m is the lateral coordinate value of the focusing image, n is the lateral coordinate value of the focusing image, is the coordinate grayscale value. Then subtract the gray level value of each pixel from the average gray level value to obtain the absolute value as the degree of discrete distribution. The formula is expressed as follows: in is the discrete distribution degree of the grayscale value of each pixel, is the coordinate The grayscale value of Represents the average grayscale value.

其中,取得攝影模組的各焦距位置的平均標準差是將所有的離散分布程度予以平均計算而得,其公式表示如下: 其中 為各焦距位置的平均標準差, 為各像素點的灰階值的離散分布程度, m為調焦影像的橫向座標值,n為調焦影像的橫向座標值。 Among them, obtaining the average standard deviation of each focal length position of the photography module is calculated by averaging all discrete distribution degrees. The formula is expressed as follows: in is the average standard deviation of each focal length position, is the discrete distribution degree of the grayscale value of each pixel, m is the lateral coordinate value of the focusing image, and n is the lateral coordinate value of the focusing image.

根據本發明之目的,為提供一種鏡頭調焦系統,包括攝影模組、影像處理模組、調焦分析模組及焦距調整裝置,攝影模組拍攝調焦目標圖像產生調焦影像,影像處理模組連接攝影模組,並接收調焦影像,且對調焦影像進行處理取得全部位置或局部位置的像素點的灰階值,調焦分析模組連接影像處理模組,並接收各像素點的灰階值,且計算所取得的各像素點的灰階值的離散分布程度,以及計算離散分布程度的平均標準差,焦距調整裝置連接攝影模組,焦距調整裝置調整攝影模組到複數個焦距位置,攝影模組在各焦距位置都拍攝一次調焦目標圖像並分別產生各自的調焦影像。According to the purpose of the present invention, a lens focusing system is provided, which includes a photography module, an image processing module, a focus analysis module and a focus adjustment device. The photography module captures a focus target image to generate a focus image, and the image processing The module is connected to the photography module and receives the focus image, and processes the focus image to obtain the grayscale value of the pixels at all positions or local positions. The focus analysis module is connected to the image processing module and receives each pixel. The grayscale value of each pixel is calculated, and the discrete distribution degree of the obtained grayscale value of each pixel is calculated, and the average standard deviation of the discrete distribution degree is calculated. The focal length adjustment device is connected to the photography module, and the focal length adjustment device adjusts the photography module to a plurality of At the focal length position, the photography module captures the focusing target image once at each focal length position and generates respective focusing images.

其中,焦距調整裝置進一步連接調焦分析模組,調焦分析模組在每次完成取得當前焦距位置的平均標準差,則發出調整焦距訊號到焦距調整裝置,焦距調整裝置再調整攝影模組到下一個焦距位置,焦距調整裝置完成調整到下一個焦距位置,即會產生拍攝訊號到攝影模組,攝影模組則再對攝調焦目標圖像進行拍攝而產生下一個調焦影像。Among them, the focus adjustment device is further connected to the focus analysis module. Each time the focus analysis module completes obtaining the average standard deviation of the current focus position, it sends a focus adjustment signal to the focus adjustment device, and the focus adjustment device then adjusts the photography module to At the next focal length position, the focus adjustment device completes the adjustment to the next focal length position, which will generate a shooting signal to the photography module, and the photography module will then capture the focus target image to generate the next focus image.

其中,調焦分析模組分析目前所獲得的各焦距位置的平均標準差的變化趨勢為逐漸增加到其中一個各焦距位置的平均標準差後開始逐漸減少,即停止發出調整焦距訊號,並以其中最大的平均標準差的焦距位置為目標焦距位置。Among them, the focusing analysis module analyzes the change trend of the average standard deviation of each focal length position currently obtained, which gradually increases to one of the average standard deviations of each focal length position and then gradually decreases, that is, it stops sending the focus adjustment signal, and uses the The focal length position with the largest average standard deviation is the target focal length position.

其中,焦距調整裝置依據的複數個調整焦距訊號調整攝影模組的焦距位置,調焦分析模組分析所獲得的各焦距位置的平均標準差的變化趨勢為逐漸減少,則焦距調整裝置發出的調整焦距訊號為令焦距調整裝置往反向調整焦距位置,並使平均標準差的變化趨勢轉為逐漸增加到其中一個各焦距位置的平均標準差後開始逐漸減少,並以其中最大的平均標準差的焦距位置為目標焦距位置。Among them, the focus adjustment device adjusts the focal length position of the photography module based on a plurality of adjustment focus signals, and the focus analysis module analyzes the change trend of the average standard deviation of each focal length position obtained to gradually decrease, then the adjustment signal issued by the focus adjustment device The focal length signal causes the focal length adjustment device to adjust the focal length position in the opposite direction, and causes the changing trend of the average standard deviation to gradually increase to the average standard deviation of one of the focal length positions and then gradually decrease, and to the maximum average standard deviation. The focal length position is the target focal length position.

綜上所述,本發明的影像處理模組對調焦影像分析取出全部位置或局部位置的像素點的灰階值後,計算各灰階值的離散程度與平均標準差,並不需要計算平方差,減少計算的難度,從而加速處理速度。To sum up, the image processing module of the present invention analyzes the focus image and extracts the grayscale values of the pixels at all positions or local positions, and then calculates the degree of dispersion and average standard deviation of each grayscale value without the need to calculate the square difference, reducing the difficulty of calculation and thus speeding up processing.

本發明之實施例將藉由下文配合相關圖式進一步加以解說。盡可能的,於圖式與說明書中,相同標號係代表相同或相似構件。於圖式中,基於簡化與方便標示,形狀與厚度可能經過誇大表示。可以理解的是,未特別顯示於圖式中或描述於說明書中之元件,為所屬技術領域中具有通常技術者所知之形態。本領域之通常技術者可依據本發明之內容而進行多種之改變與修改。The embodiments of the present invention will be further explained below with reference to relevant drawings. Wherever possible, the same reference numbers are used in the drawings and description to refer to the same or similar components. In the drawings, shapes and thicknesses may be exaggerated for simplicity and ease of notation. It should be understood that components not specifically shown in the drawings or described in the specification are in forms known to those of ordinary skill in the art. Those skilled in the art can make various changes and modifications based on the contents of the present invention.

當一個元件被稱為『在…上』時,它可泛指該元件直接在其他元件上,也可以是有其他元件存在於兩者之中。相反地,當一個元件被稱為『直接在』另一元件,它是不能有其他元件存在於兩者之中間。如本文所用,詞彙『及/或』包含了列出的關聯項目中的一個或多個的任何組合。When an element is referred to as being "on", it can generally mean that the element is directly on the other element, or that the other element exists between them. Conversely, when an element is said to be "directly on" another element, it cannot have other elements between them. As used herein, the term "and/or" includes any combination of one or more of the associated listed items.

於下文中關於“一個實施例”或“一實施例”之描述係指關於至少一實施例內所相關連之一特定元件、結構或特徵。因此,於下文中多處所出現之“一個實施例”或 “一實施例”之多個描述並非針對同一實施例。再者,於一或多個實施例中之特定構件、結構與特徵可依照一適當方式而結合。References below to "one embodiment" or "an embodiment" refer to a particular element, structure, or feature associated with at least one embodiment. Therefore, “one embodiment” or multiple descriptions of “an embodiment” appearing in multiple places below are not directed to the same embodiment. Furthermore, specific components, structures and features in one or more embodiments may be combined in an appropriate manner.

揭露特別以下述例子加以描述,這些例子僅係用以舉例說明而已,因為對於熟習此技藝者而言,在不脫離本揭示內容之精神和範圍內,當可作各種之更動與潤飾,因此本揭示內容之保護範圍當視後附之申請專利範圍所界定者為準。在通篇說明書與申請專利範圍中,除非內容清楚指定,否則「一」以及「該」的意義包含這一類敘述包括「一或至少一」該元件或成分。此外,如本揭露所用,除非從特定上下文明顯可見將複數個排除在外,否則單數冠詞亦包括複數個元件或成分的敘述。而且,應用在此描述中與下述之全部申請專利範圍中時,除非內容清楚指定,否則「在其中」的意思可包含「在其中」與「在其上」。在通篇說明書與申請專利範圍所使用之用詞(terms),除有特別註明,通常具有每個用詞使用在此領域中、在此揭露之內容中與特殊內容中的平常意義。某些用以描述本揭露之用詞將於下或在此說明書的別處討論,以提供從業人員(practitioner)在有關本揭露之描述上額外的引導。在通篇說明書之任何地方之例子,包含在此所討論之任何用詞之例子的使用,僅係用以舉例說明,當然不限制本揭露或任何例示用詞之範圍與意義。同樣地,本揭露並不限於此說明書中所提出之各種實施例。The disclosure is specifically described with the following examples. These examples are only for illustration, because for those who are familiar with this art, various modifications and modifications can be made without departing from the spirit and scope of the disclosure. Therefore, this disclosure The scope of protection of the disclosed content shall be determined by the scope of the patent application attached. Throughout the specification and claims, unless the content clearly dictates otherwise, the meaning of "a" and "the" includes such statements including "one or at least one" of the element or component. Furthermore, as used in this disclosure, the singular article also includes recitations of plural elements or ingredients unless it is obvious from the particular context that the plural is excluded. Furthermore, as applied to this description and all claims below, "in" may mean "in" and "on" unless the context clearly dictates otherwise. Unless otherwise noted, the terms used throughout the specification and patent claims generally have their ordinary meanings as used in the field, in the disclosure and in the particular context. Certain terms used to describe the disclosure are discussed below or elsewhere in this specification to provide practitioners with additional guidance in describing the disclosure. The use of examples anywhere throughout this specification, including the use of examples of any terminology discussed herein, is for illustrative purposes only and does not, of course, limit the scope and meaning of the disclosure or any exemplified terminology. Likewise, the present disclosure is not limited to the various embodiments set forth in this specification.

可了解如在此所使用的用詞「包含(comprising)」、「包含(including)」、「具有(having)」、「含有(containing)」、「包含(involving)」等等,為開放性的(open-ended),即意指包含但不限於。另外,本發明的任一實施例或申請專利範圍不須達成本發明所揭露之全部目的或優點或特點。此外,摘要部分和標題僅是用來輔助專利文件搜尋之用,並非用來限制發明作之申請專利範圍。It should be understood that the terms "comprising", "including", "having", "containing", "involving", etc., as used herein, are open-ended (open-ended), meaning including but not limited to. In addition, any embodiment or patentable scope of the present invention does not necessarily achieve all the purposes, advantages or features disclosed in the present invention. In addition, the abstract part and title are only used to assist in searching for patent documents and are not used to limit the scope of the patent application for the invention.

此外,若使用「電(性)耦接」或「電(性)連接」一詞在此係包含任何直接及間接的電氣連接手段。舉例而言,若文中描述一第一裝置電性耦接於一第二裝置,則代表該第一裝置可直接連接於該第二裝置,或透過其他裝置或連接手段間接地連接至該第二裝置。另外,若描述關於電訊號之傳輸、提供,熟習此技藝者應該可了解電訊號之傳遞過程中可能伴隨衰減或其他非理想性之變化,但電訊號傳輸或提供之來源與接收端若無特別敘明,實質上應視為同一訊號。舉例而言,若由電子電路之端點A傳輸(或提供)電訊號S給電子電路之端點B,其中可能經過一電晶體開關之源汲極兩端及/或可能之雜散電容而產生電壓降,但此設計之目的若非刻意使用傳輸(或提供)時產生之衰減或其他非理想性之變化而達到某些特定的技術效果,電訊號S在電子電路之端點A與端點B應可視為實質上為同一訊號。In addition, if the term "electrical (sexual) coupling" or "electrical (sexual) connection" is used here, it includes any direct and indirect electrical connection means. For example, if a first device is described as being electrically coupled to a second device, it means that the first device can be directly connected to the second device, or indirectly connected to the second device through other devices or connections. device. In addition, if the description is about the transmission and provision of electrical signals, those familiar with this art should be able to understand that the transmission process of electrical signals may be accompanied by attenuation or other non-ideal changes, but if the source and receiving end of the transmission or provision of electrical signals are not special Description, essentially should be regarded as the same signal. For example, if an electrical signal S is transmitted (or provided) from terminal A of an electronic circuit to terminal B of an electronic circuit, it may pass through the source and drain ends of a transistor switch and/or possible stray capacitance. A voltage drop is generated, but if the purpose of this design is not to deliberately use the attenuation or other non-ideal changes produced during transmission (or provision) to achieve certain technical effects, the electrical signal S is at the endpoint A and endpoint of the electronic circuit. B should be regarded as essentially the same signal.

除非特別說明,一些條件句或字詞,例如「可以(can)」、「可能(could)」、「也許(might)」,或「可(may)」,通常是試圖表達本案實施例具有,但是也可以解釋成可能不需要的特徵、元件,或步驟。在其他實施例中,這些特徵、元件,或步驟可能是不需要的。Unless otherwise specified, some conditional sentences or words, such as "can", "could", "might", or "may", usually try to express that the embodiment of this case has, But it can also be interpreted as features, components, or steps that may not be needed. In other embodiments, these features, elements, or steps may not be required.

請參閱圖1所示,本發明為一種鏡頭調焦系統,包括攝影模組1、影像處理模組2、調焦分析模組3及焦距調整裝置4,其中攝影模組1位於相對調焦目標圖像的預定位置,並且拍攝調焦目標圖像產生調焦影像。影像處理模組2則連接攝影模組1,並接收調焦影像,且影像處理模對調焦影像進行處理取得全部位置或局部位置的像素點的灰階值。調焦分析模組3連接影像處理模組2,並接收各像素點的灰階值,且計算所取得的各像素點的灰階值的離散分布程度,以及計算離散分布程度的平均標準差。Please refer to Figure 1. The present invention is a lens focusing system, which includes a photography module 1, an image processing module 2, a focus analysis module 3 and a focus adjustment device 4. The photography module 1 is located at the relative focusing target. a predetermined position of the image, and capture the focus target image to generate a focus image. The image processing module 2 is connected to the photography module 1 and receives the focus image, and the image processing module processes the focus image to obtain the grayscale values of the pixels at all positions or local positions. The focus analysis module 3 is connected to the image processing module 2, and receives the grayscale value of each pixel point, and calculates the discrete distribution degree of the obtained grayscale value of each pixel point, and calculates the average standard deviation of the discrete distribution degree.

請參閱圖2所示,在本發明中,攝影模組1包括電路板10(或稱基板)、影像擷取裸晶12、鏡頭載座14及光學鏡頭16,影像擷取裸晶12攝在電路板10上,鏡頭載座14設在電路板於影像擷取裸晶12的周圍,光學鏡頭16活動地設在鏡頭載座14,透過調整光學鏡頭16在鏡頭載座上轉動,即可調整光學鏡頭16與影像擷取裸晶12之間的距離,而調整焦距位置可以手動調整光學鏡頭16或者自動調焦,以自動調焦而言,在本發明中乃將焦距調整裝置4連接攝影模組1,焦距調整裝置4調整攝影模組1到複數個焦距位置,攝影模組1在各焦距位置都拍攝一次調焦目標圖像並分別產生各自的調焦影像。通常鏡頭載座14與光學鏡頭16之間是以螺紋相接在一起,因此可以透過轉動光學鏡頭16調整光學鏡頭16與影像擷取裸晶12之間的距離。Please refer to Figure 2. In the present invention, the photography module 1 includes a circuit board 10 (or substrate), an image capture die 12, a lens mount 14 and an optical lens 16. The image capture die 12 is photographed on On the circuit board 10, the lens holder 14 is disposed on the circuit board around the image capture die 12. The optical lens 16 is movably disposed on the lens holder 14. By adjusting the optical lens 16 and rotating on the lens holder, the adjustment can be made. The distance between the optical lens 16 and the image capture die 12 is determined by adjusting the focal length position by manually adjusting the optical lens 16 or automatically adjusting the focus. In terms of automatic focusing, in the present invention, the focus adjustment device 4 is connected to the photography module. Group 1, the focus adjustment device 4 adjusts the photography module 1 to a plurality of focal length positions. The photography module 1 captures a focus target image at each focal length position and generates respective focus images. Usually, the lens mount 14 and the optical lens 16 are connected together by threads, so the distance between the optical lens 16 and the image capturing die 12 can be adjusted by rotating the optical lens 16.

在本發明中,請參閱圖3A所示,調焦目標圖像可使用灰階對比高的規律或無規律的圖像,舉例而言,調焦目標圖像可為縱向與橫向分別由深色方格與淺色方格交錯排列形成,尤其是,深色棋格為黑色棋格,淺色棋格為白色棋格所組成為佳。或者調焦目標圖像為不同粗細大小的一維條碼,或者調焦目標圖像是二維條碼,或者調焦目標圖像為一維條碼與二維條碼的組合,其中二維條碼可為快速回應圖碼(Quick Response Code,簡稱:QR Code)。In the present invention, please refer to FIG. 3A. The focusing target image can use a regular or irregular image with high gray scale contrast. For example, the focusing target image can be a vertical and horizontal image composed of dark colors respectively. The squares and light-colored squares are arranged in a staggered manner. In particular, it is better to have dark-colored squares with black squares and light-colored squares with white squares. Either the focusing target image is a one-dimensional barcode of different thicknesses, or the focusing target image is a two-dimensional barcode, or the focusing target image is a combination of a one-dimensional barcode and a two-dimensional barcode, in which the two-dimensional barcode can be a rapid Quick Response Code (QR Code).

在本發明中,以深色棋格為黑色棋格,淺色棋格為白色棋格所組成調焦目標圖像為例,說明採用灰階對比高的圖像作為調焦目標圖像的原因,當攝影模組1拍攝由深色方格與淺色方格交錯排列形成的調焦目標圖像後,調焦影像進行各像素點對應黑色棋格的灰階值趨近於0或等於0,而各像素點對應白色棋格的灰階值則趨近於255或等於255,因此,當調焦影像的各像素點的灰階值相差越大,則表示調焦影像越清晰,故在不同的調焦影像中具有最大的灰階值差異者,即為目標焦距位置。In the present invention, the focus target image composed of dark checkers as black checkers and light checkers as white checkers is used as an example to illustrate the reason for using an image with high gray scale contrast as the focus target image. , when the photography module 1 captures the focus target image formed by the staggered arrangement of dark squares and light squares, the grayscale value of each pixel corresponding to the black checkerboard in the focus image approaches 0 or equals 0 , and the grayscale value of each pixel corresponding to the white checkerboard is close to 255 or equal to 255. Therefore, when the grayscale value difference of each pixel of the focus image is larger, it means the focus image is clearer, so in The one with the largest grayscale value difference among different focusing images is the target focal length position.

為更清楚解調焦影像的各像素點的灰階值的差距,與不同焦距位置拍攝的調焦影像的對應關係,提供了不同焦距位置拍攝的調焦影像及其灰階分布進行說明,請參閱圖3A~3C圖所示,分別為目標焦距位置所拍攝的調焦影像,以及三個非目標焦距位置所拍攝的調焦影像,而圖4A~4C則為最下方的X方向座標的各像素點的灰階值的分布圖。In order to more clearly understand the difference in the grayscale value of each pixel in the focus image and the corresponding relationship between the focus images taken at different focal length positions, focus images taken at different focal length positions and their grayscale distribution are provided for explanation. Please Refer to Figures 3A to 3C, which show the focus images taken at the target focal length position and the focus images taken at three non-target focal length positions. Figures 4A to 4C show the X-direction coordinates at the bottom. Distribution map of grayscale values of pixels.

為了讓焦距調整裝置4可以進一步地於調焦分析模組3每次取得當前焦距位置的平均標準差後,隨即可進行焦距調整,在本發明中,焦距調整裝置4進一步連接調焦分析模組3,調焦分析模組3在每次完成取得當前焦距位置的平均標準差,則發出調整焦距訊號到焦距調整裝置4,焦距調整裝置4再調整攝影模組1到下一個焦距位置,焦距調整裝置4完成調整到下一個焦距位置,即會產生拍攝訊號到攝影模組1,攝影模組1則再對調焦目標圖像進行拍攝而產生下一個調焦影像。In order to allow the focus adjustment device 4 to further perform focus adjustment after the focus analysis module 3 obtains the average standard deviation of the current focus position each time, in the present invention, the focus adjustment device 4 is further connected to the focus analysis module 3. The focus analysis module 3 obtains the average standard deviation of the current focus position each time, and then sends a focus adjustment signal to the focus adjustment device 4. The focus adjustment device 4 then adjusts the photography module 1 to the next focus position. The focus adjustment After the device 4 completes adjusting to the next focus position, it will generate a shooting signal to the photography module 1, and the photography module 1 will capture the focus target image to generate the next focus image.

但本發明在實際實施時,焦距調整裝置4並非一定以接收調焦分析模組3所發出的調整焦距訊號,才能調整攝影模組1的焦距位置,焦距調整裝置4也可以在電性連接攝影模組1,並於攝影模組1每次完成拍攝一張調焦影像後,接收攝影模組1完成拍攝訊號作為調整焦距訊號。However, when the present invention is actually implemented, the focus adjustment device 4 does not have to receive the focus adjustment signal sent by the focus analysis module 3 in order to adjust the focus position of the photography module 1. The focus adjustment device 4 can also be electrically connected to the camera. Module 1, and each time the photography module 1 completes shooting a focus-adjusted image, it receives the shooting completion signal of the photography module 1 as a focus adjustment signal.

在本發明中,焦距調整裝置4可以將攝影模組1的光學模組從0度~360度的焦距位置分別一次調整相同角度進行調焦,例如:每次調整1度一共調整360次即可取得全部角度的調焦影像,並從這些調焦影像中取得離散分布程度的平均標準差,其中最大者即為目標焦距位置。然而若攝影模組1的一直往相同的方向調整焦距,使得光學模組與影像擷取裸晶12之間的距離越來越大或越來越少,對應的調焦影像也是逐漸越來越清晰或者越來越模糊,因此根據這樣的趨勢變化,當調焦分析模組3分析目前所獲得的各焦距位置的平均標準差的變化趨勢為逐漸增加到其中一個各焦距位置的平均標準差後開始逐漸減少,即停止發出調整焦距訊號,並以其中最大的平均標準差的焦距位置為目標焦距位置。In the present invention, the focal length adjustment device 4 can adjust the optical module of the photography module 1 from the focal length position of 0 degrees to 360 degrees at the same angle once to adjust the focus. For example, a total of 360 adjustments can be made by adjusting 1 degree each time. Focusing images from all angles are obtained, and the average standard deviation of the discrete distribution degrees is obtained from these focusing images. The largest one is the target focal length position. However, if the photography module 1 keeps adjusting the focal length in the same direction, so that the distance between the optical module and the image capture die 12 becomes larger or smaller, the corresponding focused image will also gradually become smaller and smaller. clear or increasingly blurry. Therefore, according to such trend changes, when the focus analysis module 3 analyzes the current change trend of the average standard deviation of each focal length position, it gradually increases to one of the average standard deviations of each focal length position. It starts to gradually decrease, that is, it stops sending the focus adjustment signal, and the focus position with the largest average standard deviation is used as the target focus position.

或者,當焦距調整裝置4依據的複數個調整焦距訊號調整攝影模組1的焦距位置,調焦分析模組3分析所獲得的各焦距位置的平均標準差的變化趨勢為逐漸減少,則焦距調整裝置4發出的調整焦距訊號為令焦距調整裝置4往反向調整焦距位置,並使平均標準差的變化趨勢轉為逐漸增加到其中一個各焦距位置的平均標準差後開始逐漸減少,並以其中最大的平均標準差的焦距位置為目標焦距位置。Or, when the focus adjustment device 4 adjusts the focus position of the photography module 1 based on a plurality of focus adjustment signals, and the focus analysis module 3 analyzes the change trend of the average standard deviation of each focus position obtained to gradually decrease, then the focus adjustment The focus adjustment signal sent by the device 4 causes the focus adjustment device 4 to adjust the focal length position in the opposite direction, and the changing trend of the average standard deviation gradually increases to one of the average standard deviations of each focal length position and then gradually decreases. The focal length position with the largest average standard deviation is the target focal length position.

藉由上述的調整方式,攝影模組1即可無需由0度~360度的焦距位置進行調焦,只要依照前述的趨勢變化進行調整焦距位置,即可減少調整次數,從而加速完成調焦。Through the above adjustment method, the photography module 1 does not need to adjust the focus from the focal length position of 0 degrees to 360 degrees. It only needs to adjust the focal length position according to the aforementioned trend changes, which can reduce the number of adjustments and speed up the completion of the focus adjustment.

請參閱圖5所示,本發明為一種鏡頭調焦方法,在調焦的過程中利用電子計算單元進行下列步驟: (S100)調整攝影模組1的焦距位置; (S101)攝影模組1擷取對調焦目標圖像產生調焦影像; (S102)影像處理模組2對調焦影像分析取出全部位置或局部位置的像素點的灰階值; (S103)調焦分析模組3計算所取得的各像素點的灰階值的離散分布程度,及計算離散分布程度的平均標準差; (S104)判斷是否完成調整攝影模組1的各焦距位置,若是進行步驟(S105),否則進行步驟(S100); (S105)自動調焦模組再找出所有平均標準差中最大者,此平均標準差中最大者所對應的焦距位置,即為目標焦距位置。 Please refer to Figure 5. The present invention is a lens focusing method. During the focusing process, an electronic computing unit is used to perform the following steps: (S100) Adjust the focal length position of the photography module 1; (S101) The photography module 1 captures the focus target image to generate a focus image; (S102) The image processing module 2 analyzes the focused image to obtain the grayscale values of pixels at all positions or partial positions; (S103) The focus analysis module 3 calculates the discrete distribution degree of the obtained grayscale value of each pixel point, and calculates the average standard deviation of the discrete distribution degree; (S104) Determine whether the adjustment of each focal length position of the photography module 1 is completed, if so, proceed to step (S105), otherwise, proceed to step (S100); (S105) The automatic focusing module then finds the largest average standard deviation among all average standard deviations. The focal length position corresponding to the largest average standard deviation is the target focal length position.

在本發明中,調焦目標圖像為縱向與橫向分別由深色方格與淺色方格交錯排列形成,其中深色棋格為黑色棋格,淺色棋格為白色棋格所組成為佳。或者調焦目標圖像為不同粗細大小的一維條碼,有或者調焦目標圖像是二維條碼,或者調焦目標圖像為一維條碼與二維條碼的組合。In the present invention, the focus target image is formed by staggered dark squares and light squares in the vertical and horizontal directions, where the dark squares are black squares and the light squares are white squares. good. Either the focus adjustment target image is a one-dimensional barcode of different thicknesses, or the focus adjustment target image is a two-dimensional barcode, or the focus adjustment target image is a combination of a one-dimensional barcode and a two-dimensional barcode.

在本發明中,計算所取得的各像素點的灰階值的離散分布程度的方式係計算所有各像素點的灰階值予以平均取得平均灰階值,其公式表示如下: 其中 表示平均灰階值,m為調焦影像的橫向座標值,n為調焦影像的橫向座標值, 為座標 的灰階值,如圖6為圖3A的各像素點的灰階值的分布狀態示意圖,圖中 下方的線條表示平均灰階值,如圖7為圖3C的各像素點的灰階值的分布狀態示意圖,圖中 下方的線條表示平均灰階值。 In the present invention, the method for calculating the degree of discrete distribution of the obtained gray-scale values of each pixel is to calculate the gray-scale values of all pixels and average them to obtain the average gray-scale value. The formula is expressed as follows: in represents the average gray level value, m is the lateral coordinate value of the focusing image, n is the lateral coordinate value of the focusing image, is the coordinate The gray scale value, Figure 6 is a schematic diagram of the distribution status of the gray scale value of each pixel point in Figure 3A, in the figure The lower line represents the average gray-scale value. Figure 7 is a schematic diagram of the distribution status of the gray-scale value of each pixel in Figure 3C. In the figure The lower line represents the average grayscale value.

再將各所有各像素點的灰階值與平均灰階值相減取絕對值作為離散分布程度,其公式表示如下: 其中 為各像素點的灰階值的離散分布程度, 為座標 的灰階值, 表示平均灰階值。如圖8為圖6的離散分布程度示意圖,如圖9為圖7的離散分布程度示意圖。 Then subtract the gray level value of each pixel from the average gray level value to obtain the absolute value as the degree of discrete distribution. The formula is expressed as follows: in is the discrete distribution degree of the grayscale value of each pixel, is the coordinate The grayscale value of Represents the average grayscale value. Figure 8 is a schematic diagram of the discrete distribution degree of Figure 6, and Figure 9 is a schematic diagram of the discrete distribution degree of Figure 7.

又,取得攝影模組1的全部焦距位置的平均標準差是將所有的離散分布程度予以平均計算而得,其公式表示如下: 其中 為各焦距位置的平均標準差, 為各像素點的灰階值的離散分布程度, m為調焦影像的橫向座標值,n為調焦影像的橫向座標值。 In addition, obtaining the average standard deviation of all focal length positions of the photography module 1 is calculated by averaging all discrete distribution degrees. The formula is expressed as follows: in is the average standard deviation of each focal length position, is the discrete distribution degree of the grayscale value of each pixel, m is the lateral coordinate value of the focusing image, and n is the lateral coordinate value of the focusing image.

此外,為了減少對調焦影像的灰階值、平均灰階值、離散分布程度與平均標準差的計算量,本發明可以只取用調焦影像的局部影像進行計算即可,但並非限制本發明僅能取用調焦影像的局部影像進行計算,本發明能仍可以針對整個調焦影像的全部影像進行計算。In addition, in order to reduce the amount of calculation of the gray scale value, average gray scale value, discrete distribution degree and average standard deviation of the focusing image, the present invention can only use the partial image of the focusing image for calculation, but this is not limited to this. The present invention can only use partial images of the focus-adjusted image for calculation, but the present invention can still perform calculations for all images of the entire focus-adjusted image.

據上所述,本發明可以利用簡單快速的方式完成調整焦距,而且評價函數比傳統的評價函數更為簡單,讓本發明可以更快速地完成運算,並且完成攝影模組1的調焦工作。According to the above, the present invention can adjust the focus in a simple and fast manner, and the evaluation function is simpler than the traditional evaluation function, allowing the present invention to complete the calculation more quickly and complete the focus adjustment work of the photography module 1.

以上所述,僅為舉例說明本創作的較佳實施方式,並非以此限定實施的範圍,凡是依本創作申請專利範圍及專利說明書內容所作的簡單置換及等效變化,皆屬本創作的專利申請範疇。The above are only examples to illustrate the preferred implementation of this invention, and are not intended to limit the scope of implementation. All simple substitutions and equivalent changes made based on the patent scope of this invention and the content of the patent specification are all patents of this invention. Application scope.

1:攝影模組 10:電路板 12:影像擷取裸晶 14:鏡頭載座 16:光學鏡頭 2:影像處理模組 3:調焦分析模組 4:焦距調整裝置 S100~S105:流程步驟 1: Photography module 10:Circuit board 12:Image capture bare crystal 14: Lens mount 16: Optical lens 2:Image processing module 3: Focus analysis module 4:Focus adjustment device S100~S105: Process steps

圖1為本發明的鏡頭調焦系統的架構示意圖; 圖2為本發明的攝影模組的剖面示意圖; 圖3A為本發明的調焦目標圖像(目標調焦位置的調焦影像)的示意圖; 圖3B為本發明的非目標調焦位置的調焦影像的示意圖; 圖3C為本發明的另一非目標調焦位置的調焦影像的示意圖; 圖4A為圖3A的其中一個同一水平方向的像素點之灰階分布示意圖; 圖4B為圖3B的其中一個同一水平方向的像素點之灰階分布示意圖; 圖4C為圖3C的其中一個同一水平方向的像素點之灰階分布示意圖; 圖5為本發明的鏡頭調焦方法的流程示意圖; 圖6為圖3A的所有像素點的灰階值分布示意圖; 圖7為圖3C的所有像素點的灰階值分布示意圖; 圖8為圖3A的離散分布程度示意圖; 圖9為圖3C的離散分布程度示意圖。 Figure 1 is a schematic structural diagram of the lens focusing system of the present invention; Figure 2 is a schematic cross-sectional view of the photography module of the present invention; 3A is a schematic diagram of the focus target image (focus image of the target focus position) of the present invention; Figure 3B is a schematic diagram of a focusing image at a non-target focusing position according to the present invention; Figure 3C is a schematic diagram of a focusing image at another non-target focusing position according to the present invention; Figure 4A is a schematic diagram of the grayscale distribution of one of the pixels in the same horizontal direction in Figure 3A; Figure 4B is a schematic diagram of the grayscale distribution of one of the pixels in the same horizontal direction in Figure 3B; Figure 4C is a schematic diagram of the grayscale distribution of one of the pixels in the same horizontal direction in Figure 3C; Figure 5 is a schematic flow chart of the lens focusing method of the present invention; Figure 6 is a schematic diagram of the grayscale value distribution of all pixels in Figure 3A; Figure 7 is a schematic diagram of the grayscale value distribution of all pixels in Figure 3C; Figure 8 is a schematic diagram of the discrete distribution degree of Figure 3A; Figure 9 is a schematic diagram of the discrete distribution degree of Figure 3C.

1:攝影模組 1: Photography module

2:影像處理模組 2:Image processing module

3:調焦分析模組 3: Focus analysis module

4:焦距調整裝置 4:Focus adjustment device

Claims (11)

一種鏡頭調焦方法,在調焦的過程中利用電子計算單元進行下列步驟: 調整攝影模組的焦距位置; 使用一攝影模組擷取一對調焦目標圖像產生一調焦影像; 使用一影像處理模組對該調焦影像分析取出全部位置或局部位置的像素點的灰階值; 使用一調焦分析模組計算所取得的各該像素點的灰階值的一離散分布程度,及計算該離散分布程度的一平均標準差; 判斷是否完成調整該攝影模組的各焦距位置; 當判斷已完成調整該攝影模組的各焦距位置,則該自動調焦模組再找出所有平均標準差中最大者,並以該平均標準差中最大者所對應的焦距位置,即為目標焦距位置;以及 當判斷未完成調整該攝影模組的各焦距位置,則在依照調整攝影模組的焦距位置的步驟進行處理。 A lens focusing method that uses an electronic computing unit to perform the following steps during the focusing process: Adjust the focal length position of the photography module; Use a photography module to capture a pair of focus target images to generate a focus image; Use an image processing module to analyze the focusing image and obtain the grayscale values of pixels at all positions or partial positions; Use a focus analysis module to calculate a degree of discrete distribution of the obtained grayscale values of each pixel point, and calculate an average standard deviation of the degree of discrete distribution; Determine whether the adjustment of each focal length position of the photography module has been completed; When it is determined that the adjustment of each focal length position of the photography module has been completed, the automatic focusing module then finds the largest average standard deviation among all, and uses the focal length position corresponding to the largest average standard deviation as the target. focal length position; and When it is determined that the adjustment of each focal length position of the photography module has not been completed, the process is performed according to the steps of adjusting the focal length position of the photography module. 如請求項1所述的鏡頭調焦方法,其中該調焦目標圖像為縱向與橫向分別由深色方格與淺色方格交錯排列形成。The lens focusing method according to claim 1, wherein the focusing target image is formed by staggered dark squares and light squares in the vertical and horizontal directions respectively. 如請求項2所述的鏡頭調焦方法,其中深色棋格為黑色棋格,淺色棋格為白色棋格所組成為佳。As for the lens focusing method described in claim 2, it is better that the dark checkerboard is a black checkerboard and the light-colored checkerboard is a white checkerboard. 如請求項1所述的鏡頭調焦方法,其中該調焦目標圖像為不同粗細大小的一維條碼,或者調焦目標圖像是二維條碼,或者調焦目標圖像為一維條碼與二維條碼的組合。The lens focusing method as described in claim 1, wherein the focusing target image is a one-dimensional barcode of different thicknesses, or the focusing target image is a two-dimensional barcode, or the focusing target image is a one-dimensional barcode and a combination of A combination of 2D barcodes. 如請求項1所述的鏡頭調焦方法,其中調焦分析模組計算所取得的各該像素點的灰階值的該離散分布程度的方式,為計算各該像素點的灰階值予以平均取得平均灰階值,其公式表示如下: ; 其中 表示平均灰階值,m為該調焦目標圖像的橫向座標值,n為調焦目標圖像的橫向座標值, 為座標 的灰階值。 The lens focusing method as described in claim 1, wherein the focusing analysis module calculates the discrete distribution degree of the obtained gray-scale values of each pixel point by calculating and averaging the gray-scale values of each pixel point. To obtain the average gray level value, the formula is as follows: ; in Represents the average gray level value, m is the lateral coordinate value of the focusing target image, n is the lateral coordinate value of the focusing target image, is the coordinate grayscale value. 如請求項5所述的鏡頭調焦方法,其中各該像素點的灰階值與平均灰階值相減取絕對值作為離散分布程度,其公式表示如下: ; 其中 為各像素點的灰階值的離散分布程度, 為座標 的灰階值, 表示平均灰階值。 The lens focusing method as described in claim 5, wherein the grayscale value of each pixel is subtracted from the average grayscale value and the absolute value is taken as the degree of discrete distribution. The formula is expressed as follows: ; in is the discrete distribution degree of the grayscale value of each pixel, is the coordinate The grayscale value of Represents the average grayscale value. 如請求項6所述的鏡頭調焦方法,其中取得攝影模組的全部焦距位置的平均標準差是將所有的離散分布程度予以平均計算而得,其公式表示如下: ; 其中 為各焦距位置的平均標準差, 為各像素點的灰階值的離散分布程度, m為調焦影像的橫向座標值,n為調焦影像的橫向座標值。 The lens focusing method as described in claim 6, wherein obtaining the average standard deviation of all focal length positions of the photography module is calculated by averaging all discrete distribution degrees, and the formula is expressed as follows: ; in is the average standard deviation of each focal length position, is the discrete distribution degree of the grayscale value of each pixel, m is the lateral coordinate value of the focusing image, and n is the lateral coordinate value of the focusing image. 一種鏡頭調焦系統,包括: 一攝影模組,該攝影模組拍攝一調焦目標圖像產生一調焦影像; 一影像處理模組,該影像處理模組連接該攝影模組,並接收該調焦影像,且該對調焦影像進行處理取得全部位置或局部位置的像素點的灰階值; 一調焦分析模組,該調焦分析模組連接該影像處理模組,並接收各該像素點的灰階值,且計算所取得的各該像素點的灰階值的一離散分布程度,以及計算該離散分布程度的一平均標準差;及 一焦距調整裝置,該焦距調整裝置連接該攝影模組,該焦距調整裝置調整該攝影模組到複數個焦距位置,該攝影模組在各該焦距位置都拍攝一次該調焦目標圖像並分別產生各自的該調焦影像。 A lens focusing system, including: A photography module that captures a focus target image to generate a focus image; An image processing module, the image processing module is connected to the photography module, and receives the focus image, and processes the focus image to obtain the grayscale values of pixels at all positions or partial positions; A focusing analysis module, which is connected to the image processing module, receives the grayscale value of each pixel, and calculates a discrete distribution degree of the obtained grayscale value of each pixel, and calculate a mean standard deviation of the degree of dispersion; and A focal length adjustment device connected to the photography module, the focus adjustment device adjusts the photography module to a plurality of focal length positions, and the photography module captures the focus target image once at each focal length position and separately Produce respective focused images. 如請求項8所述的鏡頭調焦系統,其中該焦距調整裝置連接該調焦分析模組,該調焦分析模組在每次完成取得當前焦距位置的該平均標準差,則發出該調整焦距訊號到該焦距調整裝置,該焦距調整裝置再調整該攝影模組到下一個焦距位置,該焦距調整裝置完成調整到下一個焦距位置,即會產生一拍攝訊號到該攝影模組,該攝影模組則再對該調焦目標圖像進行拍攝而產生下一個該調焦影像。The lens focusing system as described in claim 8, wherein the focus adjustment device is connected to the focus analysis module, and the focus analysis module sends out the adjustment focus every time it completes obtaining the average standard deviation of the current focus position. The signal is sent to the focal length adjustment device, and the focal length adjustment device then adjusts the camera module to the next focal length position. When the focal length adjustment device completes the adjustment to the next focal length position, a shooting signal is generated to the camera module. The camera module The group then shoots the focus target image to generate the next focus image. 如請求項8所述的鏡頭調焦系統,其中該調焦分析模組分析目前所獲得的各該焦距位置的各該平均標準差的變化趨勢為逐漸增加到其中一個各該焦距位置的該平均標準差後開始逐漸減少,即停止發出該調整焦距訊號,並以其中最大的該平均標準差的該焦距位置為一標準焦距位置。The lens focusing system as described in claim 8, wherein the focusing analysis module analyzes the change trend of the average standard deviation of each focal length position currently obtained to gradually increase to the average of each focal length position. After the standard deviation begins to gradually decrease, the focus adjustment signal is stopped, and the focal length position with the largest average standard deviation is regarded as a standard focal length position. 如請求項8所述的鏡頭調焦系統,其中該焦距調整裝置依據的複數個調整焦距訊號調整該攝影模組的焦距位置,該調焦分析模組分析所獲得的各該焦距位置的該平均標準差的變化趨勢為逐漸減少,則該焦距調整裝置發出的該調整焦距訊號為令該焦距調整裝置往反向調整焦距位置,並使各該平均標準差的變化趨勢轉為逐漸增加到其中一個各該焦距位置的該平均標準差後開始逐漸減少,並以其中最大的該平均標準差的該焦距位置為一目標焦距位置。The lens focusing system as described in claim 8, wherein the focus adjustment device adjusts the focal length position of the photography module based on a plurality of adjustment focus signals, and the focus analysis module analyzes the average of the obtained focal length positions. If the change trend of the standard deviation is to gradually decrease, the focus adjustment signal sent by the focus adjustment device will cause the focus adjustment device to adjust the focus position in the reverse direction, and the change trend of each average standard deviation will gradually increase to one of the The average standard deviation of each focal length position then gradually decreases, and the focal length position with the largest average standard deviation is a target focal length position.
TW111129095A 2022-07-28 2022-08-03 Lens focusing method and system performing the same TWI815584B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210899136.5A CN115242982B (en) 2022-07-28 2022-07-28 Lens focusing method and system
CN202210899136.5 2022-07-28

Publications (2)

Publication Number Publication Date
TWI815584B TWI815584B (en) 2023-09-11
TW202405520A true TW202405520A (en) 2024-02-01

Family

ID=83677044

Family Applications (1)

Application Number Title Priority Date Filing Date
TW111129095A TWI815584B (en) 2022-07-28 2022-08-03 Lens focusing method and system performing the same

Country Status (2)

Country Link
CN (1) CN115242982B (en)
TW (1) TWI815584B (en)

Family Cites Families (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3058781B2 (en) * 1993-07-30 2000-07-04 松下電器産業株式会社 Focusing point detection method
US6693669B1 (en) * 2000-06-16 2004-02-17 Motorola, Inc. Method for reducing image blurring
JP4499317B2 (en) * 2001-08-01 2010-07-07 オリンパス株式会社 Image processing system
JP2004309739A (en) * 2003-04-07 2004-11-04 Canon Inc Focus detection device
CN1641397A (en) * 2004-12-24 2005-07-20 中国科学院上海技术物理研究所 Microscopic automatic focusing device and method suitable for space application
TWI407179B (en) * 2009-02-03 2013-09-01 Univ Nat Yunlin Sci & Tech Auto-focus method of image
TWI454137B (en) * 2011-07-01 2014-09-21 Apex Internat Financial Engineering Res & Tech Co Image capturing control system utilizing map and method thereof
JP5668027B2 (en) * 2012-07-03 2015-02-12 アキュートロジック株式会社 Omnifocal image generation method, omnifocal image generation device, omnifocal image generation program, subject height information acquisition method, subject height information acquisition device, and subject height information acquisition program
CN103905714A (en) * 2012-12-26 2014-07-02 中国电子科技集团公司第五十研究所 Focusing method based on edge spreading function measurement and device
CN103237173A (en) * 2013-04-28 2013-08-07 中国空间技术研究院 Adaptive quick focusing device and method for optical camera
CN104133339B (en) * 2013-05-02 2017-09-01 聚晶半导体股份有限公司 Atomatic focusing method and automatic focusing mechanism
TWI487995B (en) * 2013-07-10 2015-06-11 Acer Inc Image capturing devices and methods
CN105072330B (en) * 2015-07-17 2019-01-11 电子科技大学 A kind of automatic focusing method of line-scan digital camera
JP6611576B2 (en) * 2015-11-30 2019-11-27 キヤノン株式会社 Image processing apparatus and image processing method
DE102016202928B4 (en) * 2016-02-25 2018-08-09 Carl Zeiss Industrielle Messtechnik Gmbh Improved autofocus method for a coordinate measuring machine
CN106773495B (en) * 2016-12-14 2018-05-18 深圳奥比中光科技有限公司 The automatic focusing method and system of projector with multiple lamp light source
CN108259711B (en) * 2016-12-28 2021-05-18 聚晶半导体股份有限公司 Image capturing device and rapid focusing method thereof
CN108833770B (en) * 2018-05-23 2020-11-06 释码融和(上海)信息科技有限公司 Image definition calculation method for focusing, calculation device and focusing system
CN111198466B (en) * 2018-11-16 2022-06-21 北京图森智途科技有限公司 Manual focusing auxiliary method, imaging device and automobile
US20230222764A1 (en) * 2020-06-16 2023-07-13 Hitachi High-Tech Corporation Image processing method, pattern inspection method, image processing system, and pattern inspection system
CN111901531A (en) * 2020-08-31 2020-11-06 浙江水晶光电科技股份有限公司 Focusing method, device and equipment during lens assembly
CN113628169B (en) * 2021-07-15 2023-10-10 暨南大学 Infrared image automatic focusing evaluation method, system and medium based on pseudo color
CN113805304B (en) * 2021-11-16 2022-03-18 浙江双元科技股份有限公司 Automatic focusing system and method for linear array camera

Also Published As

Publication number Publication date
TWI815584B (en) 2023-09-11
CN115242982A (en) 2022-10-25
CN115242982B (en) 2023-09-22

Similar Documents

Publication Publication Date Title
EP2252088A1 (en) Image processing method and system
CN1184502C (en) Process for automatic focusing
WO2019105261A1 (en) Background blurring method and apparatus, and device
US20170064184A1 (en) Focusing system and method
CN109085113B (en) Automatic focusing method and device for cervical exfoliated cell detection device
TW201400964A (en) Enhanced image processing with lens motion
US20180184013A1 (en) Image processing apparatus, image processing method, program, and storage medium
CN103312972B (en) Electronic installation and its its focalization method
WO2019105433A1 (en) Image distortion detection method and system
WO2016203692A1 (en) Display control apparatus, display control method, and display control program
CN113099135B (en) Infrared image focusing, terminal device and computer readable storage medium
CN105592258B (en) Auto focusing method and device
WO2023236508A1 (en) Image stitching method and system based on billion-pixel array camera
WO2016197494A1 (en) Method and device for adjusting focusing area
WO2017101292A1 (en) Autofocusing method, device and system
CN106154688A (en) A kind of method and device of auto-focusing
TWI815584B (en) Lens focusing method and system performing the same
CN102004370B (en) Method for detecting focal length by flashlight in auxiliary manner
CN106303199A (en) focusing system and focusing method
JP6072632B2 (en) Imaging apparatus, imaging method, and imaging system
CN114363522A (en) Photographing method and related device
WO2022011657A1 (en) Image processing method and apparatus, electronic device, and computer-readable storage medium
US20070147819A1 (en) System and method for indicating sharpness of images
TWI547749B (en) Focus system and method
CN117479012A (en) Automatic focusing method and system for TFT-LCD photosensitive array plate