CN108989693B - Focusing method for rapid contrast detection based on double cameras - Google Patents
Focusing method for rapid contrast detection based on double cameras Download PDFInfo
- Publication number
- CN108989693B CN108989693B CN201811253756.1A CN201811253756A CN108989693B CN 108989693 B CN108989693 B CN 108989693B CN 201811253756 A CN201811253756 A CN 201811253756A CN 108989693 B CN108989693 B CN 108989693B
- Authority
- CN
- China
- Prior art keywords
- search
- camera
- main camera
- focusing
- focus
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/67—Focus control based on electronic image sensor signals
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Automatic Focus Adjustment (AREA)
- Studio Devices (AREA)
- Focusing (AREA)
Abstract
The invention provides a focusing method for rapid contrast detection based on double cameras, which comprises the following steps of 1) counting the contrast value of each frame of image; 2) detecting the degree of scene change; 3) the auxiliary camera carries out rough search and feeds back the rough search to an optimal focus position of the main camera; 4) when the focus feedback received by the main camera is one, performing fine search between two fine search step length positions in front of the focus position and the focus position; if the two feedback focal positions are provided, the main camera carries out fine search between the two focal positions; 5) repeating the step 3 to the step 4 until the main camera meets two contrast value drops, the search is stopped, and the main camera jumps to the position of the maximum contrast value; 6) and stopping searching and jumping to the optimal focusing position by the auxiliary camera to finish focusing. According to the invention, the search range is shortened by means of common search of the main camera and the auxiliary camera, mutual control and information feedback, and the focusing efficiency and the image shooting effect are further improved.
Description
Technical Field
The invention relates to a camera focusing method, in particular to a focusing method based on quick contrast detection of double cameras.
Background
Along with the processing requirement of people on the photo effect is higher and higher, a double-camera photographing technology comprising a main camera and an auxiliary camera appears, the main camera is mainly responsible for photographing and imaging, the auxiliary camera is mainly responsible for auxiliary image data acquisition, such as brightness, contrast, depth of field and AF (automatic focusing) and other related functions, the focal lengths of the two cameras are different, the greatest advantage is that objects with longer distance can be photographed without a non-digital zooming mode, and the object magnification effect is realized. The dual-camera system can also achieve smoother zooming, for example, a method of mixing digital zooming and lens switching is adopted during video recording, so that a more natural effect is achieved.
The effect of the main camera and the auxiliary camera which are matched to shoot the photos is greatly improved compared with the effect of the photos shot by a single camera. When the double cameras focus, focusing is generally carried out after automatic exposure, the main camera and the auxiliary camera respectively complete focusing according to the traditional contrast AF and carry out respective statistics focusing, and the traditional contrast detection focusing operation is divided into two parts: the method comprises the steps of searching a focus finely and a focus roughly, determining focusing searching speed by the output frame rate of a camera, wherein the focusing searching speed is 1 frame/time generally at present, so that the focusing speed is low, the jumping step length of the camera is large, and the user experience is poor due to serious image preview telescopic sense; phase focusing (pdaf) in the industry is high in cost and needs sensor hardware support, and PD pixel points occupy normal image pixels, so that effective images cannot be normally output, and the image imaging quality is sacrificed.
Disclosure of Invention
The invention mainly aims to provide a focusing method for rapid contrast detection based on double cameras, which improves focusing efficiency and image shooting effect.
The invention realizes the purpose through the following technical scheme: a focusing method based on fast contrast detection of double cameras is applied to electronic equipment, the electronic equipment comprises a main camera and an auxiliary camera and comprises the following steps,
1) counting the contrast value of each frame of image of the main camera and the auxiliary camera;
2) detecting the scene change degree of the main camera, and sending a focusing search command to the auxiliary camera when the current scene is in a stable state;
3) the auxiliary camera receives a search command to perform rough search and feeds back the search command to an optimal focus position of the main camera;
4) when the focus position fed back by the auxiliary camera is received by the main camera, the main camera jumps to two fine search step positions before the focus position, and then fine search is carried out between the position and the focus position; if the two focus positions fed back by the auxiliary camera are received by the main camera, the main camera carries out fine search between the two focus positions;
5) repeating the steps 3) and 4) until the main camera meets the reduction of the image contrast value of each frame twice in the fine search process, sending a search termination command to the auxiliary camera, and jumping to the position of the maximum image contrast value, namely the optimal focusing position, by the main camera;
6) and the auxiliary camera stops searching and jumps to the optimal focusing position after receiving the termination command, so as to finish focusing.
Further, in step 3), the best focus position for performing the rough search feedback by the secondary camera is the position where the image contrast value is maximum in the rough search of the current round.
Further, the main camera only carries out fine step size search, and the search step size is the fine search step size; and the auxiliary camera only carries out rough step length search, the search step length is the rough search step length, and the range length of the first wheel to the focus search is the whole search process.
Further, the fine search step is smaller than the minimum hyperfocal length; the coarse search step size is an integer multiple of the minimum hyperfocal length.
Further, the next round of rough search stroke of the auxiliary camera is half or quarter of the previous round of rough search stroke.
Further, when the secondary camera feeds back that the primary camera has only one focus position N2 after the previous round of rough search, the distance between the previous focus position N1 and the next focus position N3 of the N2 position is the stroke of the round of rough search.
Further, when the secondary camera feeds back that the primary camera has two focus positions N2 and N3 after the previous round of rough search, the distance between the two focus positions N2 and N3 is the stroke of the round of rough search.
Further, the number of steps of fine searching of the main camera in each round is not more than five.
Further, the electronic equipment further comprises a DAC value mapping table, and DAC values of the main camera and the auxiliary camera are mapped to the same linear table through the DAC data mapping table, so that the consistency of lens response positions of the main camera and lens response positions of the auxiliary camera is guaranteed.
Compared with the prior art, the focusing method based on the rapid contrast detection of the double cameras has the advantages that: through the common search of the main camera and the auxiliary camera, mutual control and information feedback are realized, the search range amplitude is shortened, the focusing time is greatly shortened, and the graph quality is not reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 shows a flow chart illustrating steps performed by an embodiment of the present invention;
FIG. 2 is a diagram illustrating a relationship between a lens position and a contrast value of each frame image according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a relationship between a lens position and a contrast value of each frame image according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a relationship between a lens position and a contrast value of each frame image according to an embodiment of the present invention;
fig. 5 is a schematic diagram illustrating a relationship between a lens position and a contrast value of each frame image according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, the present embodiment is a focusing method for fast contrast detection based on dual cameras, applied to an electronic device, where the electronic device includes a main camera and a sub-camera, and the method includes the following steps:
1) the main camera is provided with a statistical module and a scene detection module, and the statistical module is used for statistically recording the contrast value (FV value) of each frame of image of the main camera and the auxiliary camera;
2) the scene detection module detects that the scene of the main camera changes and sends a focusing search command to the auxiliary camera when the current scene is in a stable state;
3) after receiving the search command, the auxiliary camera starts a first round of rough search to obtain a first focus position and feeds the first focus position back to the main camera, for example, the positions of N2 in FIG. 2 and N2 and N3 in FIG. 4, and then starts a second round of rough search to obtain a second focus position and feeds the second focus position back to the main camera, and similarly, a third round of search and a fourth round of search … … are performed until the main camera sends a search termination command or the rough search step size of the auxiliary camera is smaller than the fine search step size of the main camera;
4) when the focal position fed back by the secondary camera is one, such as N2 in fig. 3, after the primary camera receives the focal position fed back by the secondary camera, jumping to the position of s1 which is two fine search steps before the focal position, and then performing fine search between the s1 position and the focal position; if the two focus positions fed back by the auxiliary camera are available, the main camera carries out fine search between the two focus positions after receiving the focus position fed back by the auxiliary camera;
5) in the fine search process, when encountering two times of contrast value reduction, the main camera jumps to the position of the maximum contrast value, namely the optimal focusing position, as shown by the position s3 in fig. 3 and 5, sends a search termination command to the auxiliary camera and gives the currently searched optimal focusing position;
6) and the auxiliary camera stops searching and jumps to the optimal focusing position after receiving the termination command, so as to finish focusing.
The electronic equipment further comprises a preset DAC value mapping table, and the DAC values (please use Chinese names to represent the meanings of the values) of the main camera and the auxiliary camera are mapped into the same linear table through the DAC data mapping table. The linear table is used for operating the lens moving distances of the main camera and the auxiliary camera through step lengths, for example, the whole-range length of the mapping table is 0-1023 step lengths, if the DAC value of the main camera focusing on 10cm and being clear is mapped to a certain step length value of the table, the DAC value of the auxiliary camera focusing on 10cm and being clear is also mapped to the same step length value of the table, and the purpose that the step lengths can be operated uniformly when the main camera and the auxiliary camera are moved is achieved.
The linear table after mapping has the function of ensuring the consistency of the lens response position of the main camera and the response position operation of the auxiliary camera. For example, the step length used when the main camera moves from a focus 10cm clear position to a 20cm clear position and the motor is moved is equal to the step length used when the auxiliary camera moves from a focus 10cm clear position to a 20cm clear position and the motor is moved. After the two cameras carry out the consistent mapping operation, when the main camera shoots clearly, the output image of the auxiliary camera is definitely a clear image at the same mapping step position.
And the scene detection module of the main camera detects that the scene changes and sends focusing start operation to the auxiliary camera when the current scene is in a stable state, and the main camera and the auxiliary camera decide the next searching direction and searching state by judging whether the contrast value of each frame of image of the current camera counting module is maximum or whether two continuous descending times exist and a command sent by the other camera in the whole searching process.
The main camera and the auxiliary camera are mutually controlled, sent and received.
In the whole focusing process, the counting modules of the main camera and the auxiliary camera respectively count the contrast value (FV value) of each frame of image, and the scene detection module respectively detects whether the current scene changes and is stable.
In this embodiment, the main camera only performs fine step size search, the search step size is a fine step size, the search range is calculated from the focal position value fed back by the sub-camera, and if the focal position fed back by the sub-camera is N2 points in fig. 3, the search range of the main camera is a distance between two fine step sizes s1 and N2 points ahead of the N2 focal position.
In this embodiment, the sub-camera only performs a large-step coarse search, the search step is a coarse search step, and the range length of the first wheel in the focusing process is the whole search process.
In the rough search, the moving distance of the lens, namely the rough search step length, is searched for each time, wherein the moving distance is n times of the minimum hyperfocal distance length, and n is an integer. The larger n is, the faster the search speed is, but the easier the search speed is to cross the optimal focus, and the position of the maximum image contrast value of each frame searched in the current round is the position of the focus obtained in the current round;
in the fine search, the moving distance of the lens, namely the fine search step length, is ensured to be smaller than the minimum hyperfocal distance length each time, so that the position of the clearest frame cannot be lost in each frame search, and the position of the contrast value of the maximum image of each frame searched in the current round is the focus position obtained in the current round.
In the second round of rough searching step of the auxiliary camera, the searching travel of the auxiliary camera is changed into half or quarter of the searching travel of the first round, and the process is the same as the first round of searching. Specifically, 1) if the sub-camera feeds back to the main camera only one focus position N2 as shown in fig. 2 and 3, the sub-camera adopts the distance between the previous focus position N1 and the next focus position N3 of the N2 position (i.e., half of the first round of search stroke) as the stroke of the second round of rough search. 2) As shown in fig. 4 and 5, if the image contrast values of N2 and N3 are the same for each frame, the sub camera feeds back to the main camera as two focus positions N2 and N3, and then the distance between the two focus positions N2 and N3 (i.e., one fourth of the first round of search stroke) is taken as the stroke in the second round of search.
The searching steps of each round of the main camera are not more than five steps. Acquiring each frame of image contrast value data returned by the statistical module in the moving process of the main camera, and if the image contrast value of each frame is gradually increased in the process that the main camera moves to the focal position sent by the auxiliary camera, continuing searching until the position is stopped to the first round of searching end point, namely the maximum position of the image contrast value of each frame, and returning an error value of the auxiliary camera; if the contrast value of each frame of image is reduced twice continuously, the main camera jumps back to the position with the maximum contrast value of each frame of image, the focusing search of the main camera in the secondary round is finished, at the moment, the correct value of the auxiliary camera is returned, and the auxiliary camera stops the focusing search. When the first round of search of the main camera stops to the edge position of the whole search process and the second round of search of the auxiliary camera returns to the focus position of the whole search process, the main camera starts the second round of fine search, the whole search process is a range of 5 step lengths, the lower limit of the edge is the position of subtracting two unit fine step lengths from the focus position, namely the position of s1, the upper line of the edge is the position of the focus and adding two unit fine step lengths, namely the position of s5, and as shown in fig. 5, the search decision is the same as the first round of fine search.
According to the invention, the search range is shortened through the common search of the main camera and the auxiliary camera, mutual control and information feedback are carried out between the main camera and the auxiliary camera, so that the focusing time is greatly shortened, and the image quality is not reduced.
The embodiment provides a focusing method for rapid contrast detection based on double cameras, which is characterized in that a control operation command is sent by a main camera and an auxiliary camera to realize rapid focusing search operation, the main camera carries out fine search, and the auxiliary camera carries out rough search, so that the focusing speed can be increased, the problem that the focusing speed of the double cameras is low, the image preview acquired by the main camera has no telescopic experience is solved, and the problems that the image preview has poor telescopic experience, the image imaging quality is not influenced and the cost is not increased in the traditional focusing process are solved; the auxiliary camera can search the whole process every time, and the problem of focusing failure caused by false FV wave crests in the focusing process in the traditional method is solved.
Although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (9)
1. A focusing method for rapid contrast detection based on double cameras is applied to electronic equipment, wherein the electronic equipment comprises a main camera and a pair of cameras, and is characterized in that: comprises the following steps of (a) carrying out,
1) counting the contrast value of each frame of image of the main camera and the auxiliary camera;
2) detecting the scene change degree of the main camera, and sending a focusing search command to the auxiliary camera when the current scene is in a stable state;
3) the auxiliary camera receives a search command to perform rough search and feeds back the search command to an optimal focus position of the main camera;
4) when the focus position fed back by the auxiliary camera is received by the main camera, the main camera jumps to two fine search step positions before the focus position, and then fine search is carried out between the position and the focus position; if the two focus positions fed back by the auxiliary camera are received by the main camera, the main camera carries out fine search between the two focus positions;
5) repeating the steps 3) and 4) until the main camera meets the reduction of the image contrast value of each frame twice in the fine search process, sending a search termination command to the auxiliary camera, and jumping to the position of the maximum image contrast value, namely the optimal focusing position, by the main camera;
6) and the auxiliary camera stops searching and jumps to the optimal focusing position after receiving the termination command, so as to finish focusing.
2. The focusing method based on the fast contrast detection of the dual cameras according to claim 1, characterized in that: in step 3), the best focus position for the secondary camera to perform rough search feedback is the position with the maximum image contrast value in the current round of rough search.
3. The focusing method based on the fast contrast detection of the dual cameras according to claim 1, characterized in that:
the main camera only carries out fine search, and the search step length is the fine search step length;
the auxiliary camera only carries out rough search, the search step length is the rough search step length, and the range length of the first wheel to the focus search is the whole search process.
4. The focusing method based on the fast contrast detection of the dual cameras according to claim 3, characterized in that:
the fine search step length is smaller than the minimum hyperfocal distance;
the coarse search step is an integer multiple of the minimum hyperfocal distance.
5. The focusing method based on the fast contrast detection of the dual cameras according to claim 1, characterized in that: and the subsequent round of rough search stroke of the auxiliary camera is half or one fourth of the previous round of rough search stroke.
6. The focusing method based on the fast contrast detection of the dual cameras according to claim 5, wherein: when the secondary camera feeds back that the main camera has only one focus position N2 after the previous round of rough search, the distance between the previous focus position N1 and the next focus position N3 of the N2 position is the stroke of the round of rough search.
7. The focusing method based on the fast contrast detection of the dual cameras according to claim 5, wherein: when the secondary camera feeds back that the main camera has two focus positions N2 and N3 after the previous round of rough search, the distance between the two focus positions N2 and N3 is the stroke of the round of rough search.
8. The focusing method based on the fast contrast detection of the dual cameras according to claim 1, characterized in that:
the number of steps of fine search of the main camera in each round is not more than five.
9. The focusing method based on the fast contrast detection of the dual cameras according to claim 1, characterized in that: the electronic equipment further comprises a DAC value mapping table, and DAC values of the main camera and the auxiliary camera are mapped to the same linear table through the DAC data mapping table, so that the consistency of lens response positions of the main camera and lens response positions of the auxiliary camera is guaranteed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811253756.1A CN108989693B (en) | 2018-10-26 | 2018-10-26 | Focusing method for rapid contrast detection based on double cameras |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811253756.1A CN108989693B (en) | 2018-10-26 | 2018-10-26 | Focusing method for rapid contrast detection based on double cameras |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108989693A CN108989693A (en) | 2018-12-11 |
CN108989693B true CN108989693B (en) | 2020-07-21 |
Family
ID=64543691
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811253756.1A Active CN108989693B (en) | 2018-10-26 | 2018-10-26 | Focusing method for rapid contrast detection based on double cameras |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108989693B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110248101B (en) * | 2019-07-19 | 2021-07-09 | Oppo广东移动通信有限公司 | Focusing method and device, electronic equipment and computer readable storage medium |
CN110567942A (en) * | 2019-08-29 | 2019-12-13 | 南京航空航天大学 | Alloy component online detection and identification device and method based on LIBS equipment |
CN113251336A (en) * | 2021-05-10 | 2021-08-13 | 读书郎教育科技有限公司 | Learning desk lamp with adjustable click-to-read angle and method thereof |
CN113329183B (en) * | 2021-07-01 | 2022-08-09 | 珠海丽珠试剂股份有限公司 | Focusing method and device for shooting equipment and multiple liquid phase chip shooting equipment |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4561750A (en) * | 1983-07-28 | 1985-12-31 | Canon Kabushiki Kaisha | In-focus state detection device |
CN106506971A (en) * | 2016-11-30 | 2017-03-15 | 宇龙计算机通信科技(深圳)有限公司 | A kind of focusing method and mobile terminal |
CN106851103A (en) * | 2017-02-27 | 2017-06-13 | 上海兴芯微电子科技有限公司 | Atomatic focusing method and device based on dual camera system |
CN106937056A (en) * | 2017-03-31 | 2017-07-07 | 努比亚技术有限公司 | The focusing process method of dual camera, focusing process device and mobile terminal |
CN107509023A (en) * | 2017-07-24 | 2017-12-22 | 上海理工大学 | A kind of auto-focusing searching algorithm |
CN108322726A (en) * | 2018-05-04 | 2018-07-24 | 浙江大学 | A kind of Atomatic focusing method based on dual camera |
-
2018
- 2018-10-26 CN CN201811253756.1A patent/CN108989693B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4561750A (en) * | 1983-07-28 | 1985-12-31 | Canon Kabushiki Kaisha | In-focus state detection device |
CN106506971A (en) * | 2016-11-30 | 2017-03-15 | 宇龙计算机通信科技(深圳)有限公司 | A kind of focusing method and mobile terminal |
CN106851103A (en) * | 2017-02-27 | 2017-06-13 | 上海兴芯微电子科技有限公司 | Atomatic focusing method and device based on dual camera system |
CN106937056A (en) * | 2017-03-31 | 2017-07-07 | 努比亚技术有限公司 | The focusing process method of dual camera, focusing process device and mobile terminal |
CN107509023A (en) * | 2017-07-24 | 2017-12-22 | 上海理工大学 | A kind of auto-focusing searching algorithm |
CN108322726A (en) * | 2018-05-04 | 2018-07-24 | 浙江大学 | A kind of Atomatic focusing method based on dual camera |
Also Published As
Publication number | Publication date |
---|---|
CN108989693A (en) | 2018-12-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108989693B (en) | Focusing method for rapid contrast detection based on double cameras | |
CN102984530B (en) | Image processing system and Atomatic focusing method | |
US20050128323A1 (en) | Image photographing device and method | |
US20230156301A1 (en) | Automatic focus distance extension | |
US11570376B2 (en) | All-in-focus implementation | |
CN103986867A (en) | Image shooting terminal and image shooting method | |
CN104079812B (en) | A kind of image information acquisition method and device | |
US9160919B2 (en) | Focus adjustment unit and camera system | |
US9386229B2 (en) | Image processing system and method for object-tracing | |
CN110365894B (en) | Method for image fusion in camera device and related device | |
US8004597B2 (en) | Focusing control apparatus and method | |
CN104184935B (en) | Image capture devices and method | |
JP2008054206A (en) | Ghost detection device and its related technology | |
CN107370939B (en) | Focus detection apparatus, control method thereof, image pickup apparatus, and computer readable medium | |
CN105611182A (en) | Method and device for brightness compensation | |
CN108206914B (en) | Focusing method and device, and terminal | |
US7116364B2 (en) | Method and apparatus for maintaining a consistent effective focal length in a digital camera | |
RU2389050C1 (en) | Automatic focusing method | |
CN110753182A (en) | Adjusting method and apparatus of image forming apparatus | |
CN111131662B (en) | Image output method, image output apparatus, camera, and storage medium | |
US9225909B1 (en) | Image capturing device and digital zoom display method | |
CN109309784B (en) | Mobile terminal | |
CN115379201A (en) | Test method and device, electronic equipment and readable storage medium | |
KR101698917B1 (en) | Integrated control method of pan tilt zoom focusing of closed circuit television camera | |
CN114845042A (en) | Camera automatic focusing method based on image information entropy |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |