Autofocus Technology
Technical field
The present invention relates to Autofocus Technology, relate in particular to a kind of intelligent multi-spot technology that in the digital image acquisition system, adopts.
Background technology
In the shooting process of image, the distance between camera or video camera and the subject is often change, so regular meeting causes image blurring because of exceeding field depth.In order to make image keep clear, just must in the process of finding a view, change the focal position of camera lens, make image keep clear.The process of this adjusting focal position is called focusing or focusing.
Nowadays Autofocus Technology has been widely used in capture fields such as camera, video camera and image scan.It makes image-taking system to adjust the position of focusing mirror group in the camera lens automatically according to the distance of object, and object is imaged on the imaging plane clearly.The automatic focusing mode of traditional optical image-taking system has a variety of, is broadly divided into two classes: a class is active focusing mode, comprises infrared mode and ultrasound wave mode; Another kind ofly be passive type focusing mode, more representational have " solid-state triangulation " system (SST, SolidState Triangulation) and TTL (Through The Lens) mode.
The automatic focusing mode of existing digital image acquisition system is main flow with TTL.The structure of TTL mode is simple relatively: directly the ccd sensor from the pick-up lens back takes out picture signal, through the microcomputer analysis, adjusts the Focusing mechanism of camera lens according to the computing result.It is correct that the TTL mode has remote focusing, and focusing does not have advantages such as parallax, and weak point is equal cisco unity malfunction when too dark and subject contrast is hanged down when light.
The U.S. the 6th, 067, No. 115 patent has elaborated above-mentioned Autofocus Technology.It is by regulating the micromatic setting on the autozoom camera lens, the autozoom camera lens is moved at different relative positions, and calculate the AF assessed value according to the contrast of testee imaging on CCD, camera lens is sent into microcomputer analysis simultaneously at the relative position of the AF of each relative position assessed value and camera lens then, microcomputer plots as shown in Figure 5 AF assessed value curve with these values, the relative position of lens of judgement when the hump is best focusing, to send micromatic setting on the autozoom camera lens back to the corresponding relative position of lens parameter of best focusing again, to finish auto-focus process.
The order of accuarcy of traditional Autofocus Technology depends on the AF assessed value, yet because the AF assessed value only comprises contrast information, so in concrete the shooting, if ambient brightness is not enough, perhaps the distance of subject and background differs greatly, when perhaps situation such as variation had taken place background in auto-focus process, contrast information can't reflect the focusing situation exactly, therefore also can't guarantee can both find best focus position at every turn.
Summary of the invention
The purpose of this invention is to provide a kind of novel intelligent multi-spot technical scheme, requiring constant to the camera lens gearing and do not increasing under the prerequisite of extra optics or mechanical devices, reach when ambient brightness is not enough, when perhaps the object distance of subject and background differs greatly, when perhaps variation has taken place background in auto-focus process, can both promptly find the technique effect of best focus position.
Technical scheme of the present invention is as follows:
In auto-focus process, microcomputer at first is provided with the setting exposure mode according to current digital image-taking system, comprise by gear train the relative position of camera lens is made as initial position, control the generalized time of light sensor (CCD or cmos sensor) again according to current exposure mode, the simulating signal of light sensor output is converted to data image signal through the A/D change-over circuit, input exposure tests circuit.
The exposure tests circuit is analyzed this input signal, calculate exposure evaluation value and with the ultimate value that is stored in this exposure mode among the RAM relatively, if exposure evaluation value meets the requirements, microcomputer judges that current exposure mode is correct; Otherwise (as over-exposed or not enough) microcomputer judges that current exposure mode is incorrect, exposure mode is made as next pattern again, repeats above-mentioned steps, meets the requirements up to exposure evaluation value.
After exposure evaluation value meets the requirements, microcomputer is regulated lens focus by gear train in the adjustable focal length scope, make relative position of lens progressively increase to end position from initial position, control the generalized time of light sensor simultaneously according to fixed exposure mode, each relative position LP at camera lens obtains a width of cloth digital picture, sends into the analysis of focusing automatically of focusing testing circuit respectively.
Because in shooting is found a view, subject most possibly appears at the center of scene or 4 golden section point up and down.According to this characteristic, the exposure tests circuit is told a plurality of zones in data image signal.Wherein, the central point of central area overlaps with the central point of entire image, and the central point in four zones corresponds respectively to 4 golden section point up and down of entire image up and down.The exposure tests circuit is for the arbitrary zone in the current data image signal, all press following formula 1 or formula 2, obtain the brightness value of each pixel and its neighbor pixel in this image in this zone, add up according to the Nth power of formula 3 then the absolute value of the difference FD of brightness value, obtain regional assessment value FV, deposit FV among the RAM relevant position according to zone and relative position.
Ask the brightness-formula of each pixel as follows:
Y=0.299R+0.587G+0.114B formula 1
The brightness of asking each pixel also can be only with the G component of this point approximate value as brightness.
Y=G formula 2
Ask the formula of regional assessment value FV as follows:
Formula 3
(wherein i is a pixel, and i belongs to this zone)
If wherein each pixel be adjacent pixel the absolute value of difference of brightness value greater than a predefined constant TD, can think that this point is a bad pixel and ignoring in computation process.
After end was analyzed the automatic exposure on all relative positions, microcomputer was for each zone, and first setting area weight BW equals region weight initial value BI.Wherein region weight initial value BI is 1,2,4 or other constant.
Relative position LP with camera lens is a horizontal ordinate again, is ordinate with regional assessment value FV, takes out regional assessment value FV from the relevant position of RAM, draws a regional curve FVEC, again this curve is carried out low-pass filtering or bandpass filtering, and purpose is to make curve smoothing.
If this zone is positioned at the central area of image, the region weight BW that this is regional increases WA doubly, and wherein weight factor WA is 2.
If this zone is positioned at the golden section point zone of image, the region weight BW that this is regional increases WB doubly, and wherein weight factor WB is 2.
If this zone is positioned at the predefined any zone of image-taking system (as the manual focal zone of setting of user), the region weight BW that this is regional increases WC doubly, and wherein weight factor WC is 2.
If the peak value of FVEC zone curve thinks then that less than predefined regional curve threshold value FVT this provincial characteristics is not remarkable, the region weight BW that this is regional reduces WD doubly, and wherein weight factor WD is 2.
If bimodal or multimodal shape appears in FVEC zone curve, think that then this provincial characteristics is interfered (change as background etc.), the region weight BW that this is regional reduces WE doubly, and wherein weight factor WE is 2.
New region weight that at last should the zone deposits RAM in.
After the weight of All Ranges among the RAM all is updated, microcomputer is for each relative position LP of camera lens, the one group of regional assessment value FV that from RAM, takes out at this relative position, by formula 4 add each the regional regional assessment value in this relative position and the accumulation of region weight, obtain relative position assessed value LV.
Formula 4
(wherein BL is the zone that the exposure tests circuit is told in current data image signal, and n is a number of regions)
After obtaining all relative position assessed values, be horizontal ordinate with the relative position of camera lens, be ordinate with the relative position assessed value, draw a relative position curve LVEC.Judge that then the relative position of lens that is positioned at relative position peak of curve place is a best focus position, is provided with the lens shooting position and equals best focus position.
At last, microcomputer moves to the lens shooting position by transmission mechanism control autozoom camera lens, finishes auto-focus process.
The contrast prior art the invention has the advantages that:
1, before each focusing automatically, carrying out automatic exposure earlier and regulating, making image-taking system not enough or cross and still can guarantee the accuracy of focusing under the bright situation at ambient brightness.
2, consider the rule of finding a view, select the multi-spot zone and according to the spatial variations in zone and time change be weighted average, the distance that can reject subject and background preferably differ greatly the harmful effect that produced and in auto-focus process since the disturbing factor that change of background or the shake of capture equipment are produced realize accurately focusing on.
3, the present invention does not have specific (special) requirements to the gearing of camera lens, need not increase extra optics or mechanical devices yet, utilizes same cost to reach better effect.
4, owing to mainly exposure evaluation value, regional assessment value and region weight are calculated and store in auto-focus process, the present invention requires minimumly to RAM's, and the processing power to microcomputer requires also greatly to reduce simultaneously.
Description of drawings
Fig. 1 is the block diagram that adopts the digital camera of Autofocus Technology of the present invention
Fig. 2 is the workflow diagram of this digital camera
Fig. 3 is the focus workflow diagram of technology of the present invention
Fig. 4 is that the focusing testing circuit will be divided into the diagram in 15 zones in the data image signal
Fig. 5 is an AF assessed value curve map
Fig. 6 is regional curve FVEC figure
The diagram of bimodal or multimodal situation appears in Fig. 7 zone curve FVEC
Fig. 8 is relative position curve LVEC figure
Embodiment
Below in conjunction with accompanying drawing be not that certain embodiments comes the present invention is done more detailed explanation.
Adopt the digital image acquisition system of intelligent multi-spot technology of the present invention to comprise camera lens, light sensor such as CCD or several parts such as cmos sensor, A/D change-over circuit, exposure tests circuit, focusing testing circuit, microcomputer, RAM and gear train at least.
With the digital camera is example: shown in Figure 1 is adopts the block diagram of the digital camera of intelligent multi-spot technology, comprises an autozoom camera lens 10, CCD or cmos sensor 11, A/D change-over circuit 12, exposure tests circuit 13, focusing testing circuit 14, microcomputer 15, RAM16, shutter release 17, automatically to several parts such as focal switch 18, flashlamp 19 and gear trains 20.
Be to adopt digital camera workflow diagram of the present invention as shown in Figure 2, from preparing to take 20, after shutter release connects 21, microcomputer initialization camera 22, the switch connection if focus this moment automatically, digital camera is operated in autofocus state, camera is adjusted to optimum Working and enter Flame Image Process and recording process 26 and then finish whole shooting process 27 by auto-focus process 24.If digital camera is operated in the manual focus state, microcomputer adjusts and finishes manual focus default procedure 25 according to the manual focus result to camera, finishes whole shooting process 27 through identical Flame Image Process and recording process 26 again.
Auto-focus process is referring to the workflow diagram of the present invention's intelligence multi-spot technology shown in Figure 3, and this flow process is described in detail as follows by program 30 beginnings according to direction shown in the arrow:
Program 30: microcomputer 15 is made as 1 (high light) according to current camera setting with exposure mode EM, by gear train 20 the relative position LP of camera lens 10 is made as 0 (initial position).The EM value is followed successively by 1 (high light), 2 (fine days), 3 (cloudy), 4 (indoor) from small to large.
Program 31: microcomputer 15 is according to the generalized time of current exposure mode EM value control sensor 11, adjust the relative position LP of camera lens 10 to current camera lens by gear train 20, the simulating signal that sensor 11 is exported is converted to data image signal through A/D change-over circuit 12.
Program 32: 13 pairs of input signals of exposure tests circuit are analyzed, and calculate exposure evaluation value EE
EM, with EE
EMInput microcomputer 15.
Program 33: microcomputer 15 is with exposure evaluation value EE
EMBe stored in RAM16 in the exposure ultimate value ET corresponding with current exposure mode
EMRelatively, if EE
EMMore than or equal to ET
EM, microcomputer 15 judges that current exposure mode is correct, enters program 36; Otherwise microcomputer 15 judges that current exposure mode is incorrect, enters program 34.
Program 34: microcomputer 15 judges whether current exposure mode EM equals 3 (indoor).If EM equals 3, enter program 41; Otherwise, enter program 35.
Program 35: EM adds 1 with the exposure mode value, is back to program 31.
Program 36: in shooting was found a view, subject most possibly appeared at the center of scene or 4 golden section point up and down.According to this feature, as shown in Figure 4, focusing testing circuit 14 is told A, B, C, D, E, F, G, H, I, J, K, L, M, N and O zone from the resulting data image signal of current relative position of lens LP, altogether 15 zones.Wherein, the central point in H zone overlaps with the central point of entire image, and the central point in C, M, F, J zone is 4 golden section point up and down of corresponding entire image respectively, and the area in these 15 zones is identical.Focusing testing circuit 14 is for each area B L, all should the zone in the difference FD of brightness value of each pixel and this left side neighbor pixel
BL, LPThe Nth power such as the formula 1 of absolute value add up, draw regional assessment value FV
BL, LP, with FV
BL, LPDeposit RAM16 in.
Program 37: microcomputer 15 judges that whether the relative position LP of current camera lens equals camera lens end position LN, if LP equals LN, enters program 38; Otherwise, enter program 39.
Program 38: microcomputer 15 is for each area B L, first setting area weight BW
BLEqual region weight initial value BI.Relative position LP with camera lens is a horizontal ordinate, is ordinate with regional assessment value FV, draws a regional curve FVEC as shown in Figure 6, again this curve is done low-pass filtering.If this zone is positioned at the central area of image, the region weight BW that this is regional
BLIncrease WA doubly; If this zone is positioned at the golden section point zone of image, the region weight BW that this is regional
BLIncrease WB doubly; If this zone is positioned at the predefined any focusing of user zone, the region weight BW that this is regional
BLIncrease WC doubly; If the peak value of FVEC zone curve thinks that then this provincial characteristics is not remarkable, the region weight BW that this is regional less than predefined regional curve threshold value FVT
BLReduce WD doubly; If bimodal or multimodal shape appears in FVEC zone curve, think that then this provincial characteristics is interfered (change as background etc.) the region weight BW that this is regional
BLReduce WE doubly.Region weight BW with 15 zones
BLDeposit RAM16 successively in.
Program 39: microcomputer 15 adds 1 with the relative position LP of camera lens, and makes the autozoom camera lens move to corresponding focal position by gear train 20, is back to program 31.
Program 40: microcomputer 15 is according to the relative position LP of camera lens, the one group of regional assessment value FV that from RAM16, takes out at this relative position, and 4 the regional assessment values that each is regional and the accumulation of region weight by formula adds, and obtains relative position assessed value LV
LPAfter obtaining all LV values, be horizontal ordinate with the relative position LP of camera lens, be ordinate with relative position assessed value LV, draw a relative position curve LVEC as shown in Figure 8.Judgement is at the relative position of lens LP of relative position peak of curve place correspondence
MAXBe the camera lens best focus position, lens shooting position SL be set equal LP
MAX
Program 41: enter flash mode, microcomputer 15 is provided with lens shooting position SL and equals camera lens best focus position LP under the flash mode
FLASH
Program 42: microcomputer 15 makes the autozoom camera lens move to lens shooting position SL by gear train 20, finishes auto-focus process.
In sum, by the focusing technology that the present invention narrated, can be implemented in constant and do not increase under the prerequisite of extra optics or mechanical devices to the requirement of camera lens gearing, reach when ambient brightness is not enough, when perhaps the object distance of subject and background differs greatly, when perhaps variation has taken place background in auto-focus process, can both find the technique effect of correct best focus position rapidly.
Obviously, Autofocus Technology of the present invention is not limited to be used in digital camera field, can well utilize the present invention at digital image capture devices such as image scanner, microscope, video camera and electronic type thumbnail image projectors, for those skilled in the art, also can easily realize additional advantage and make amendment.Therefore under the situation of the spirit and scope of the general notion that does not deviate from claim and equivalency range and limited, the examples shown that the present invention is not limited to specific details, representational equipment and illustrates here and describe.