CN112449117B - Focusing step length determining method and device, storage medium and electronic device - Google Patents
Focusing step length determining method and device, storage medium and electronic device Download PDFInfo
- Publication number
- CN112449117B CN112449117B CN202110114788.9A CN202110114788A CN112449117B CN 112449117 B CN112449117 B CN 112449117B CN 202110114788 A CN202110114788 A CN 202110114788A CN 112449117 B CN112449117 B CN 112449117B
- Authority
- CN
- China
- Prior art keywords
- value
- target
- frame image
- coordinate
- target frame
- 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
- 238000000034 method Methods 0.000 title claims abstract description 43
- 230000008859 change Effects 0.000 claims description 155
- 238000004590 computer program Methods 0.000 claims description 16
- 238000012545 processing Methods 0.000 claims description 10
- 238000003384 imaging method Methods 0.000 claims 1
- 238000005516 engineering process Methods 0.000 abstract description 5
- 230000000694 effects Effects 0.000 abstract description 3
- 230000008569 process Effects 0.000 description 9
- 238000004364 calculation method Methods 0.000 description 7
- 230000005540 biological transmission Effects 0.000 description 6
- 238000004422 calculation algorithm Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 230000009194 climbing Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 230000000630 rising effect Effects 0.000 description 3
- 238000013459 approach Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 239000011541 reaction mixture Substances 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 238000010191 image analysis Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
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
-
- G—PHYSICS
- G02—OPTICS
- G02B—OPTICAL ELEMENTS, SYSTEMS OR APPARATUS
- G02B7/00—Mountings, adjusting means, or light-tight connections, for optical elements
- G02B7/28—Systems for automatic generation of focusing signals
- G02B7/282—Autofocusing of zoom lenses
-
- G—PHYSICS
- G02—OPTICS
- G02B—OPTICAL ELEMENTS, SYSTEMS OR APPARATUS
- G02B7/00—Mountings, adjusting means, or light-tight connections, for optical elements
- G02B7/28—Systems for automatic generation of focusing signals
- G02B7/36—Systems for automatic generation of focusing signals using image sharpness techniques, e.g. image processing techniques for generating autofocus signals
- G02B7/38—Systems for automatic generation of focusing signals using image sharpness techniques, e.g. image processing techniques for generating autofocus signals measured at different points on the optical axis, e.g. focussing on two or more planes and comparing image data
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Optics & Photonics (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Automatic Focus Adjustment (AREA)
- Focusing (AREA)
- Studio Devices (AREA)
Abstract
The embodiment of the invention provides a method and a device for determining focusing step length, a storage medium and an electronic device, wherein the method comprises the following steps: acquiring the point positions of a focusing motor and the definition of frame images when a target camera device respectively collects a preset number of continuous frame images; determining a coordinate point corresponding to each frame of image based on the plurality of focus motor point locations and the plurality of definitions which are respectively obtained, wherein the coordinate value of the coordinate point corresponding to each frame of image comprises the focus motor point location when each frame of image is collected and the definition of each frame of image; and determining a target adjustment step length of a focusing motor of the target camera device based on coordinate values of coordinate points corresponding to the first target frame image, the second target frame image, the third target frame image and the fourth target frame image included in the continuous frame images. The invention solves the problems of low focusing efficiency and poor focusing effect in the related technology, thereby achieving the effect of improving the focusing efficiency.
Description
Technical Field
The embodiment of the invention relates to the field of communication, in particular to a method and a device for determining a focusing step length, a storage medium and an electronic device.
Background
The current automatic focusing technology has been widely applied to the fields of digital cameras, security monitoring, mobile phones, video conferences and the like, wherein the automatic focusing technology mainly realizes focusing through image analysis in the security field: and acquiring a current frame, analyzing the image definition value, calculating the focusing position and the focusing definition value of the next step, and continuously driving a focusing motor until the most definition value is found.
However, in the existing focusing method, the focusing process always focuses back and forth near the peak point, so that the focusing speed is slow, and the focusing efficiency is reduced.
And no effective solution to the above problems has been proposed.
Disclosure of Invention
The embodiment of the invention provides a method and a device for determining a focusing step length, a storage medium and an electronic device, which are used for at least solving the problem of low focusing efficiency in the related art.
According to an embodiment of the present invention, there is provided a focusing step size determining method including:
acquiring the point positions of a focusing motor and the definition of frame images when a target camera device respectively collects a preset number of continuous frame images;
determining a coordinate point corresponding to each frame of image based on the plurality of focus motor point locations and the plurality of definitions which are respectively obtained, wherein the coordinate value of the coordinate point corresponding to each frame of image comprises the focus motor point location when each frame of image is collected and the definition of each frame of image;
determining a target adjustment step length of a focusing motor of the target camera device based on coordinate values of coordinate points corresponding to a first target frame image, a second target frame image, a third target frame image and a fourth target frame image included in the continuous frame images, wherein the fourth target frame image is a frame image before the third target frame image, the second target frame image and the first target frame image are sequentially adjacent frame images, and the first target frame image is a last frame image of the continuous frame images.
In one exemplary embodiment, determining a target adjustment step size of a focus motor of the target image capturing apparatus based on coordinate values of coordinate points corresponding to first, second, third, and fourth target frame images included in the consecutive frame images includes:
determining a first angle change value and a first residual change rate of a first coordinate point based on a first coordinate value, a second coordinate value and a fourth coordinate value, wherein the first coordinate value is a coordinate value of the first coordinate point corresponding to the first target frame image, the second coordinate value is a coordinate value of a second coordinate point corresponding to the second target frame image, the fourth coordinate value is a coordinate value of a fourth coordinate point corresponding to the fourth target frame image, the first angle change value is a variation of a first average per-step sharpness value and a second average per-step sharpness value, the first average per-step sharpness value is an average per-step sharpness value between the first target frame image and the fourth target frame image, the second average per-step sharpness value is an average per-step sharpness value between the first target frame image and the second target frame image, the first residual change rate is used to indicate a rate of change of sharpness per step for the first target frame image and the second target frame image;
determining a second angle change value and a second residual change rate of a second coordinate point based on a second coordinate value, a third coordinate value and a fourth coordinate value, wherein the third coordinate value is a coordinate value of a third coordinate point corresponding to the third target frame image, the second angle change value is a variation of a third average per-step sharpness value and a fourth average per-step sharpness value, the third average per-step sharpness value is an average per-step sharpness value between the second target frame image and the fourth target frame image, the fourth average per-step sharpness value is an average per-step sharpness value between the second target frame image and the third target frame image, and the second residual change rate is used for indicating a sharpness per-step change rate of the second target frame image and the third target frame image;
determining a target adjustment step size of a focus motor of the target image pickup apparatus based on the first angle change value, the first residual change rate, the second angle change value, and the second residual change rate.
In one exemplary embodiment, determining the target adjustment step size of the focus motor of the target image pickup apparatus based on the first angle change value, the first residual change rate, the second angle change value, and the second residual change rate includes:
determining a first difference between the first angle change value and the second angle change value;
determining a second difference between the first rate of change of residual and the second rate of change of residual;
determining a target adjustment step size of a focus motor of the target image pickup apparatus based on the first difference and the second difference.
In one exemplary embodiment, determining the target adjustment step size of the focus motor of the target image pickup apparatus based on the first difference and the second difference includes:
determining a target convergence value based on the first difference and the second difference;
and determining the target adjustment step length according to the target convergence value.
In one exemplary embodiment, determining the target adjustment step size according to the target convergence value comprises:
determining the target adjustment step length as a preset step length value under the condition that the target convergence value is determined to meet a first condition;
and under the condition that the target convergence value does not meet the first condition, determining the target adjustment step size as an initial step size, wherein the initial step size is a step size used by the target camera equipment when a preset number of continuous frame images are collected.
In one exemplary embodiment, after determining the target adjustment step size of the focus motor of the target image pickup apparatus, the method further includes:
and carrying out focusing processing on the target camera equipment according to the target adjustment step length.
According to another embodiment of the present invention, there is provided a focusing step determining apparatus including:
the parameter acquisition module is used for acquiring focus motor point positions and frame image definition when the target camera equipment respectively acquires a preset number of continuous frame images;
the coordinate determination module is used for determining a coordinate point corresponding to each frame of image based on the plurality of focus motor point locations and the plurality of definitions which are respectively obtained, wherein the coordinate value of the coordinate point corresponding to each frame of image comprises the focus motor point location when each frame of image is collected and the definition of each frame of image;
a step length determining module, configured to determine a target adjustment step length of a focus motor of the target image capturing apparatus based on coordinate values of coordinate points corresponding to a first target frame image, a second target frame image, a third target frame image, and a fourth target frame image included in the consecutive frame images, where the fourth target frame image is a frame image before the third target frame image, the second target frame image, and the first target frame image are sequentially adjacent frame images, and the first target frame image is a last frame image of the consecutive frame images.
In one exemplary embodiment, the step size determining module includes:
a first parameter determination unit configured to determine a first angle change value and a first residual change rate of a first coordinate point based on a first coordinate value, a second coordinate value and a fourth coordinate value, wherein the first coordinate value is a coordinate value of the first coordinate point corresponding to the first target frame image, the second coordinate value is a coordinate value of a second coordinate point corresponding to the second target frame image, the fourth coordinate value is a coordinate value of a fourth coordinate point corresponding to the fourth target frame image, the first angle change value is a change amount of a first average per-step sharpness value and a second average per-step sharpness value, the first average per-step sharpness value is an average per-step sharpness value between the first target frame image and the fourth target frame image, the second average per-step sharpness value is an average per-step sharpness value between the first target frame image and the second target frame image, the first residual change rate is used to indicate a rate of change of sharpness per step for the first target frame image and the second target frame image;
a second parameter determination unit for determining a second angle change value and a second residual change rate of the second coordinate point based on the second coordinate value, the third coordinate value, and the fourth coordinate value, wherein the third coordinate value is a coordinate value of a third coordinate point corresponding to the third target frame image, the second angle change value is a change amount of a third average per-step definition value and a fourth average per-step definition value, the third average per-step sharpness value is an average per-step sharpness value between the second target frame image and the fourth target frame image, the fourth average per-step sharpness value is an average per-step sharpness value between the second target frame image and the third target frame image, the second residual change rate is used to indicate a sharpness per step change rate of the second target frame image and the third target frame image;
a step size determination unit configured to determine a target adjustment step size of a focus motor of the target image pickup apparatus based on the first angle change value, the first residual change rate, the second angle change value, and the second residual change rate.
According to a further embodiment of the present invention, there is also provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
According to the invention, as the step length adjustment is carried out according to the coordinate values of the coordinate points in the continuous frame images, the camera equipment can carry out rapid focusing, thereby reducing the time consumption in the focusing process, solving the problem of low focusing efficiency in the related technology and achieving the effect of improving the focusing efficiency.
Drawings
Fig. 1 is a block diagram of a hardware structure of a mobile terminal of a method for determining a focusing step according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of focus step determination according to an embodiment of the present invention;
FIG. 3 is a schematic view of a hill-climbing focusing curve according to an embodiment of the present invention;
fig. 4 is a block diagram of a focusing step determining apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a focusing step determining apparatus according to an embodiment of the present invention.
Detailed Description
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the embodiments of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Taking an example of the method running on a mobile terminal, fig. 1 is a block diagram of a hardware structure of the mobile terminal of a method for determining a focusing step according to an embodiment of the present invention. As shown in fig. 1, the mobile terminal may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), and a memory 104 for storing data, wherein the mobile terminal may further include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration, and does not limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store a computer program, for example, a software program and a module of application software, such as a computer program corresponding to a focusing step determining method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, so as to implement the method described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the mobile terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
In the present embodiment, a method for determining a focusing step is provided, and fig. 2 is a flowchart of a method for determining a focusing step according to an embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:
step S202, acquiring focus motor point positions and frame image definition of target camera equipment when a preset number of continuous frame images are respectively acquired;
in this embodiment, when the target image capturing device captures a frame image, the focus motor point location and the definition corresponding to the capture of each frame image are recorded, so as to perform subsequent calculation.
The point location of the focus motor comprises information such as focus step length and brightness when a target camera device collects a certain frame of image; the focus motor point location and the definition of the frame image can be obtained by storing the focus motor point location and the definition of the frame image in a target area and then calling from the target area; the predetermined number may be at least 4 frames of images.
It should be noted that, the step of obtaining the focus motor point location and the definition of the frame image when the target image capturing device respectively captures a predetermined number of continuous frame images is an operation before image capturing is performed on the target image capturing device to form an image, that is, after focusing is completed, image capturing is performed to obtain an image with higher definition; wherein the image comprises a picture and/or a video.
Step S204, determining a coordinate point corresponding to each frame of image based on the plurality of focus motor point locations and the plurality of definitions which are respectively obtained, wherein the coordinate value of the coordinate point corresponding to each frame of image comprises the focus motor point location when each frame of image is collected and the definition of each frame of image;
in this embodiment, the coordinate point is determined to facilitate positioning of the focus motor point of each frame of image when focusing is performed by using the hill-climbing focusing algorithm, so as to facilitate determining the curve of the hill-climbing focusing algorithm.
The point positions of the focusing motors are in one-to-one correspondence with the definition, so that a two-dimensional coordinate system is formed, and the positioning point positions of the focusing motors are connected through curves to determine the curves of the hill-climbing focusing algorithm.
Step S206, determining a target adjustment step length of a focus motor of the target camera device based on coordinate values of coordinate points corresponding to a first target frame image, a second target frame image, a third target frame image and a fourth target frame image included in the consecutive frame images, where the fourth target frame image is a frame image before the third target frame image, the second target frame image and the first target frame image are sequentially adjacent frame images, and the first target frame image is a last frame image of the consecutive frame images.
In the embodiment, the target adjustment step length of the focusing motor of the target camera device is determined according to the coordinate values of the coordinate points of the target frame image of at least four frames, so that the repeated debugging process of the target adjustment step length is reduced, the time required by the focusing process is reduced, and the focusing efficiency is improved.
The target adjustment step length may be adjusted according to actual needs, for example, set to 1, or set to other values; the fourth target frame image may be a frame image adjacent to the third target frame, or may be an image not adjacent to the third target frame image.
Through the steps, the step length is adjusted according to the coordinate values of the coordinate points in the continuous frame images, so that the camera equipment can carry out quick focusing, the time consumption in the focusing process is reduced, the problem of low focusing efficiency in the related technology is solved, and the focusing efficiency is improved.
In an alternative embodiment, determining the target adjustment step size of the focus motor of the target image capturing apparatus based on the coordinate values of the coordinate points corresponding to the first target frame image, the second target frame image, the third target frame image, and the fourth target frame image included in the consecutive frame images includes:
step S2062 of determining a first angle change value and a first residual change rate of the first coordinate point based on the first coordinate value, the second coordinate value and the fourth coordinate value, the first coordinate value is a coordinate value of a first coordinate point corresponding to the first target frame image, the second coordinate value is a coordinate value of a second coordinate point corresponding to the second target frame image, the fourth coordinate value is a coordinate value of a fourth coordinate point corresponding to the fourth target frame image, the first angle change value is a variable quantity of a first average per-step definition value and a second average per-step definition value, the first average per-step definition value is an average per-step definition value between the first target frame image and the fourth target frame image, the second average per-step definition value is an average per-step definition value between the first target frame image and the second target frame image, and the first residual change rate is used for indicating a per-step change rate of definition of the first target frame image and the second target frame image;
step S2064, determining a second angle change value and a second residual change rate of a second coordinate point based on a second coordinate value, a third coordinate value and a fourth coordinate value, wherein the third coordinate value is the coordinate value of the third coordinate point corresponding to a third target frame image, the second angle change value is the variable quantity of a third average per-step sharpness value and a fourth average per-step sharpness value, the third average per-step sharpness value is the average per-step sharpness value between the second target frame image and a fourth target frame image, the fourth average per-step sharpness value is the average per-step sharpness value between the second target frame image and the third target frame image, and the second residual change rate is used for indicating the sharpness per-step change rate of the second target frame image and the third target frame image;
step S2066 of determining a target adjustment step size of the focus motor of the target image pickup apparatus based on the first angle change value, the first residual change rate, the second angle change value, and the second residual change rate.
In this embodiment, the first angle change value and the second angle change value are determined to determine the angle change of the coordinate point between the two collected frame images of two adjacent frames, so as to determine whether the definition exceeds or is about to reach the focus peak value, and when the definition exceeds the focus peak value, the second angle change value may be greater than the first angle change value, at this time, it may be determined that the focus peak value is located on the left side of the focus motor point location corresponding to the first target frame image, so that the position of the focus peak value can be quickly determined, and so on; similarly, the first residual change rate and the second residual change rate are also determined to determine the sharpness transformation between two adjacent frames, so as to quickly determine the position of the focus peak.
For example, as shown in fig. 3, the first target frame image is a frame image in which the focus motor point is located at a point B, the second target frame image is a frame image in which the focus motor point is located at a point C, the third target frame image is a frame image in which the focus motor point is located at a point D, and the fourth target frame image is a frame image in which the focus motor point is located at a point a, and the first angle change value and the second angle change value may be calculated by the following formulas:
in the formula (1), the reaction mixture is,indicating the sharpness of the current frame image (i.e. the first target frame image),indicating the sharpness of the initial frame image (i.e. the fourth target frame image),indicating the sharpness of the previous frame image (i.e. the second target frame image),represents the focus step size of the current frame image (i.e. the first target frame image),indicating the focus step size of the initial frame image (i.e. the fourth target frame image),representing the focus step of the previous frame image (i.e. the second target frame image),relative change rates of the definition of the first target frame image and the second target frame image relative to the fourth target frame image are respectively, namely a first average per-step definition value;the relative change rate of the definition of the second target frame image and the third target frame image relative to the fourth target frame image is the definition value of each step of the second average; in the normal hill-climbing focusing algorithm, it is usually used to measure whether the sharpness reaches the focusing peak or not, whenThe curve shows a descending trend, namely the definition of the current frame image passes through a peak point; in order to avoid encountering false peaks, a certain threshold limit is set; when in useIndicating that the curve is in the riseHowever, it is difficult to determine whether the peak is close to a stable peak, and therefore, a supplementary judgment is required by equation (2); in the formula (2), an angle (C) with respect to the previous frame) The smaller the angle formed with the initial angle () The smaller the angle difference formedCloser to the peak, smaller;namely a calculation formula of the first angle change value and the second angle change value.
The first residual change rate and the second residual change rate can be calculated by the following formula:
in the formula (3), the reaction mixture is,i.e. the first rate of change of the residual error,i.e. the second rate of change of the residual error,represents the sharpness value of the current frame,a sharpness value representing a previous frame is shown,representing the sharpness value of a frame further ahead,representing the step size of the walking of the current frame relative to the previous frame,indicating the focus step size of the previous frame image,the residual change rate is calculated representing the change rate per step of the sharpness values of the preceding and following frames.
In an alternative embodiment, determining the target adjustment step size of the focus motor of the target image pickup apparatus based on the first angle change value, the first residual change rate, the second angle change value, and the second residual change rate includes:
step S20662, determining a first difference between the first angle variation value and the second angle variation value;
step S20664 of determining a second difference between the first residual change rate and the second residual change rate;
in step S20666, a target adjustment step size of the focus motor of the target image pickup apparatus is determined based on the first difference and the second difference.
In the present embodiment, the first difference is determined to determine a change between angle change values of adjacent frame images, and the second difference is determined to determine a change in sharpness of the adjacent frame images.
as shown in formula (4), whenGreater than 0 indicates that the sharpness value is at an increase in the curveStage whenAnd if the value is less than 0, the search area reaches the gentle area and approaches the focusing peak value quickly.
in the formula (5)The point angles of the focus motors representing the B and C frames of images, respectively, and the sharpness values of the B, C, D points represent the B and C frames of images, respectively,
Wherein: when the f value is much larger than the p value, and the sharpness of the frame image does not reach the focus peak,,. If the sharpness of the B point exceeds the focus peak, then。
Can be obtained from the formula (4),will affect the focus valueValue, so that it is possible to perform judgment-ahead convergence point verification, that is:
it should be noted that the execution order of step S20662 and step S20664 may be changed, that is, step S20664 may be executed first, and then step S20662 may be executed.
In an alternative embodiment, determining the target adjustment step size of the focus motor of the target image pickup apparatus based on the first difference and the second difference includes:
step S206662 of determining a target convergence value based on the first difference and the second difference;
step S206664, determining a target adjustment step size according to the target convergence value.
In this embodiment, the target convergence value is determined to determine whether the sharpness of the frame image exceeds the focus peak or reaches the vicinity of the focus peak, and then the target adjustment step is determined so that the subsequent focusing process can quickly reach the focus peak.
Wherein the target convergence value can be determined by the following formula:
In an alternative embodiment, determining the target adjustment step size according to the target convergence value comprises:
step S2066642, determining the target adjustment step size as a preset step size value when it is determined that the target convergence value satisfies the first condition;
in step S2066644, in the case that the target convergence value does not satisfy the first condition, the target adjustment step size is determined to be an initial step size, where the initial step size is a step size used by the target image capturing apparatus when capturing a predetermined number of consecutive frame images.
In this embodiment, the first condition may (but is not limited to) be the following formula:
wherein, when the convergence condition is not reached, that isAnd then, the focusing step length is set to walk according to the original setting, otherwise, the focusing step length is set to be 1.
In an optional embodiment, after determining the target adjustment step size of the focus motor of the target image capturing apparatus, the method further includes:
step S208, focus processing is performed on the target image pickup apparatus in accordance with the target adjustment step size.
In this embodiment, the focusing process may (but is not limited to) perform frame image acquisition and sharpness recording according to the target adjustment step size, and make the sharpness reach the focusing peak.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a focusing step determining device is further provided, and the device is used to implement the foregoing embodiments and preferred embodiments, which have already been described and are not described again. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 4 is a block diagram of a focusing step determining apparatus according to an embodiment of the present invention, as shown in fig. 4, the apparatus including:
the parameter acquisition module 42 is configured to acquire focus motor point locations and sharpness of frame images when the target camera device respectively acquires a predetermined number of consecutive frame images;
a coordinate determination module 44, configured to determine, based on the plurality of focus motor point locations and the plurality of definitions respectively obtained, a coordinate point corresponding to each frame of image, where a coordinate value of the coordinate point corresponding to each frame of image includes the focus motor point location when each frame of image is acquired and the definition of each frame of image;
a step determining module 46, configured to determine a target adjustment step of a focus motor of the target image capturing apparatus based on coordinate values of coordinate points corresponding to a first target frame image, a second target frame image, a third target frame image, and a fourth target frame image included in the consecutive frame images, where the fourth target frame image is a frame image before the third target frame image, the second target frame image, and the first target frame image are sequentially adjacent frame images, and the first target frame image is a last frame image of the consecutive frame images.
In an alternative embodiment, step size determination module 46 includes:
a first parameter determining unit 462 for determining a first angle change value and a first residual change rate of a first coordinate point based on a first coordinate value, a second coordinate value and a fourth coordinate value, wherein the first coordinate value is a coordinate value of the first coordinate point corresponding to the first target frame image, the second coordinate value is a coordinate value of the second coordinate point corresponding to the second target frame image, the fourth coordinate value is a coordinate value of the fourth coordinate point corresponding to the fourth target frame image, the first angle change value is a change amount of a first average per-step sharpness value and a second average per-step sharpness value, the first average per-step sharpness value is an average per-step sharpness value between the first target frame image and the fourth target frame image, the second average per-step sharpness value is an average per-step sharpness value between the first target frame image and the second target frame image, the first residual change rate is used to indicate a rate of change of sharpness per step for the first target frame image and the second target frame image;
a second parameter determination unit 464 for determining a second angle change value and a second residual change rate of the second coordinate point based on the second coordinate value, the third coordinate value, and the fourth coordinate value, wherein the third coordinate value is a coordinate value of a third coordinate point corresponding to the third target frame image, the second angle change value is a change amount of a third average per-step definition value and a fourth average per-step definition value, the third average per-step sharpness value is an average per-step sharpness value between the second target frame image and the fourth target frame image, the fourth average per-step sharpness value is an average per-step sharpness value between the second target frame image and the third target frame image, the second residual change rate is used to indicate a sharpness per step change rate of the second target frame image and the third target frame image;
a step determining unit 466 for determining a target adjustment step size of a focus motor of the target image pickup apparatus based on the first angle change value, the first residual change rate, the second angle change value, and the second residual change rate.
In an alternative embodiment, the step size determining unit 466 includes:
a first difference determining subunit 462 for determining a first difference between the first angle change value and the second angle change value;
a second difference determining subunit 464 for determining a second difference between the first residual change rate and the second residual change rate;
a step determining subunit 466 that determines a target adjustment step size of the focus motor of the target image pickup apparatus based on the first difference value and the second difference value.
In an alternative embodiment, the step size determining subunit 466 includes:
a convergence determining subunit 4662 configured to determine a target convergence value based on the first difference and the second difference;
a target step size subunit 4664, configured to determine the target adjustment step size according to the target convergence value.
In an alternative embodiment, target step size subunit 4664 includes:
a first step length subunit 46642, configured to, in a case that it is determined that the target convergence value satisfies the first condition, determine the target adjustment step length to be a preset step length value;
a second step sub-unit 46644, configured to determine the target adjustment step size as an initial step size in a case where the target convergence value does not satisfy the first condition, where the initial step size is a step size used by the target image capturing apparatus when capturing a predetermined number of consecutive frame images.
In an optional embodiment, the apparatus further comprises:
and a focus processing module 48, configured to perform focus processing on the target image capturing apparatus according to a target adjustment step size after determining the target adjustment step size of a focus motor of the target image capturing apparatus.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
The present invention will be described with reference to specific examples.
As shown in fig. 3, assume that: point A represents the initial point of motor operation, point B represents the FV peak point found by the motor, where the sharpness is greatest, and point C, D represents the position of the previous two frames of motor operation closest to the peak point, whereThe angle between the peak point and the initial point of motor operation,the angle between the frame nearest to the peak point and the initial point of motor operation,representing the angle formed by the current motor position and the previous frame image running position C,representing the angle formed by the motor position of the previous frame image and the image running position of the previous frame image.
As shown in fig. 3, during the focusing and climbing process, the maximum value FVmax of the sharpness values FV is found according to the constant movement of the motor Pos. The searching of normal FVmax needs to continuously search according to a focusing climbing algorithm, particularly, the peak point B is needed to be passed, the peak point can be judged only when the focusing peak value is found to start to descend, in the normal focusing process, the image can be vibrated due to the repeated pushing of the focusing motor after the peak point is passed, and the clear and fuzzy switching is carried out for many times on the vision of human eyes.
At this time, the calculation processing may be performed according to the following equation:
the closer the motor is to the focus peak during travel, the angle formed with the previous frame () The smaller, the angle formed with the initial angle: () The smaller, and thus the angular difference formedThe smaller and closer to the focus peak, thereby calculating the values of the two previous and next frames B and CWhereinRepresenting the B and C frame angles, respectively, assuming that the sharpness values of the B, C, D points represent the B and C frame angles, respectivelyB, C, D difference in position between the three points and the initial point:
Wherein:
when the f value is far larger than the p value and the definition of the frame image does not reach the focusing peak value,,. If the sharpness of the B point exceeds the focus peak, then。
From the above formula, one can obtain:will focus on the focus valueThe convergence point verification judgment can therefore be made in advance: when B has not yet reached the peak point,when B is close to the peak point,。
accordingly, when the peak point is approached, the sharpness value is in a slowly rising trend relative to the previous frame, and when the peak point is exceeded, the sharpness value is in a descending trend. In order to achieve fast convergence when the resolution value is close to the peak point, the pre-judgment needs to be performed when the fast rising period of the resolution value is ended so as to reduce the step length at the later stage and achieve the purpose of fast convergence.
As shown in FIG. 3, the conventional sharpness peak point search determination is mainly determined by the sharpness change rate of the previous frame, and is calculated as described aboveThe formula shows that convergence is performed when the change rate meets the descending trend and meets the threshold condition, but at the moment, the image is pushed to pass through a clear point by a motor, and obvious blurring appears, so that the judgment is preferably performed in advance.
The residual error change rate is calculated according to the change rate of each step of the definition values of the previous frame and the next frame, and the judgment convergence cutoff condition is shown in the following formula:
whereinRepresents the sharpness value of the current frame,a sharpness value representing a previous frame is shown,representing the sharpness value of a frame further ahead,representing the step size of the walking of the current frame relative to the previous frame,represents the step size of the walk of the previous frame,the residual change rate is calculated representing the change rate per step of the sharpness values of the preceding and following frames. When in use
As shown in the above formula, whenGreater than 0, the sharpness value is at the curve rising stage whenAnd if the value is less than 0, the search area reaches the gentle area and approaches the peak point quickly. Through FV residual change rate meterAnd the method is beneficial to locking a focus peak point in advance, is beneficial to fast convergence of focusing and reduces the step size.
Then, whether the focusing has approached the convergence condition is defined according to the FV angle change rate, the residual change rate and the FV relative change rate, as follows:are defined as 5 and-25, respectively.
according to the convergence condition, the focusing step is set as follows:
wherein when the convergence condition is not reached, i.e.And then, the step length setting is walked according to the original setting, and the step length changing self-adaptive adjustment is carried out according to the FV relative change rate.
As shown in fig. 5, the present application also relates to a specific device structure including:
the focusing triggering module is used for triggering focusing processing;
an angle change rate determination unit for performing angle change rate calculation;
a relative change rate determination unit for performing a relative change rate calculation;
a residual change rate determination unit for performing a residual change rate calculation;
a step size adjustment unit (corresponding to the aforementioned target step size subunit 4664) for performing focusing step size adjustment processing;
and a focusing and climbing module (corresponding to the focusing module 48) for performing focusing according to the adjusted focusing step length.
Embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above-mentioned method embodiments when executed.
In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
In an exemplary embodiment, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
It will be apparent to those skilled in the art that the various modules or steps of the invention described above may be implemented using a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and they may be implemented using program code executable by the computing devices, such that they may be stored in a memory device and executed by the computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into various integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.
Claims (8)
1. A method for determining a focus step size, comprising:
acquiring the point positions of a focusing motor and the definition of frame images when a target camera device respectively collects a preset number of continuous frame images;
determining a coordinate point corresponding to each frame of image based on the plurality of focus motor point locations and the plurality of definitions which are respectively obtained, wherein the coordinate value of the coordinate point corresponding to each frame of image comprises the focus motor point location when each frame of image is collected and the definition of each frame of image;
determining a target adjustment step length of a focusing motor of the target camera device based on coordinate values of coordinate points corresponding to a first target frame image, a second target frame image, a third target frame image and a fourth target frame image included in the continuous frame images, wherein the fourth target frame image is a frame image before the third target frame image, the second target frame image and the first target frame image are sequentially adjacent frame images, and the first target frame image is a last frame image of the continuous frame images;
wherein determining a target adjustment step size of a focus motor of the target image capturing apparatus based on coordinate values of coordinate points corresponding to a first target frame image, a second target frame image, a third target frame image, and a fourth target frame image included in the continuous frame images comprises:
determining a first angle change value and a first residual change rate of a first coordinate point based on a first coordinate value, a second coordinate value and a fourth coordinate value, wherein the first coordinate value is a coordinate value of the first coordinate point corresponding to the first target frame image, the second coordinate value is a coordinate value of a second coordinate point corresponding to the second target frame image, the fourth coordinate value is a coordinate value of a fourth coordinate point corresponding to the fourth target frame image, the first angle change value is a variation of a first average per-step sharpness value and a second average per-step sharpness value, the first average per-step sharpness value is an average per-step sharpness value between the first target frame image and the fourth target frame image, the second average per-step sharpness value is an average per-step sharpness value between the first target frame image and the second target frame image, the first residual change rate is used to indicate a rate of change of sharpness per step for the first target frame image and the second target frame image;
determining a second angle change value and a second residual change rate of a second coordinate point based on a second coordinate value, a third coordinate value and a fourth coordinate value, wherein the third coordinate value is a coordinate value of a third coordinate point corresponding to the third target frame image, the second angle change value is a variation of a third average per-step sharpness value and a fourth average per-step sharpness value, the third average per-step sharpness value is an average per-step sharpness value between the second target frame image and the fourth target frame image, the fourth average per-step sharpness value is an average per-step sharpness value between the second target frame image and the third target frame image, and the second residual change rate is used for indicating a sharpness per-step change rate of the second target frame image and the third target frame image;
determining a target adjustment step size of a focus motor of the target image pickup apparatus based on the first angle change value, the first residual change rate, the second angle change value, and the second residual change rate.
2. The method according to claim 1, wherein determining a target adjustment step size for a focus motor of the target image capture device based on the first angle change value, the first residual change rate, the second angle change value, and the second residual change rate comprises:
determining a first difference between the first angle change value and the second angle change value;
determining a second difference between the first rate of change of residual and the second rate of change of residual;
determining a target adjustment step size of a focus motor of the target image pickup apparatus based on the first difference and the second difference.
3. The method according to claim 2, wherein determining a target adjustment step size for a focus motor of the target imaging apparatus based on the first difference and the second difference comprises:
determining a target convergence value based on the first difference and the second difference;
and determining the target adjustment step length according to the target convergence value.
4. The method of claim 3, wherein determining the target adjustment step size according to the target convergence value comprises:
determining the target adjustment step length as a preset step length value under the condition that the target convergence value is determined to meet a first condition;
and under the condition that the target convergence value does not meet the first condition, determining the target adjustment step size as an initial step size, wherein the initial step size is a step size used by the target camera equipment when a preset number of continuous frame images are collected.
5. The method according to claim 1, wherein after determining a target adjustment step size for a focus motor of the target image capture apparatus, the method further comprises:
and carrying out focusing processing on the target camera equipment according to the target adjustment step length.
6. A focusing step size determining apparatus, comprising:
the parameter acquisition module is used for acquiring focus motor point positions and frame image definition when the target camera equipment respectively acquires a preset number of continuous frame images;
the coordinate determination module is used for determining a coordinate point corresponding to each frame of image based on the plurality of focus motor point locations and the plurality of definitions which are respectively obtained, wherein the coordinate value of the coordinate point corresponding to each frame of image comprises the focus motor point location when each frame of image is collected and the definition of each frame of image;
a step length determining module, configured to determine a target adjustment step length of a focus motor of the target image capturing apparatus based on coordinate values of coordinate points corresponding to a first target frame image, a second target frame image, a third target frame image, and a fourth target frame image included in the consecutive frame images, where the fourth target frame image is a frame image before the third target frame image, and the third target frame image, the second target frame image, and the first target frame image are sequentially adjacent frame images;
wherein the step size determining module comprises:
a first parameter determination unit configured to determine a first angle change value and a first residual change rate of a first coordinate point based on a first coordinate value, a second coordinate value and a fourth coordinate value, wherein the first coordinate value is a coordinate value of the first coordinate point corresponding to the first target frame image, the second coordinate value is a coordinate value of a second coordinate point corresponding to the second target frame image, the fourth coordinate value is a coordinate value of a fourth coordinate point corresponding to the fourth target frame image, the first angle change value is a change amount of a first average per-step sharpness value and a second average per-step sharpness value, the first average per-step sharpness value is an average per-step sharpness value between the first target frame image and the fourth target frame image, the second average per-step sharpness value is an average per-step sharpness value between the first target frame image and the second target frame image, the first residual change rate is used to indicate a rate of change of sharpness per step for the first target frame image and the second target frame image;
a second parameter determination unit for determining a second angle change value and a second residual change rate of the second coordinate point based on the second coordinate value, the third coordinate value, and the fourth coordinate value, wherein the third coordinate value is a coordinate value of a third coordinate point corresponding to the third target frame image, the second angle change value is a change amount of a third average per-step definition value and a fourth average per-step definition value, the third average per-step sharpness value is an average per-step sharpness value between the second target frame image and the fourth target frame image, the fourth average per-step sharpness value is an average per-step sharpness value between the second target frame image and the third target frame image, the second residual change rate is used to indicate a sharpness per step change rate of the second target frame image and the third target frame image;
a step size determination unit configured to determine a target adjustment step size of a focus motor of the target image pickup apparatus based on the first angle change value, the first residual change rate, the second angle change value, and the second residual change rate.
7. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 5 when executed.
8. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 5.
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110114788.9A CN112449117B (en) | 2021-01-28 | 2021-01-28 | Focusing step length determining method and device, storage medium and electronic device |
PCT/CN2022/073007 WO2022161250A1 (en) | 2021-01-28 | 2022-01-20 | Photographing control method and apparatus, computer device and storage medium |
US18/274,742 US12328506B2 (en) | 2021-01-28 | 2022-01-20 | Photographing control method and apparatus, computer device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110114788.9A CN112449117B (en) | 2021-01-28 | 2021-01-28 | Focusing step length determining method and device, storage medium and electronic device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112449117A CN112449117A (en) | 2021-03-05 |
CN112449117B true CN112449117B (en) | 2021-06-18 |
Family
ID=74739509
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110114788.9A Active CN112449117B (en) | 2021-01-28 | 2021-01-28 | Focusing step length determining method and device, storage medium and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112449117B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US12328506B2 (en) | 2021-01-28 | 2025-06-10 | Zhejiang Huachuang Vision Technology Co., Ltd. | Photographing control method and apparatus, computer device and storage medium |
CN113777040B (en) * | 2021-09-14 | 2025-02-18 | 京东方科技集团股份有限公司 | Focusing method and device of linear array camera and automatic optical detection equipment |
CN114374800B (en) * | 2022-01-14 | 2023-07-14 | 浙江大华技术股份有限公司 | Focusing processing method and device, storage medium and electronic device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105093509A (en) * | 2015-09-29 | 2015-11-25 | 爱威科技股份有限公司 | Automatic focusing method of microscope, automatic focusing system and stool examination microscope |
CN106341596A (en) * | 2016-08-31 | 2017-01-18 | 浙江宇视科技有限公司 | Focusing method and focusing device |
CN106921830A (en) * | 2015-12-28 | 2017-07-04 | 浙江大华技术股份有限公司 | A kind of method and device of automatic focusing |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9392158B2 (en) * | 2012-10-04 | 2016-07-12 | Nvidia Corporation | Method and system for intelligent dynamic autofocus search |
-
2021
- 2021-01-28 CN CN202110114788.9A patent/CN112449117B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105093509A (en) * | 2015-09-29 | 2015-11-25 | 爱威科技股份有限公司 | Automatic focusing method of microscope, automatic focusing system and stool examination microscope |
CN106921830A (en) * | 2015-12-28 | 2017-07-04 | 浙江大华技术股份有限公司 | A kind of method and device of automatic focusing |
CN106341596A (en) * | 2016-08-31 | 2017-01-18 | 浙江宇视科技有限公司 | Focusing method and focusing device |
Also Published As
Publication number | Publication date |
---|---|
CN112449117A (en) | 2021-03-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112449117B (en) | Focusing step length determining method and device, storage medium and electronic device | |
CN105100615B (en) | Image preview method, device and terminal | |
US10506248B2 (en) | Foreground detection for video stabilization | |
CN109635800B (en) | Image focusing method and related equipment thereof | |
CN110263699B (en) | Video image processing method, device, equipment and storage medium | |
CN110336948B (en) | Method and device for focusing in preset area, storage medium and electronic device | |
WO2021134179A1 (en) | Focusing method and apparatus, photographing device, movable platform and storage medium | |
JP2008529322A (en) | Electronic device and image data processing method for image data processing | |
CN104184935A (en) | Image shooting device and method | |
CN110084765A (en) | Image processing method, image processing device and terminal equipment | |
CN111105434A (en) | Movement trajectory synthesis method and electronic device | |
CN113099135B (en) | Infrared image focusing, terminal device and computer readable storage medium | |
CN110753182A (en) | Adjusting method and apparatus of image forming apparatus | |
CN113727003A (en) | Cloud deck position self-checking method and device, storage medium and electronic device | |
CN109698946A (en) | Projection device Atomatic focusing method, projection device and computer readable storage medium | |
WO2023040423A1 (en) | Method and apparatus for lens focusing, computer device and storage medium | |
CN112418279B (en) | Image fusion method, device, electronic equipment and readable storage medium | |
CN114422665B (en) | Shooting method based on multiple cameras and related device | |
CN101095341A (en) | Digital imaging with autofocus | |
CN105467741A (en) | Panoramic shooting method and terminal | |
CN117014721A (en) | Focusing method and device of target area, storage medium and electronic device | |
CN113938671A (en) | Image content analysis method and device, electronic equipment and storage medium | |
KR20150032764A (en) | Method and image capturing device for generating artificially defocused blurred image | |
CN109121194B (en) | Method and apparatus for state transition of electronic device | |
CN114422776B (en) | Detection method and device of image pickup equipment, storage medium and electronic device |
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 |