CN112640425A - Focusing control method, device, equipment, movable platform and storage medium - Google Patents

Focusing control method, device, equipment, movable platform and storage medium Download PDF

Info

Publication number
CN112640425A
CN112640425A CN202080004951.XA CN202080004951A CN112640425A CN 112640425 A CN112640425 A CN 112640425A CN 202080004951 A CN202080004951 A CN 202080004951A CN 112640425 A CN112640425 A CN 112640425A
Authority
CN
China
Prior art keywords
region
image
focusing
contrast
determining
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.)
Pending
Application number
CN202080004951.XA
Other languages
Chinese (zh)
Inventor
韩守谦
郑子翔
胡涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SZ DJI Technology Co Ltd
Original Assignee
SZ DJI Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SZ DJI Technology Co Ltd filed Critical SZ DJI Technology Co Ltd
Publication of CN112640425A publication Critical patent/CN112640425A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • H04N23/673Focus control based on electronic image sensor signals based on contrast or high frequency components of image signals, e.g. hill climbing method

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Automatic Focus Adjustment (AREA)
  • Studio Devices (AREA)

Abstract

The embodiment of the invention provides a focusing control method, a focusing control device, equipment, a movable platform and a storage medium, wherein the method comprises the following steps: acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor; determining whether an object exists in the multiple frames of images to be processed and whether the relative contrast of image areas corresponding to the object meets a preset condition; wherein, the relative contrast is determined according to an output result obtained by filtering the image area corresponding to the object by at least one filter; and if the relative contrast of the image area corresponding to the object meets a preset condition, carrying out focusing processing on the image area corresponding to the object. The focusing control method, the device, the equipment, the movable platform and the storage medium provided by the embodiment of the invention can effectively improve the focusing efficiency and accuracy.

Description

Focusing control method, device, equipment, movable platform and storage medium
Technical Field
The embodiment of the invention relates to the field of cameras, in particular to a focusing control method, a focusing control device, focusing control equipment, a movable platform and a storage medium.
Background
Contrast Detection Auto Focus (CDAF) is a common focusing method in the prior art, and through Contrast focusing, automatic focusing of a camera can be realized, a manual focusing process of a user is omitted, and convenience is provided for the user.
In order to meet the shooting requirements of different scenes, a contrast focusing algorithm provides a plurality of filters, a proper filter can be selected for the current shot scene, the shot image is filtered by the selected filter to obtain the contrast of a plurality of areas in the image, the contrast of each area can be used for representing the definition of the area, the contrast of each area is continuously changed along with the continuous change of the lens position, and the focusing process can be completed according to the change of the contrast of the area.
The prior art has the disadvantages that if there are interfering objects in the shot picture, for example, there are objects such as white wall, glass, sky, etc., since these objects are large or close to each other, the existing focusing algorithm may focus on these objects, which may result in mis-focusing and decrease the focusing efficiency and accuracy.
Disclosure of Invention
The embodiment of the invention provides a focusing control method, a focusing control device, equipment, a movable platform and a storage medium, which are used for solving the technical problem of low focusing efficiency and accuracy in the prior art.
A first aspect of an embodiment of the present invention provides a focus control method, including:
acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor;
determining whether an object exists in the multiple frames of images to be processed and whether the relative contrast of image areas corresponding to the object meets a preset condition; wherein, the relative contrast is determined according to an output result obtained by filtering the image area corresponding to the object by at least one filter;
and if the relative contrast of the image area corresponding to the object meets a preset condition, carrying out focusing processing on the image area corresponding to the object.
A second aspect of the embodiments of the present invention provides a focus control method, including:
acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor;
and if the elongated object exists in the image to be processed and meets the preset requirement, focusing by taking the elongated object as a target.
A third aspect of an embodiment of the present invention provides a focus control apparatus, including:
a memory for storing a computer program;
a processor for executing the computer program stored in the memory to implement:
acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor;
determining whether an object exists in the multiple frames of images to be processed and whether the relative contrast of image areas corresponding to the object meets a preset condition; wherein, the relative contrast is determined according to an output result obtained by filtering the image area corresponding to the object by at least one filter;
and if the relative contrast of the image area corresponding to the object meets a preset condition, carrying out focusing processing on the image area corresponding to the object.
A fourth aspect of the embodiments of the present invention provides a focus control apparatus, including:
a memory for storing a computer program;
a processor for executing the computer program stored in the memory to implement:
acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor;
and if the elongated object exists in the image to be processed and meets the preset requirement, focusing by taking the elongated object as a target.
A fifth aspect of an embodiment of the present invention provides a focus control apparatus, including:
the focusing motor is used for moving a lens, and the focusing motor is used for focusing the image of the lens;
the first determining circuit is used for determining whether an object exists in the multiple frames of images to be processed and whether the relative contrast of image areas corresponding to the object meets a preset condition; wherein, the relative contrast is determined according to an output result obtained by filtering the image area corresponding to the object by at least one filter;
and the first focusing processing circuit is used for carrying out focusing processing on the image area corresponding to the object when the relative contrast of the image area corresponding to the object meets a preset condition.
A sixth aspect of an embodiment of the present invention provides a focus control apparatus, including:
the second image acquisition circuit is used for acquiring a plurality of frames of images to be processed, wherein the plurality of frames of images to be processed comprise a plurality of frames of images shot by the lens in the moving process of the focusing motor;
and the second focusing processing circuit is used for focusing by taking the elongated object as a target when the elongated object exists in the image to be processed and meets a preset requirement.
A seventh aspect of the embodiments of the present invention provides a shooting apparatus including the focus control device of the third aspect.
An eighth aspect of the embodiments of the present invention provides a shooting apparatus including the focus control device described in the fourth aspect.
A ninth aspect of the embodiments of the present invention provides a movable platform, including the shooting device of the seventh aspect.
A tenth aspect of the embodiments of the present invention provides a movable platform, including the shooting device of the eighth aspect.
An eleventh aspect of embodiments of the present invention provides a computer-readable storage medium having stored therein program instructions for implementing the focus control method according to the first aspect.
A twelfth aspect of the embodiments of the present invention provides a computer-readable storage medium, in which program instructions are stored, the program instructions being used to implement the focus control method according to the second aspect.
The focusing control method, the device, the equipment, the movable platform and the storage medium provided by the embodiment of the invention can effectively improve the focusing efficiency and accuracy.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
fig. 1 is a schematic flowchart of a focus control method according to an embodiment of the present invention;
fig. 2 is a first schematic diagram illustrating a contrast curve corresponding to a plurality of frames of images in a focusing control method according to a first embodiment of the present invention;
fig. 3 is a second schematic diagram of a contrast curve corresponding to multiple frames of images in a focusing control method according to a first embodiment of the present invention;
fig. 4 is a first schematic diagram illustrating a contrast curve obtained by a plurality of filters in a focus control method according to a first embodiment of the present invention;
FIG. 5 is a second schematic diagram of a contrast curve obtained by a plurality of filters in the focus control method according to the first embodiment of the present invention;
fig. 6 is a flowchart illustrating a focusing control method according to a second embodiment of the present invention;
fig. 7 is a flowchart illustrating a focus control method according to a third embodiment of the present invention;
fig. 8 is a flowchart illustrating a focus control method according to a fourth embodiment of the present invention;
fig. 9 is a schematic flowchart of a focusing control method according to a fifth embodiment of the present invention;
fig. 10 is a flowchart illustrating a focus control method according to a sixth embodiment of the present invention;
fig. 11 is a schematic structural diagram of a focus control device according to a seventh embodiment of the present invention;
fig. 12 is a schematic structural diagram of a focus control device according to an eighth embodiment of the present invention;
fig. 13 is a schematic structural diagram of a focus control apparatus according to a ninth embodiment of the present invention;
fig. 14 is a schematic structural diagram of a focus control device according to a tenth 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.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
Some embodiments of the invention are described in detail below with reference to the accompanying drawings. The features of the embodiments and examples described below may be combined with each other without conflict between the embodiments.
Example one
The embodiment of the invention provides a focusing control method. Fig. 1 is a flowchart illustrating a focus control method according to an embodiment of the present invention. As shown in fig. 1, the focus control method in this embodiment may include:
step 101, obtaining a plurality of frames of images to be processed, wherein the plurality of frames of images to be processed comprise a plurality of frames of images shot by a lens in the moving process of a focusing motor.
The main execution body of the focusing control method in this embodiment may be a focusing control device in a shooting device, the shooting device may be any device with a shooting function, such as a camera, and the focusing control device may be implemented as software, hardware, or a combination of software and hardware.
The photographing apparatus may include a lens, a focusing motor, an image sensor, and the like, light reflected by an object is converged on the image sensor after passing through the lens, and the image sensor converts an optical signal into an electrical signal to form an image including the object.
The focusing motor may include a driving member, such as a driving shaft, for driving the lens to move, and the movement of the focusing motor in the embodiments of the present invention may refer to the movement of the driving member of the focusing motor.
During focusing, the lens can be driven by a focusing motor to move, so that the object distance is changed, and the definition of a shot object in an image is changed continuously. The movable range of the lens may be determined by a stroke of the focusing motor, and when the photographing apparatus and the photographed object are both fixed, and the lens is located at the foremost end, the distance between the lens and the object is the shortest, and when the lens is gradually pulled to the rearmost end, the distance between the lens and the object is gradually increased.
During the lens movement, an object in the captured image usually undergoes a process from blur to sharpness to blur, wherein the position of the lens at which the object is sharpest can be regarded as the in-focus position.
In this embodiment, a plurality of frames of images may be captured through the lens as images to be processed during the movement of the focus motor, where the plurality of frames of images may be all images captured within the movable range of the focus motor or partial images thereof.
Step 102, determining whether an object exists in the multiple frames of images to be processed and whether the relative contrast of image areas corresponding to the object meets a preset condition; wherein the relative contrast is determined according to an output result obtained by filtering the image area corresponding to the object by at least one filter.
The existence of a certain object in the image in the embodiments of the present invention may mean that an image area corresponding to the object exists in the image. It can be understood that the determination of whether there is an object whose relative contrast satisfies the preset condition in the image can be implemented by determining whether there is an area whose relative contrast satisfies the preset condition in the image.
If an area with relative contrast meeting a preset condition exists in the image, it can be considered that an object with relative contrast meeting the preset condition exists in the image, and the area is an image area corresponding to the object.
In this embodiment, the calculation of the relative contrast may be implemented based on the contrast. After the image to be processed is acquired, the contrast of each region in the image to be processed can be determined through operations such as filtering processing. The contrast ratio can be used for representing the definition degree, for the same object, the change of the contrast ratio between different frame images represents the definition change of the region, and the larger the contrast ratio of the region in a certain frame image is, the clearer the object is in the frame image.
In an alternative embodiment, the shot may be divided into a plurality of regions, and assuming that the shot is divided into n × m regions, the shot is divided into n rows in the vertical direction and m columns in the horizontal direction. Each region includes a plurality of pixel points. Assuming that each frame of the captured image includes N × M pixels, there may be (N/N) × (M/M) pixels in each region.
In a multi-frame image to be processed, each frame image may be divided into a plurality of regions according to the same dividing method, for example, into n × m regions according to the above method, and in the n × m regions, the same region may correspond to different contrasts in different frame images.
After the image to be processed is obtained, filtering may be performed on each frame of image, gradient values corresponding to pixels in the image may be obtained after the filtering, and the contrast of each region may be calculated according to the gradient values corresponding to the pixels in the region, for example, the gradient values corresponding to the pixels in the region may be accumulated to obtain the contrast of the region.
In another optional embodiment, the method for dividing the region may not be set in advance, for example, the captured image may be subjected to semantic segmentation, or the contours of the objects in the image may be identified, the region where each object is located may be identified according to the semantic segmentation result or the contour identification result, and the contrast of the region corresponding to each object may be calculated.
Through operations such as filtering processing, the contrast corresponding to each region in the image can be obtained for each frame of image. After the multi-frame images are processed, the corresponding recognition results of the regions in the multi-frame images, that is, the corresponding multiple contrasts of the regions in the multi-frame images, can be obtained.
After determining the plurality of contrasts corresponding to each region, the relative contrast of the region may be determined according to the contrast corresponding to the region, and it is determined whether the relative contrast of the region satisfies a preset condition.
The relative contrast of the region may refer to a relative value between at least two contrasts in a plurality of contrasts corresponding to the region, where the relative value may be a ratio or a difference, and the at least two contrasts corresponding to the region may be contrasts of the region in different images, or contrasts obtained through different filters, or the like.
Optionally, the meeting of the relative contrast with the preset condition may include: the contrast change of the corresponding image area of the object between the frames of images meets a first preset condition, and/or the change of a plurality of contrasts of the corresponding image area of the object in each frame of images, which is obtained by filtering through a plurality of filters, meets a second preset condition.
In an alternative embodiment, the satisfying of the preset condition by the relative contrast ratio may include: the contrast change of the corresponding image area of the object between the frame images meets a first preset condition.
Whether the contrast change meets the first preset condition or not can be judged through ratios or differences among the multiple contrasts of the region, for example, in the multiple contrasts, each contrast is divided by the next contrast to obtain multiple ratios, and whether the contrast change meets the first preset condition or not is judged through the ratio.
Or, the corresponding contrasts of the regions in each frame of image may be connected into a curve, and whether the contrast change satisfies the first preset condition is determined according to the form of the contrast curve.
Optionally, the first preset condition may be that the curvature or the slope of the contrast curve is within a preset range, where the curvature or the slope of the contrast curve may refer to a point in the contrast curve, or a section of the contrast curve, or a curvature or a slope corresponding to the entire contrast curve.
In addition, an ideal contrast curve may be preset, whether the block satisfies a first preset condition may be determined according to a difference between the contrast curve of the block and the ideal contrast curve, and the difference between the contrast curve of the block and the ideal contrast curve may be represented by an area of a closed region between the contrast curve of the block and the ideal contrast curve.
Fig. 2 is a first schematic diagram of a contrast curve corresponding to a plurality of frames of images in the focusing control method according to the first embodiment of the present invention. Fig. 3 is a second schematic diagram of a contrast curve corresponding to multiple frames of images in a focusing control method according to an embodiment of the present invention. In fig. 2 and 3, the horizontal axis represents the number of images, different numbers correspond to different focus motor positions, and the vertical axis represents the contrast corresponding to the area.
The contrast curve shown in fig. 2 has only one peak, and both sides of the peak are steeper, and focusing can be rapidly and accurately achieved according to the contrast curve, so that the contrast curve shown in fig. 2 can be used as an ideal contrast curve.
In the contrast curve shown in fig. 3, the two sides of the main peak are not steep enough, and there are many fluctuations in the curve, which may cause focusing failure, so it is necessary to set at least one preset condition, which is determined according to the form of the ideal contrast curve. And determining the difference degree between the actually obtained contrast curve and the ideal contrast curve by judging whether the actually obtained contrast curve meets the preset condition or not so as to predict whether the difference degree can cause focusing failure or not.
In another embodiment, the contrast curves of the corresponding image regions of the object of interest may be calibrated first. Therefore, the contrast curve of the corresponding image area of the calibrated interested object can be approximately regarded as an ideal contrast curve. Then, at least one preset condition regarding contrast difference or relative contrast difference is determined according to the calibrated contrast curve of the corresponding image area of the object of interest. By judging whether the contrast curve actually obtained by an image area meets the preset condition or not, the difference degree between the contrast curve actually obtained by the image area and the contrast curve of the image area corresponding to the calibrated interested object is determined, so that whether the image area contains the interested object or not is predicted. If the difference degree meets the preset condition, the interested object exists in the corresponding image area in the image.
If the contrast change of the area between the frame images does not meet the first preset condition, which indicates that the definition change of the area during the movement of the focusing motor is not obvious, the area may not be an area suitable for focusing, and the area can be discarded and not focused. If the contrast change of the area between the frame images meets a first preset condition, which indicates that the definition change of the area in the moving process of the focusing motor is good, the focusing operation can be performed according to the area.
In another embodiment, if the contrast variation of the area between the frame images does not satisfy the preset condition, and the area has no interested object, the area can be discarded and the area is not focused.
In another alternative embodiment, the satisfying of the preset condition by the relative contrast ratio may include: and the change of a plurality of contrasts obtained by filtering the corresponding image areas of the object in each frame of image through a plurality of filters meets a second preset condition.
Specifically, for a frame of image, the image may be filtered by a plurality of filters, and after each filter processing, the contrast of a plurality of regions in the image may be obtained. Then, for each region in the image, if there are K filters to process the image, K contrasts of the region can be obtained.
The K contrasts may be ordered by the center frequency of the filter. The implementation principle of determining whether the change condition of the contrast of the region obtained by the plurality of filters satisfies the first preset condition may refer to the implementation principle of determining whether the change of the contrast of the region between the frames of images satisfies the second preset condition described above.
For example, in the contrast obtained by the plurality of filters, each contrast is divided by the next contrast to obtain a plurality of ratios, so as to determine whether the contrast variation satisfies the second preset condition according to the magnitude of the ratio.
Or, the contrasts obtained by the plurality of filters may be connected into a curve, and whether the contrast change satisfies the second preset condition is determined by the contrast curve.
Fig. 4 is a first schematic diagram of a contrast curve obtained by a plurality of filters in a focus control method according to a first embodiment of the present invention. Fig. 5 is a second schematic diagram of a contrast curve obtained by a plurality of filters in the focus control method according to the first embodiment of the present invention. In fig. 4 and 5, the horizontal axis represents the center frequency of the filter, which may be normalized center frequency, and the vertical axis represents the contrast corresponding to the region.
In the contrast curve shown in fig. 4, as the frequency is continuously increased, the contrast is also continuously increased, which indicates that the high-frequency component of the region is relatively more, the texture details are relatively richer, and the region is a region that may be interested by the user, and therefore, the contrast curve may be a contrast curve that satisfies the second preset condition.
In the contrast curve shown in fig. 5, the contrast variation obtained by the filters of the respective frequency bands is not obvious, which indicates that the texture details of the region are not rich and the region is not a region of interest to the user, and therefore, the contrast curve may be considered as not meeting the second preset requirement.
In yet another alternative embodiment, the satisfying of the preset condition by the relative contrast ratio may include: the contrast change of the region between each frame of image meets a first preset condition, and the change of the region between a plurality of contrasts obtained by filtering through a plurality of filters in each frame of image meets a second preset condition. The first preset condition and the second preset condition may be the same or different.
And 103, if the relative contrast of the image area corresponding to the object meets a preset condition, performing focusing processing on the image area corresponding to the object.
After determining the area whose relative contrast satisfies the preset condition, the focusing process may be performed according to the area whose relative contrast satisfies the preset condition. In the embodiment of the present invention, the performing of the focusing process may be controlling a focusing motor to drive a lens to move to a focusing position. For example, when focusing is performed on an image area where the object is located, the focusing motor may be controlled to drive the lens to move to a focusing position corresponding to the object.
Specifically, if there is one area meeting the preset condition, focusing is performed by taking the area meeting the preset condition as a target area; and if a plurality of areas meeting the preset conditions exist, selecting one area from the plurality of areas as a target area to carry out focusing processing.
The selected policy may be set according to actual needs, for example, an area located in the foreground may be selected as a target area from the plurality of areas meeting the preset condition, or a category of each area may be determined according to methods such as semantic segmentation, and an area is selected as a target area according to the category, for example, a face area may be selected as a target area.
After the target area is determined, the lens can be controlled to move to a focusing position corresponding to the target area, namely, the position of the lens when the target area is clearest, so that focusing operation is completed.
The areas with inconspicuous contrast change among the images of each frame can be screened out according to the relative contrast among the multiple frames of images, the focusing accuracy and efficiency are improved, the areas with scarce textures can be screened out according to the relative contrast among the multiple filters, and the mistaken focusing is effectively prevented.
In practical application, the method in this embodiment may be applied to a CDAF algorithm or other focusing algorithms, and by selecting an area with a relative contrast that meets a preset condition in the image to be processed for focusing, objects with a poor relative contrast may be screened out, so as to avoid focusing on interfering objects, and only focus on objects with a relative contrast that meets a preset condition.
Specifically, in the image to be processed, it can be considered that the relative contrast of the image region corresponding to the glass, the wall, and the sky does not satisfy the preset condition. The glass, the wall and the sky are objects with unobvious contrast changes among the multi-frame images and are objects with unobvious contrast changes obtained through the filters, so that image areas corresponding to the glass, the wall and the sky belong to image areas with relative contrasts not meeting preset conditions, when the glass, the wall and the sky exist in a shot picture, objects except the glass, the wall and the sky can be focused, and the focusing efficiency and accuracy are improved.
The focusing control method provided by this embodiment may obtain multiple frames of to-be-processed images, where the multiple frames of to-be-processed images include multiple frames of images captured by a lens during the movement of a focusing motor, determine whether an object exists in the multiple frames of to-be-processed images, and determine whether a relative contrast of an image region corresponding to the object meets a preset condition, where the relative contrast is determined according to an output result obtained by filtering the image region corresponding to the object by at least one filter, and if the relative contrast of the image region corresponding to the object meets the preset condition, perform focusing on the image region corresponding to the object, screen the region in the image by the relative contrast, screen out the region whose relative contrast does not meet the preset condition, and avoid focusing on an object with poor relative contrast, the focusing efficiency and accuracy are improved.
On the basis of the technical solution provided in the foregoing embodiment, optionally, determining whether an object exists in the multiple frames of images to be processed, and whether the relative contrast of the image area corresponding to the object satisfies a preset condition, may include:
determining the recognition results of a plurality of regions in the image according to the image to be processed, wherein the recognition result of each region comprises the corresponding contrast of the region in each frame of image; respectively judging whether the relative contrast of each region meets a third preset condition according to the identification results of the regions; and if the area with the relative contrast meeting the third preset condition exists, determining that an object exists in the multiple frames of images to be processed, and the relative contrast of the image area corresponding to the object meets the preset condition.
Correspondingly, the performing the focusing process on the image area corresponding to the object if the relative contrast of the image area corresponding to the object satisfies the preset condition may include: and focusing the area meeting the third preset condition.
Whether the relative contrast of each region meets the third preset condition or not is directly detected, and the focusing processing is carried out on the region meeting the third preset condition, so that the focusing processing can be carried out on the object meeting the preset condition in the image. The third preset condition may be designed according to actual needs, and the following description will take the second embodiment and the third embodiment as examples respectively.
Example two
The second embodiment of the invention provides a focusing control method. In this embodiment, on the basis of the technical solutions provided in the above embodiments, a region is scored according to the contrast obtained by a plurality of filters, and it is determined whether the relative contrast of the region satisfies a third preset condition according to the scoring result.
Fig. 6 is a flowchart illustrating a focus control method according to a second embodiment of the present invention. As shown in fig. 6, the focus control method in this embodiment may include:
601, acquiring multiple frames of to-be-processed images, wherein the multiple frames of to-be-processed images comprise multiple frames of images shot by a lens in the moving process of a focusing motor.
In this embodiment, the specific implementation principle and process of step 601 may refer to the above embodiments, which are not described herein again.
Step 602, performing the following processing on each frame of image to be processed: the image is filtered through a plurality of filters respectively, and a contrast set of each of a plurality of regions of the image is obtained, wherein the contrast set of each region comprises the contrast of the region obtained after the image is filtered through each of the plurality of filters.
In this embodiment, through step 602, determining the recognition results of the plurality of regions in the image according to the image to be processed can be realized, where the recognition results include the corresponding contrast of the regions in each frame of image.
Assuming that 40 frames of images are shot in the moving process of the focusing motor, each frame of image can be divided into 100 regions, and 2 filters can be designed to filter the images. Then, through step 602, identification results corresponding to 100 regions may be obtained, where the identification result of each region may include a contrast set corresponding to 40 frames of images, and the contrast set corresponding to each frame of image includes the contrast obtained by 2 filters. That is, the recognition result of each region may include 80 contrasts.
Step 603, for each frame of image, scoring each region according to the contrast set of the plurality of regions in the image.
And step 604, determining whether the relative contrast of each region meets a third preset condition according to the score of the region in each frame image.
In this embodiment, through the steps 603 and 604, it can be respectively determined whether the relative contrast of each region satisfies the third preset condition according to the recognition results of the plurality of regions.
The third preset condition may be that a composite score of the region is greater than a first threshold, and the composite score may be determined according to a score of the region in each frame image. The score of the region in each frame of image can be determined by the contrast obtained by the different filters.
Optionally, the scoring each region according to the contrast set of the plurality of regions in the image in step 603 may include: and for each region, scoring the region according to the difference between the contrast ratios in the contrast ratio aggregate corresponding to the region. Optionally, the larger the difference between the respective contrasts, the higher the zone score.
Specifically, in a frame of image, for any region, the larger the difference between the respective contrasts in the contrast set is, the richer the texture of the region is, and the corresponding score may be higher. The gap may be expressed as a difference and/or a ratio.
For example, the plurality of filters may include a high frequency filter (high pass filter) capable of allowing the high frequency signal to pass and a low frequency filter (low pass filter) capable of allowing the low frequency signal to pass.
Optionally, scoring each region according to the contrast set of the plurality of regions in the image may include: performing filtering processing by using the high-frequency filter and the low-frequency filter respectively for each region; and scoring the region according to a ratio of the contrast obtained by the high frequency filter to the contrast obtained by the low frequency filter. The larger the ratio, the more high frequency signals of the region are indicated and thus the score may be higher, and the smaller the ratio, the less high frequency signals of the region are indicated and thus the score may be lower.
Through the step 603, the score of the region in each frame of image can be obtained, the score corresponding to each frame can indicate the relative contrast of the region in the frame of image, and in the step 604, it can be determined comprehensively according to the scores of the region in each frame of image whether the relative contrast of the region meets a third preset condition. Optionally, a composite score of the region may be determined according to the score of the region in each frame image, and if the composite score is greater than a first threshold, it is determined that the relative contrast of the region satisfies a third preset condition.
For example, the scores of the regions in 40 frames of images may be accumulated to obtain a composite score of the regions, and a region having a composite score higher than the first threshold value is selected from 100 regions as a region satisfying a third preset condition. There may be one or more regions having a composite score higher than the first threshold.
And step 605, performing focusing processing on the area meeting the third preset condition.
If one area meeting a third preset condition exists, focusing by taking the area meeting the third preset condition as a target area; and if a plurality of areas meeting the third preset condition exist, selecting one area from the plurality of areas as a target area to perform focusing processing. When the focusing process is performed on the area, the focusing motor may be controlled to drive the lens to move to a focusing position corresponding to the area. In practical application, the image may be processed by a plurality of filters, the contrast of each region in the image may be obtained by each filter, and for each region, the region may be scored according to a ratio or a difference between the contrasts obtained by the plurality of filters, so as to screen out a region that does not satisfy a third preset condition.
After determining the region satisfying the third preset condition, the focusing operation may be implemented according to an output result of any one of the filters. Optionally, a corresponding filter may be selected according to a current scene, and a specific implementation principle of performing a focusing operation according to a scene selection filter belongs to the prior art, which is not described in this embodiment again.
In the focusing control method provided by this embodiment, the plurality of filters are used to filter the image respectively to obtain the contrast aggregate of each of the plurality of regions of the image, score is performed on each region according to the contrast aggregate of the plurality of regions in the image, and for each region, whether the relative contrast of the region meets the third preset condition is determined according to the score of the region in each frame of image, and whether the region meets the third preset condition can be determined quickly according to the contrast obtained by the plurality of filters, and the region meeting the third preset condition is focused, so that an object with rich texture is focused preferentially, and the focusing accuracy is improved effectively.
EXAMPLE III
The third embodiment of the invention provides a focusing control method. In this embodiment, on the basis of the technical solutions provided in the above embodiments, the regions are scored according to the contrast change between the frame images, and it is determined whether the relative contrast of the regions meets a third preset condition according to the scoring result.
Fig. 7 is a flowchart illustrating a focus control method according to a third embodiment of the present invention. As shown in fig. 7, the focus control method in this embodiment may include:
step 701, acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor.
Step 702, determining the recognition results of a plurality of regions in the image according to the image to be processed, wherein the recognition result of each region comprises the corresponding contrast of the region in each frame of image.
In this embodiment, the specific implementation principle and process of step 701 to step 702 may refer to the above embodiments, which are not described herein again.
In the case where a plurality of filters are provided in the focus control device, the recognition result in step 702 may include the contrast obtained by any one of the filters. Alternatively, the filter may be a filter corresponding to a current scene, that is, the recognition result obtained by the filter may be a recognition result that is a basis for determining a focus position at the time of a focusing operation.
And 703, determining a contrast curve of each region in the moving process of the focusing motor according to the contrast of the region in each frame of image.
Specifically, referring to fig. 2 and 3, the frame number of the image is used as the abscissa, the frame number can represent the position of the focusing motor, and the contrast of the block is used as the ordinate to form a contrast curve.
Step 704, for each region, according to the contrast curve of the region, determining whether the relative contrast of the region meets a third preset condition.
In this embodiment, the determination of whether the relative contrast of each region satisfies the third preset condition according to the recognition results of the plurality of regions through steps 703 to 704 can be realized.
Wherein the third preset condition may be that the score of the region is greater than a second threshold, and the score may be determined according to the number of peaks and/or the size of peaks of the contrast curve of the region.
Optionally, when determining whether the relative contrast of the region meets a third preset condition according to the contrast curve, the peak value of the contrast curve may be determined first, and then, determining whether the relative contrast of the region meets the third preset condition according to the peak value of the contrast curve.
The ideal contrast curve is one with only one peak, which is monotonically increasing on the left and decreasing on the right. Therefore, whether the region satisfies the third preset condition can be determined according to the number of peaks and the size of the peak of the contrast curve.
Optionally, judging whether the relative contrast of the region meets a third preset condition according to the peak value of the contrast curve may include: scoring the region according to the number of peaks and/or the size of peaks of the contrast curve; judging whether the relative contrast of the region meets a third preset condition or not according to the score of the region; and if the score of the region is greater than a threshold value, the relative contrast of the region meets the third preset condition.
Wherein scoring the region according to the number of peaks of the contrast curve may include: determining a mapping table of correspondence relation with respect to the number of peaks and the score; and determining the score of the region in the mapping table according to the number of peaks of the contrast curve. The greater the number of peaks of the contrast curve, the lower the score of the region. The scoring of the region can be quickly and accurately realized through the mapping table, and the focusing efficiency is improved.
In the focusing process, the moving direction of the focusing motor is often determined according to the contrast of the front and rear frame images, so that the focusing motor can easily take the position corresponding to the peak value as the focusing position, and the focusing error may be larger as the number of the peak values is larger.
Scoring the region according to a peak size of the contrast curve may include: if the contrast curve has a plurality of peak values, determining a main peak according to the size of each peak value; determining an effective peak value from other peak values except the main peak value, wherein the effective peak value is a peak value of which the ratio to the main peak value exceeds a preset value; determining a score for the region based on the number of valid peaks in the contrast curve. The more valid peaks in the contrast curve, the lower the score of the region.
For example, the preset value may be 80%, the position where the peak value is the largest in the contrast curve is the main peak, other peak values may exist in addition to the main peak value, and the other peak values are effective peak values if the other peak values are greater than 80% of the main peak value. The number of the effective peaks also affects the focusing effect, and if more effective peaks exist in a contrast curve corresponding to a certain image region, it is difficult to provide a focusing position with absolute advantage through the change of the contrast, and the score of the region is not too high.
In practical applications, a basic score may be set for each region in advance, and then the score may be subtracted based on the basic score according to the number of peaks and the size of peaks of the contrast curve. For example, the number of peaks of the contrast curve of the region may be calculated first, the larger the total number of peaks is, the more the subtraction is, then, the effective peak may be calculated according to the size of the peak, the more the effective peak is, the more the subtraction is, and finally, after two rounds of subtraction, if the score corresponding to the region is greater than the preset score, the region may be considered as a region that satisfies the third preset condition, and otherwise, the region may be considered as a region that does not satisfy the third preset condition.
Step 705, focusing the area meeting the third preset condition.
In this embodiment, the specific implementation principle and process of step 705 may refer to the above embodiments, which are not described herein again.
According to the focusing control method provided by the embodiment, for each region, according to the contrast of the region in each frame of image, a contrast curve of the region in the moving process of the focusing motor is determined, according to the contrast curve, according to the peak number and/or the peak size of the contrast curve, whether the relative contrast of the region meets a third preset condition is judged, and the region meeting the third preset condition is focused, so that an object with obviously changed contrast among different frames of images can be focused preferentially, and the focusing efficiency is effectively improved.
On the basis of the technical solutions provided by the above embodiments, after determining the area satisfying the third preset condition, the focusing operation may be performed through the connected domain.
Optionally, the performing focusing on the area meeting the third preset condition may include: determining a focusing position corresponding to each region in the regions meeting the third preset condition according to the identification result of the regions meeting the third preset condition; determining at least one connected domain according to the focusing position corresponding to each region; if a connected domain meeting the third preset condition exists, the connected domain is an image area where the object is located, and the object is an object contained in the connected domain; and if the focal positions of any two adjacent regions are the same or the distance between the focal positions of any two adjacent regions is less than a preset distance, the two regions belong to the same communicated domain.
A specific implementation method for performing focusing operation through the connected domain may be referred to as embodiment five, and details are not described here.
Example four
The fourth embodiment of the invention provides a focusing control method. The embodiment can realize the focusing control process of the elongated object.
Fig. 8 is a flowchart illustrating a focus control method according to a fourth embodiment of the present invention. As shown in fig. 8, the focus control method in this embodiment may include:
step 801, acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor.
Step 802, if a slender object exists in the image to be processed and the slender object meets a preset requirement, focusing is performed by taking the slender object as a target.
In this embodiment, after the image to be processed is acquired, if a long and thin object meeting a preset requirement exists in the image, focusing may be performed with the long and thin object as a target.
Wherein the elongated object may comprise a wire, a string, or the like. Alternatively, an object may be considered to be an elongate object if its length to width ratio exceeds a preset ratio, for example 10.
The detection of the elongated object may be achieved in a number of ways. For example, the area where each object is located in the image may be determined by an image processing technique such as semantic segmentation, and whether a slender object exists is determined according to the segmented area, and if the slender object exists and meets a preset requirement, focusing may be performed with the slender object as a target.
The preset requirements can be set according to actual needs. In an alternative embodiment, the elongated object satisfying the predetermined requirement may include: and if the elongated object is a foreground object, determining that the elongated object meets a preset requirement.
The foreground object may specifically mean that a distance between the object and the shooting device is smaller than distances between other objects in the image and the shooting device, that is, the object is located at a front position in the shooting picture.
In another alternative embodiment, the elongated object satisfying the predetermined requirement may include: the elongated object is an object of interest to the user, or the elongated object is an object that conforms to the current scene. For example, in a scene of performing maintenance detection on the electric wire, the electric wire may be a long and thin object meeting preset requirements, and in a scene of shooting the plant, the branch may be a long and thin object meeting preset requirements.
After the elongated object meeting the preset requirement is determined, focusing processing can be performed by taking the elongated object as a target, namely, a focusing motor is controlled to drive a lens to move to a focusing position corresponding to the elongated object, so that the elongated object is in a clear state in an image, and the focusing process is completed.
In practical applications, there are often scenes that need to be focused on a slender object, such as those for industrial applications such as wire detection. However, in the prior art, the shooting device generally focuses only on a large object, and a long and thin object is missed, so that the electric wire in the picture cannot be shot clearly. The focusing control method provided by the embodiment can be used for focusing the slender object meeting the preset requirement, and meets the requirement of industrial application.
The focusing control method provided by the embodiment can acquire an image to be processed, and if a long and thin object exists in the image to be processed and the long and thin object meets a preset requirement, focusing is performed by taking the long and thin object as a target, so that focusing on the long and thin object can be realized, the requirement of a specific scene is met, and the focusing accuracy is improved.
EXAMPLE five
The fifth embodiment of the invention provides a focusing control method. The embodiment is based on the technical scheme provided by the fourth embodiment, and the focusing control process of the object is realized through the connected domain.
Fig. 9 is a flowchart illustrating a focus control method according to a fifth embodiment of the present invention. As shown in fig. 9, the focus control method in this embodiment may include:
step 901, acquiring multiple frames of images to be processed, where the multiple frames of images to be processed include multiple frames of images shot by a lens in the moving process of a focusing motor.
Step 902, determining a focusing position corresponding to each of a plurality of regions of the image according to the image to be processed.
Specifically, the image may be divided into n × m regions according to the scheme provided in the foregoing embodiments, or the image may be divided into a plurality of regions by semantic segmentation.
Optionally, determining, according to the image to be processed, a focusing position corresponding to each of a plurality of regions of the image, may include: determining the recognition results of a plurality of areas of the image according to the image to be processed, wherein the recognition result of each area comprises the corresponding contrast of the area in each frame of image; and aiming at each region, determining a focusing position corresponding to the region according to the corresponding recognition result.
The identification result may be an identification result obtained through a filter corresponding to the current scene. Determining a focusing position corresponding to the region according to the corresponding recognition result may include: and determining the focusing position corresponding to the region according to the contrast change of the region in each frame image.
Specifically, a lens position corresponding to one frame of image with the largest contrast may be selected as the in-focus position corresponding to the region.
And 903, determining at least one connected domain according to the focusing positions corresponding to the plurality of regions.
And if the focusing positions of any two adjacent areas meet the requirement of a preset position, the two areas belong to the same communicated domain.
In this embodiment, the adjacent regions may refer to regions that are connected (adjacent) on the image, and the connection may specifically be eight connection, four connection, or M connection. Taking eight connected regions as an example, the eight regions of the regions, i.e., upper, lower, left, right, upper left, lower left, upper right, and lower right, are all regions adjacent to the regions. Taking four-way communication as an example, the four areas, i.e., the upper area, the lower area, the left area and the right area, of the areas are all areas communicated with the areas, and the four areas, i.e., the upper left area, the lower left area, the upper right area and the lower right area, of the areas are areas not adjacent to the areas.
And if the focusing position of any two adjacent areas meets the requirement of a preset position, the two areas belong to the same communicated domain. The preset position requirement can be set according to actual needs, for example, the specific position requirement can be that the focal positions of the two regions are the same or similar.
In an optional embodiment, determining at least one connected domain according to the in-focus positions corresponding to the multiple regions may include: if the focusing positions of any two adjacent areas are the same, the two areas are determined to belong to the same connected domain, and the judgment of the connected domain and the subsequent focusing operation can be quickly and accurately realized.
In another optional implementation manner, if the distance between the focal positions of any two adjacent regions is smaller than the preset distance, it is determined that the two regions belong to the same connected domain, and the regions with close focal positions can be fused into one connected domain, so that focusing failure caused by shooting noise is avoided.
It is to be understood that each connected domain may include at least two regions. If there is at least one connected domain in the image, step 904 may be performed.
And 904, if a connected domain meeting the preset requirement exists, focusing by taking the connected domain as a target.
For example, a connected domain in the foreground may be selected from at least one connected domain, or a connected domain meeting the requirements of the current scene is selected as a connected domain meeting a preset condition and is subjected to focusing processing.
Optionally, before determining the connected domain satisfying the preset condition, the connected domain may be further screened. Specifically, if there is a connected domain that meets the preset requirement, performing focusing processing with the connected domain as a target may include: if the number of the connected domains is multiple, screening each connected domain according to the area of each connected domain; and selecting the connected domains meeting the preset requirements as targets to carry out focusing treatment in the screened connected domains.
It will be appreciated that if the area of a connected domain is too small, which may be a point of interference, the connected domain may be screened out, leaving a connected domain with a satisfactory area.
Optionally, screening each connected domain by the area of each connected domain may include: for each connected domain, if the area of the connected domain is larger than a preset area, or the ratio of the area of the connected domain to other areas is larger than a preset area ratio, the connected domain passes through screening, wherein the other areas are the sum of the areas of other connected domains except the connected domain.
Specifically, the preset area may be the whole area of the image multiplied by a scaling factor, for example, if the ratio of the area of the connected domain to the whole area of the image is greater than 0.05, the connected domain is considered to be the connected domain with the area meeting the requirement. Alternatively, if the ratio of the area of the connected domain to the sum of the areas of the other connected domains is greater than a preset area ratio, for example, 0.1, the connected domain may also be considered to be a satisfactory connected domain. Therefore, connected domains with large area absolute values and large area relative values can be screened out, effective connected domains are reserved as much as possible, and tiny objects are prevented from being leaked.
Among the connected domains passing through the screening, a connected domain satisfying a preset requirement, for example, a connected domain located in the foreground, can be selected as a target to perform focusing processing. Whether the connected domain is located in the foreground or not can be judged according to the focusing position corresponding to the connected domain.
Besides focusing the area or the connected domain of the foreground, the type of each area can be determined according to semantic segmentation, and if a preset type appears, focusing is preferentially carried out on the area of the type. Wherein a category may refer to a category of an object, for example the category may include a person, a car, a building, etc.
Optionally, selecting a connected domain meeting a preset requirement as a target for focusing in the filtered connected domain may include: identifying a category of each region in the connected domain that passes the screening; and selecting the area with the category meeting the preset requirement as a target to carry out focusing processing.
Semantic segmentation can be realized by a Convolutional Neural Network (CNN) method and the like, and the category of each region is determined. The target is determined by a CNN semantic segmentation method, so that the selection of the focusing target can be more intelligent.
In an optional embodiment, selecting an area with a category meeting a preset requirement as a target for focusing processing may include: and if the preset type exists in the types of the regions, focusing the regions of the preset type as targets. Further, when there are a plurality of regions in the preset category, a region in the foreground may be selected for focusing.
Optionally, the method provided by this embodiment may be applied to inspection equipment, and the preset category may be a category corresponding to an inspection target of the inspection equipment.
For example, the equipment of patrolling and examining is the electric tower equipment of patrolling and examining, predetermine the classification and be the electric tower. Then, after detecting the electric tower, even there are other prospect objects before the electric tower, still can be preferentially to the electric tower focus, guarantee the definition of electric tower in the image, satisfy the requirement that the electric tower patrolled and examined.
Or, the equipment of patrolling and examining can be the bridge equipment of patrolling and examining, predetermine the classification and can be the bridge. Or, the inspection equipment may be search and rescue equipment or tracking equipment, and the preset category may be a category of an object to be searched and rescued or tracked, such as a person.
Optionally, the preset category may be determined according to a current working state of the device. The working state comprises any one of the following items: patrol inspection state, navigation state, following state, self-timer state and standby state. For example, in the inspection state, the category corresponding to the inspection target may be used as the preset category; in the navigation state, a building or a road can be taken as a preset category; in the following state, a following target such as a person can be taken as a preset category; under the self-timer state, the human face can be used as a preset category, so that the shooting requirements under different working states are met.
In another alternative embodiment, the categories may be sorted, and the corresponding priorities of the categories may be determined, such as people priority greater than cars priority, and cars priority greater than buildings priority. In this way, when there are a plurality of connected domains that pass the filtering, the region with the highest priority can be selected as the target to perform the focusing process. Under different scenes, the priority of each category can be adjusted correspondingly.
Through steps 902 to 904, it can be realized that: and if the elongated object exists in the image to be processed and meets the preset requirement, focusing by taking the elongated object as a target.
The connected domain determined by the focusing position may belong to a corresponding connected domain of an elongated object, such as a wire, or may belong to a corresponding connected domain of another object, such as a person. When the slender object exists in the connected domain and meets the preset requirement, focusing operation is carried out by taking the connected domain as a target, so that the slender object meeting the preset requirement can be focused. Of course, if the connected domain includes other objects and meets the preset requirement, focusing operation is performed with the connected domain as a target, so that focusing on the other objects meeting the preset requirement can be realized.
If no connected domain exists in the image or no connected domain passes the area screening, it indicates that there may be no elongated object or other object with an area meeting the requirement in the image, and at this time, the focusing process may be directly performed by using the contrast of each region.
Specifically, in the case that there is no connected domain passing the screening, the focusing positions corresponding to a plurality of regions in the secure region of the image may be determined, the plurality of regions may be grouped according to the focusing positions corresponding to the plurality of regions, the regions at the same focusing position may be grouped into one group, and the focusing process may be performed according to the focusing position corresponding to the group with the largest number of regions.
The safety region may refer to a region excluding an extremely long view and an extremely short view in the image, and the extremely long view and the extremely short view may be determined by a focus position. In a plurality of areas in the safety area, the focusing position is selected by the principle that the minority obeys the majority, and if the most areas correspond to the same focusing position, the focusing processing can be carried out according to the focusing position.
For example, there are 10 regions in the safety region of the image, where the focusing positions corresponding to 3 regions are all a, the focusing positions corresponding to 5 regions are all B, and the focusing positions corresponding to the other 2 regions are all C, then the regions may be divided into three groups, which respectively correspond to A, B, C three focusing positions, where the number of the regions in the group B is the largest, and then the focusing process may be performed according to the focusing position B, that is, the focusing motor is controlled to move to the focusing position B.
According to the safety region, the extremely close view and the extremely long view can be avoided, and the focusing accuracy is improved. By adopting a few principles of obeying most images, the integral definition of the image can be improved to the maximum extent, and the focusing accuracy is further improved.
In practical application, since a thin and long object such as a wire is small and occupies a small (Field of View, FOV), the division of the area of the image in the prior art is large, the thin and long object may be missed because the occupation ratio is too small, and of course, each area may be divided into small areas, but the division may be affected by some interference points and the focusing may fail. Therefore, the present embodiment provides a method for taking into account: and realizing focusing control through the connected domain.
In this embodiment, the regions in the image may be divided relatively small, for example, the area of each region may be smaller than the image region area typically occupied by the wires. Through carrying out connected domain detection on a plurality of regions and focusing the connected domains meeting the requirements, the method has stronger robustness compared with the prior art, not only can reduce the area of the divided regions, but also can avoid the influence of sporadic interference points. By the method provided by the embodiment, the focusing success rate of the CDAF prospect can be improved from 95% to more than 99.9%, and the requirement of the industry on the success rate is met.
In the focusing control method provided in this embodiment, the focus position corresponding to each of the multiple regions of the image is determined according to the image to be processed, at least one connected domain is determined according to the focus positions corresponding to the multiple regions, and if a connected domain meeting the preset requirement exists, focusing is performed by using the connected domain as a target, so that focusing on an object meeting the preset requirement can be quickly and accurately achieved, meanwhile, the influence of sporadic interference points can be avoided, and the success rate of focusing is improved.
The method in this embodiment may also be used in combination with the methods in the foregoing embodiments. Optionally, the determining the in-focus position corresponding to each of the multiple regions of the image in step 902 may include: and determining the in-focus position of each area in a plurality of areas of the image, the relative contrast of which meets a preset condition.
The method according to the first to third embodiments may be implemented by selecting a plurality of regions satisfying a relative contrast and satisfying a preset condition from the image to be processed, and implementing the operations of detecting and focusing the connected domain based on the plurality of regions satisfying the relative contrast and satisfying the preset condition.
EXAMPLE six
The sixth embodiment of the invention provides a focusing control method. In this embodiment, the methods provided by the above embodiments are integrated, the regions are screened according to the relative contrast, and the focusing control process is implemented through the connected domain.
Fig. 10 is a flowchart illustrating a focus control method according to a sixth embodiment of the present invention. As shown in fig. 10, the focus control method in this embodiment may include:
step 1001, acquiring a plurality of frames of images to be processed.
The plurality of frames of images to be processed comprise a plurality of frames of images shot by the lens in the moving process of the focusing motor.
And step 1002, scoring each region in the image according to the relative contrast, and determining qualified regions.
Wherein scoring may include: and scoring according to the ratio of the contrast obtained by different filters and/or scoring according to the peak value of the contrast change of different frame images.
Specifically, it may be first set that the scores of the regions are full scores, and then it is determined whether the ratio between the output results of the different filters, the peak size, the peak number, and the like in the contrast curve corresponding to each frame of image satisfy the corresponding conditions, and if not, the corresponding division reduction operation is performed. The areas with the final score lower than the qualified score are screened out, and the areas with the score higher than the qualified score belong to the qualified areas and are reserved.
And 1003, determining a connected domain according to the focusing position in the qualified area.
And 1004, screening the connected domains according to the areas.
Where the area ratio is too small to be screened out, the connected component with too small area ratio may not be the connected component in which the user is interested, but the interference point.
And 1005, focusing operation is carried out according to the screened connected domain.
Optionally, a connected domain located in the foreground or belonging to a preset category may be selected as a target in the filtered connected domain for focusing operation.
Focusing on the region or the connected domain as a target may be performed by directly moving the lens to a focusing position corresponding to the region or the connected domain, or may be performed by performing a CDAF operation on the region or the connected domain again.
Alternatively, if at least one connected component cannot be obtained in step 1003, or after the screening in step 1004, there is no connected component passing the screening, then a suitable area may be selected from a plurality of areas in the image security area to perform the focusing operation according to a few rules subject to majority. In this case, it is not necessary to consider whether the scores of the regions are qualified, because no connected domain meeting the requirements is selected, it is indicated that each region is not a particularly ideal focusing target, and in this case, the scores of the regions may not be compared, and as long as a plurality of regions correspond to the same focusing position, the focusing operation may be implemented at the focusing position.
The method in this embodiment integrates the solutions in the above embodiments, and details of parts not described in this embodiment may be referred to the above embodiments, which are not described herein again.
The focusing control method provided by this embodiment can score regions by contrast and the number of peaks, wherein by analyzing and scoring the contrast change of each of the plurality of regions, the weight of the region with low contrast can be reduced, and a monotonous object is prevented from being focused, and by analyzing and scoring the peak of each of the plurality of regions, the interference influence of the multimodal region can be reduced; the slender object can be detected through the connected domain algorithm, the slender electric wire is prevented from being missed, the industrial application requirements are met, and the selection of the focusing target is more in line with the intention of a user.
Through the technical scheme provided by each embodiment, the focusing process can be automatically completed without manual intervention of a user. In some scenarios, the user may also be allowed to click the screen, and according to the position clicked by the user, the region of interest desired to be focused by the user may be determined, for example, a square region with a preset side length is selected as the region of interest with the user click position as a center point, the region of interest is further divided into a plurality of regions, and a region meeting the requirements is selected according to the scheme provided by the foregoing embodiments to perform focusing operation, so as to meet the personalized requirements of the user.
EXAMPLE seven
Fig. 11 is a schematic structural diagram of a focus control device according to a seventh embodiment of the present invention. The focus control apparatus may perform the focus control method corresponding to fig. 1, and as shown in fig. 11, the focus control apparatus may include:
a memory 11 for storing a computer program;
a processor 12 for executing the computer program stored in the memory to implement:
acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor;
determining whether an object exists in the multiple frames of images to be processed and whether the relative contrast of image areas corresponding to the object meets a preset condition; wherein, the relative contrast is determined according to an output result obtained by filtering the image area corresponding to the object by at least one filter;
and if the relative contrast of the image area corresponding to the object meets a preset condition, carrying out focusing processing on the image area corresponding to the object.
Optionally, the focus control apparatus may further include a communication interface 13 for communicating with other devices or a communication network.
In one practical manner, the relative contrast satisfying the preset condition includes: the contrast change of the corresponding image area of the object between the frames of images meets a first preset condition, and/or the change of a plurality of contrasts of the corresponding image area of the object in each frame of images, which is obtained by filtering through a plurality of filters, meets a second preset condition.
In an implementation manner, the relative contrast of the image area corresponding to the glass, the wall, and the sky in the image to be processed does not satisfy the preset condition.
In an implementation manner, when determining whether an object exists in the multiple frames of images to be processed and whether the relative contrast of the image area corresponding to the object satisfies a preset condition, the processor 12 is specifically configured to:
determining the recognition results of a plurality of regions in the image according to the image to be processed, wherein the recognition result of each region comprises the corresponding contrast of the region in each frame of image;
respectively judging whether the relative contrast of each region meets a third preset condition according to the identification results of the regions;
if an area with the relative contrast meeting a third preset condition exists, determining that an object exists in the multiple frames of images to be processed, and the relative contrast of the image area corresponding to the object meets the preset condition;
if the relative contrast of the image area corresponding to the object meets a preset condition, performing focusing processing on the image area corresponding to the object, where the processor 12 is specifically configured to: and focusing the area meeting the third preset condition.
In an implementable manner, when determining the recognition results of the plurality of regions in the image from the image to be processed, the processor 12 is specifically configured to:
each frame image to be processed is processed as follows: the image is filtered through a plurality of filters respectively, and a contrast set of each of a plurality of regions of the image is obtained, wherein the contrast set of each region comprises the contrast of the region obtained after the image is filtered through each of the plurality of filters.
In an implementation manner, when determining whether the relative contrast of each region satisfies the third preset condition according to the recognition results of the plurality of regions, the processor 12 is specifically configured to:
for each frame of image, scoring each region according to a set of contrasts of the regions in the image;
and for each region, determining whether the relative contrast of the region meets the third preset condition according to the score of the region in each frame of image.
In an implementable manner, when scoring each region according to a set of contrasts of the plurality of regions in the image, the processor 12 is specifically configured to:
and for each region, scoring the region according to the difference between the contrast ratios in the contrast ratio aggregate corresponding to the region.
In one implementable manner, the plurality of filters includes a high frequency filter and a low frequency filter;
when scoring each region according to the set of contrasts of the plurality of regions in the image, the processor 12 is specifically configured to:
performing filtering processing by using the high-frequency filter and the low-frequency filter respectively for each region; and scoring the region according to a ratio of the contrast obtained by the high frequency filter to the contrast obtained by the low frequency filter.
In an implementation manner, when determining whether the relative contrast of the region satisfies the third preset condition according to the score of the region in each frame image, the processor 12 is specifically configured to:
determining a comprehensive score of the region according to the score of the region in each frame image;
and if the comprehensive score is larger than a first threshold value, determining that the relative contrast of the region meets the third preset condition.
In an implementation manner, when determining whether the relative contrast of each region satisfies a third preset condition according to the recognition results of the plurality of regions, the processor 12 is specifically configured to:
for each region, determining a contrast curve of the region in the moving process of a focusing motor according to the contrast of the region in each frame of image;
and judging whether the relative contrast of the region meets the third preset condition or not according to the contrast curve.
In an implementation manner, when determining whether the relative contrast of the region satisfies a third preset condition according to the contrast curve, the processor 12 is specifically configured to:
determining a peak value of the contrast curve;
and judging whether the relative contrast of the region meets a third preset condition or not according to the peak value of the contrast curve.
In an implementation manner, when determining whether the relative contrast of the region satisfies a third preset condition according to the peak value of the contrast curve, the processor 12 is specifically configured to:
scoring the region according to the number of peaks and/or the size of peaks of the contrast curve;
judging whether the relative contrast of the region meets the third preset condition or not according to the score of the region;
and if the score of the region is greater than a second threshold value, the relative contrast of the region meets the third preset condition.
In one practical way, a mapping table of the corresponding relation between the peak number and the score is determined;
and determining the score of the region in the mapping table according to the number of peaks of the contrast curve.
In an implementable manner, when scoring the region according to the peak size of the contrast curve, the processor 12 is specifically configured to:
if the contrast curve has a plurality of peak values, determining a main peak according to the size of each peak value;
determining an effective peak value from other peak values except the main peak value, wherein the effective peak value is a peak value of which the ratio to the main peak value exceeds a preset value;
determining a score for the region based on the number of valid peaks in the contrast curve.
In an implementation manner, when performing the focusing process on the area satisfying the third preset condition, the processor 12 is specifically configured to:
determining a focusing position corresponding to each region in the regions meeting the third preset condition according to the identification result of the regions meeting the third preset condition;
determining at least one connected domain according to the focusing position corresponding to each region;
if a connected domain meeting the third preset condition exists, the connected domain is an image area where the object is located, and the object is an object contained in the connected domain;
and if the focal positions of any two adjacent regions are the same or the distance between the focal positions of any two adjacent regions is less than a preset distance, the two regions belong to the same communicated domain.
The focusing control apparatus shown in fig. 11 can execute the method of the embodiment shown in fig. 1-7, and the related descriptions of the embodiment not described in detail in this embodiment can be referred to in the related descriptions of the embodiment shown in fig. 1-7. The implementation process and technical effect of the technical solution refer to the descriptions in the embodiments shown in fig. 1 to 7, and are not described herein again.
Example eight
Fig. 12 is a schematic structural diagram of a focus control device according to an eighth embodiment of the present invention. The focus control apparatus may perform the focus control method corresponding to fig. 8, and as shown in fig. 12, the focus control apparatus may include:
a memory 21 for storing a computer program;
a processor 22 for executing the computer program stored in the memory to implement:
acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor;
and if the elongated object exists in the image to be processed and meets the preset requirement, focusing by taking the elongated object as a target.
Optionally, the focus control apparatus may further include a communication interface 23 for communicating with other devices or a communication network.
In one embodiment, the object is an elongated object if the ratio of the length to the width of the object exceeds a predetermined ratio.
In one embodiment, the elongated object comprises a wire.
In an implementation manner, when the elongated object is present in the image to be processed and the elongated object meets a preset requirement, and the processor 22 is specifically configured to:
determining a focusing position corresponding to each of a plurality of regions of the image according to the image to be processed;
determining at least one connected domain according to the focusing positions corresponding to the plurality of regions;
if a connected domain meeting the preset requirement exists, focusing by taking the connected domain as a target;
and if the focusing positions of any two adjacent areas meet the requirement of a preset position, the two areas belong to the same communicated domain.
In an implementation manner, when determining the in-focus position corresponding to each of the plurality of regions of the image, the processor 22 is specifically configured to:
and determining the in-focus position of each area in a plurality of areas of the image, the relative contrast of which meets a preset condition.
In an implementation manner, when determining, according to the image to be processed, a focus position corresponding to each of a plurality of regions of the image, the processor 22 is specifically configured to:
determining the recognition results of a plurality of areas of the image according to the image to be processed, wherein the recognition result of each area comprises the corresponding contrast of the area in each frame of image;
and aiming at each region, determining a focusing position corresponding to the region according to the corresponding recognition result.
In an implementation manner, when determining the in-focus position corresponding to the area according to the corresponding recognition result, the processor 22 is specifically configured to:
and determining the focusing position corresponding to the region according to the contrast change of the region in each frame image.
In an implementation manner, when determining at least one connected domain according to the focal positions corresponding to the multiple regions, the processor 22 is specifically configured to: if the focusing positions of any two adjacent areas are the same, determining that the two areas belong to the same connected domain;
or if the distance between the focusing positions of any two adjacent areas is smaller than the preset distance, determining that the two areas belong to the same connected domain.
In an implementation manner, if there is a connected domain that meets a preset requirement, when performing focusing processing with the connected domain as a target, the processor 22 is specifically configured to:
if the number of the connected domains is multiple, screening each connected domain according to the area of each connected domain;
and selecting the connected domains meeting the preset requirements as targets to carry out focusing treatment in the screened connected domains.
In an implementation manner, when the respective connected component is filtered by the area of the respective connected component, the processor 22 is specifically configured to:
for each connected domain, if the area of the connected domain is larger than a preset area, or the ratio of the area of the connected domain to other areas is larger than a preset area ratio, the connected domain passes through screening, wherein the other areas are the sum of the areas of other connected domains except the connected domain.
In an implementation manner, when selecting a connected domain meeting a preset requirement as a target to perform focusing processing in the screened connected domain, the processor 22 is specifically configured to:
and selecting the connected domain in the foreground as a target to carry out focusing processing in the screened connected domain.
In one implementation, the processor 22 is further configured to:
if no connected domain passes the screening, determining focusing positions corresponding to a plurality of regions in the safe region of the image;
grouping the multiple regions according to focusing positions corresponding to the multiple regions, and grouping the regions at the same focusing position into a group;
and carrying out focusing processing according to a group of corresponding focusing positions with the largest number of areas.
In an implementation manner, when selecting a connected domain meeting a preset requirement as a target to perform focusing processing in the screened connected domain, the processor 22 is specifically configured to:
identifying a category of each region in the connected domain that passes the screening;
and selecting the area with the category meeting the preset requirement as a target to carry out focusing processing.
In an implementation manner, when selecting an area with a category meeting a preset requirement as a target for performing the focusing process, the processor 22 is specifically configured to:
and if the preset type exists in the types of the regions, focusing the regions of the preset type as targets.
In an implementable manner, the device is applied to inspection equipment, and the preset category is a category corresponding to an inspection target of the inspection equipment.
In an implementable manner, the inspection equipment is electric tower inspection equipment, and the preset category is an electric tower.
In one implementation, the processor 22 is further configured to:
determining the current working state of the equipment;
and determining the preset category according to the working state.
In one possible implementation, the operating state includes any one of: patrol state, navigation state, following state and standby state.
The focus control apparatus shown in fig. 12 can execute the method of the embodiment shown in fig. 8-10, and reference may be made to the related description of the embodiment shown in fig. 8-10 for a part of this embodiment that is not described in detail. The implementation process and technical effect of the technical solution are described in the embodiments shown in fig. 8 to 10, and are not described herein again.
Example nine
Fig. 13 is a schematic structural diagram of a focus control device according to a ninth embodiment of the present invention. Referring to fig. 13, the focus control apparatus provided in this embodiment may include:
the first image acquisition circuit 1301 is configured to acquire multiple frames of images to be processed, where the multiple frames of images to be processed include multiple frames of images captured by a lens during movement of a focusing motor;
a first determining circuit 1302, configured to determine whether an object exists in the multiple frames of images to be processed, and whether a relative contrast of an image area corresponding to the object meets a preset condition; wherein, the relative contrast is determined according to an output result obtained by filtering the image area corresponding to the object by at least one filter;
and the first focusing processing circuit 1303 is configured to perform focusing processing on the image area corresponding to the object when the relative contrast of the image area corresponding to the object meets a preset condition.
Wherein the focus control device is configured to perform the method of the embodiment shown in fig. 1-7. The methods of the embodiments shown in fig. 1-7 may be implemented by hardware circuitry. For example, filtering the image may be implemented by a filter circuit; the addition or subtraction of the regions can be realized by an adder or a subtracter, etc.; whether the scoring meets the requirements or not is judged, and the scoring can be realized through a comparator and the like; the focusing process can be performed by outputting a step signal to the focusing motor.
For parts of this embodiment not described in detail, reference may be made to the description of the embodiment shown in fig. 1-7. The implementation process and technical effect of the technical solution refer to the descriptions in the embodiments shown in fig. 1 to 7, and are not described herein again.
Example ten
Fig. 14 is a schematic structural diagram of a focus control device according to a tenth embodiment of the present invention. Referring to fig. 14, the focus control apparatus provided in this embodiment may include:
a second image acquisition circuit 1401 for acquiring a plurality of frames of images to be processed including a plurality of frames of images photographed by the lens during movement of the focus motor;
and a second focusing processing circuit 1402, configured to perform focusing processing with respect to the elongated object as a target when the elongated object exists in the image to be processed and the elongated object meets a preset requirement.
Wherein the focus control device may perform the method of the embodiment shown in fig. 8-10. The methods of the embodiments shown in fig. 8-10 may be implemented by hardware circuitry. For parts of this embodiment not described in detail, reference may be made to the description of the embodiment shown in fig. 8-10. The implementation process and technical effect of the technical solution are described in the embodiments shown in fig. 8 to 10, and are not described herein again.
The embodiment of the invention also provides shooting equipment comprising the focusing control device in any one of the embodiments.
Optionally, the photographing apparatus may further include a lens barrel, a lens, a focus motor, and an image sensor. The focusing motor is used for driving the lens to move relative to the lens barrel so as to change the object distance or the image distance. The image sensor is used for converting the optical signal passing through the lens into an electric signal to form an image.
Optionally, the shooting device may be an inspection device.
The structure, function, execution process and technical effect of each component in the shooting device may refer to the description in the foregoing embodiments, and are not described herein again.
The embodiment of the invention also provides a movable platform which comprises the shooting equipment. The movable platform can be an unmanned aerial vehicle, an unmanned vehicle or a holder and the like. The movable platform may also include a body and a power system. The shooting equipment and the power system are arranged on the machine body, and the power system is used for providing power for the movable platform.
The structure, function, execution process and technical effect of each component in the movable platform can be referred to the description in the foregoing embodiments, and are not described herein again.
In addition, an embodiment of the present invention provides a storage medium, which is a computer-readable storage medium, and program instructions are stored in the computer-readable storage medium, where the program instructions are used to implement the focus control method in the embodiments shown in fig. 1 to 7.
An embodiment of the present invention further provides a storage medium, where the storage medium is a computer-readable storage medium, and program instructions are stored in the computer-readable storage medium, where the program instructions are used to implement the focusing control method in the embodiments shown in fig. 8 to 10.
The technical solutions and the technical features in the above embodiments may be used alone or in combination when conflicting with the present invention, and all embodiments are equivalent embodiments within the scope of the present invention as long as they do not exceed the scope recognized by those skilled in the art.
In the embodiments provided in the present invention, it should be understood that the disclosed related remote control device and method can be implemented in other ways. For example, the above-described remote control device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, remote control devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer Processor (Processor) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes performed by the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (74)

1. A focus control method, comprising:
acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor;
determining whether an object exists in the multiple frames of images to be processed and whether the relative contrast of image areas corresponding to the object meets a preset condition; wherein, the relative contrast is determined according to an output result obtained by filtering the image area corresponding to the object by at least one filter;
and if the relative contrast of the image area corresponding to the object meets a preset condition, carrying out focusing processing on the image area corresponding to the object.
2. The method according to claim 1, wherein the relative contrast satisfying a preset condition comprises: the contrast change of the corresponding image area of the object between the frames of images meets a first preset condition, and/or the change of a plurality of contrasts of the corresponding image area of the object in each frame of images, which is obtained by filtering through a plurality of filters, meets a second preset condition.
3. The method of claim 1, wherein a relative contrast of an image region corresponding to glass, a wall, and sky in the image to be processed does not satisfy a predetermined condition.
4. The method according to claim 1, wherein determining whether an object exists in the plurality of images to be processed, and whether a relative contrast of an image region corresponding to the object satisfies a preset condition, comprises:
determining the recognition results of a plurality of regions in the image according to the image to be processed, wherein the recognition result of each region comprises the corresponding contrast of the region in each frame of image;
respectively judging whether the relative contrast of each region meets a third preset condition according to the identification results of the regions;
if an area with the relative contrast meeting a third preset condition exists, determining that an object exists in the multiple frames of images to be processed, and the relative contrast of the image area corresponding to the object meets the preset condition;
if the relative contrast of the image area corresponding to the object meets a preset condition, performing focusing processing on the image area corresponding to the object, including: and focusing the area meeting the third preset condition.
5. The method of claim 4, wherein determining recognition results of a plurality of regions in the image from the image to be processed comprises:
each frame image to be processed is processed as follows: the image is filtered through a plurality of filters respectively, and a contrast set of each of a plurality of regions of the image is obtained, wherein the contrast set of each region comprises the contrast of the region obtained after the image is filtered through each of the plurality of filters.
6. The method according to claim 5, wherein determining whether the relative contrast of each region satisfies the third preset condition according to the recognition results of the plurality of regions comprises:
for each frame of image, scoring each region according to a set of contrasts of the regions in the image;
and for each region, determining whether the relative contrast of the region meets the third preset condition according to the score of the region in each frame of image.
7. The method of claim 6, wherein scoring each region according to a set of contrasts of the plurality of regions in the image comprises:
and for each region, scoring the region according to the difference between the contrast ratios in the contrast ratio aggregate corresponding to the region.
8. The method of claim 6, wherein the plurality of filters comprises a high frequency filter and a low frequency filter;
scoring each region according to a set of contrasts of the plurality of regions in the image, comprising:
performing filtering processing by using the high-frequency filter and the low-frequency filter respectively for each region; and scoring the region according to a ratio of the contrast obtained by the high frequency filter to the contrast obtained by the low frequency filter.
9. The method according to claim 6, wherein determining whether the relative contrast of the region satisfies the third preset condition according to the score of the region in each frame image comprises:
determining a comprehensive score of the region according to the score of the region in each frame image;
and if the comprehensive score is larger than a first threshold value, determining that the relative contrast of the region meets the third preset condition.
10. The method according to claim 4, wherein the determining whether the relative contrast of each region satisfies a third preset condition according to the recognition results of the plurality of regions comprises:
for each region, determining a contrast curve of the region in the moving process of a focusing motor according to the contrast of the region in each frame of image;
and judging whether the relative contrast of the region meets the third preset condition or not according to the contrast curve.
11. The method according to claim 10, wherein determining whether the relative contrast of the region satisfies a third preset condition according to the contrast curve comprises:
determining a peak value of the contrast curve;
and judging whether the relative contrast of the region meets a third preset condition or not according to the peak value of the contrast curve.
12. The method according to claim 11, wherein determining whether the relative contrast of the region satisfies a third preset condition according to the peak value of the contrast curve comprises:
scoring the region according to the number of peaks and/or the size of peaks of the contrast curve;
judging whether the relative contrast of the region meets the third preset condition or not according to the score of the region;
and if the score of the region is greater than a second threshold value, the relative contrast of the region meets the third preset condition.
13. The method of claim 12, wherein a mapping table of correspondence with respect to the number of peaks and the score is determined;
and determining the score of the region in the mapping table according to the number of peaks of the contrast curve.
14. The method of claim 12, wherein scoring the region according to a peak magnitude of the contrast curve comprises:
if the contrast curve has a plurality of peak values, determining a main peak according to the size of each peak value;
determining an effective peak value from other peak values except the main peak value, wherein the effective peak value is a peak value of which the ratio to the main peak value exceeds a preset value;
determining a score for the region based on the number of valid peaks in the contrast curve.
15. The method according to claim 4, wherein the focusing process is performed on the area satisfying the third preset condition, and comprises:
determining a focusing position corresponding to each region in the regions meeting the third preset condition according to the identification result of the regions meeting the third preset condition;
determining at least one connected domain according to the focusing position corresponding to each region;
if a connected domain meeting the third preset condition exists, the connected domain is an image area where the object is located, and the object is an object contained in the connected domain;
and if the focal positions of any two adjacent regions are the same or the distance between the focal positions of any two adjacent regions is less than a preset distance, the two regions belong to the same communicated domain.
16. A focus control method, comprising:
acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor;
and if the elongated object exists in the image to be processed and meets the preset requirement, focusing by taking the elongated object as a target.
17. The method of claim 16, wherein the object is an elongated object if the length to width ratio of the object exceeds a preset ratio.
18. The method of claim 16, wherein the elongated object comprises a wire.
19. The method according to claim 16, wherein if an elongated object exists in the image to be processed and the elongated object meets a preset requirement, performing focusing processing with the elongated object as a target comprises:
determining a focusing position corresponding to each of a plurality of regions of the image according to the image to be processed;
determining at least one connected domain according to the focusing positions corresponding to the plurality of regions;
if a connected domain meeting the preset requirement exists, focusing by taking the connected domain as a target;
and if the focusing positions of any two adjacent areas meet the requirement of a preset position, the two areas belong to the same communicated domain.
20. The method of claim 19, wherein determining the in-focus position for each of the plurality of regions of the image comprises:
and determining the in-focus position of each area in a plurality of areas of the image, the relative contrast of which meets a preset condition.
21. The method of claim 19, wherein determining the in-focus position corresponding to each of the plurality of regions of the image from the image to be processed comprises:
determining the recognition results of a plurality of areas of the image according to the image to be processed, wherein the recognition result of each area comprises the corresponding contrast of the area in each frame of image;
and aiming at each region, determining a focusing position corresponding to the region according to the corresponding recognition result.
22. The method of claim 21, wherein determining the in-focus position corresponding to the region according to the corresponding recognition result comprises:
and determining the focusing position corresponding to the region according to the contrast change of the region in each frame image.
23. The method of claim 19, wherein determining at least one connected component from the in-focus positions corresponding to the plurality of regions comprises:
if the focusing positions of any two adjacent areas are the same, determining that the two areas belong to the same connected domain;
or if the distance between the focusing positions of any two adjacent areas is smaller than the preset distance, determining that the two areas belong to the same connected domain.
24. The method of claim 19, wherein if there is a connected domain satisfying a predetermined requirement, focusing on the connected domain as a target comprises:
if the number of the connected domains is multiple, screening each connected domain according to the area of each connected domain;
and selecting the connected domains meeting the preset requirements as targets to carry out focusing treatment in the screened connected domains.
25. The method of claim 24, wherein screening each connected component by its area comprises:
for each connected domain, if the area of the connected domain is larger than a preset area, or the ratio of the area of the connected domain to other areas is larger than a preset area ratio, the connected domain passes through screening, wherein the other areas are the sum of the areas of other connected domains except the connected domain.
26. The method of claim 24, wherein selecting a connected component satisfying a preset requirement as a target for focusing among the connected components passing through the screening comprises:
and selecting the connected domain in the foreground as a target to carry out focusing processing in the screened connected domain.
27. The method of claim 24, further comprising:
if no connected domain passes the screening, determining focusing positions corresponding to a plurality of regions in the safe region of the image;
grouping the multiple regions according to focusing positions corresponding to the multiple regions, and grouping the regions at the same focusing position into a group;
and carrying out focusing processing according to a group of corresponding focusing positions with the largest number of areas.
28. The method of claim 24, wherein selecting a connected component satisfying a preset requirement as a target for focusing among the connected components passing through the screening comprises:
identifying a category of each region in the connected domain that passes the screening;
and selecting the area with the category meeting the preset requirement as a target to carry out focusing processing.
29. The method of claim 28, wherein selecting the area with the category meeting the preset requirement as the target for focusing comprises:
and if the preset type exists in the types of the regions, focusing the regions of the preset type as targets.
30. The method according to claim 29, wherein the method is applied to inspection equipment, and the preset category is a category corresponding to an inspection target of the inspection equipment.
31. The method of claim 30, wherein the inspection device is an electric tower inspection device and the predetermined category is an electric tower.
32. The method of claim 29, further comprising:
determining the current working state of the equipment;
and determining the preset category according to the working state.
33. The method of claim 32, wherein the operating state comprises any one of: patrol state, navigation state, following state and standby state.
34. A focus control apparatus, comprising:
a memory for storing a computer program;
a processor for executing the computer program stored in the memory to implement:
acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor;
determining whether an object exists in the multiple frames of images to be processed and whether the relative contrast of image areas corresponding to the object meets a preset condition; wherein, the relative contrast is determined according to an output result obtained by filtering the image area corresponding to the object by at least one filter;
and if the relative contrast of the image area corresponding to the object meets a preset condition, carrying out focusing processing on the image area corresponding to the object.
35. The apparatus of claim 34, wherein the relative contrast satisfying a preset condition comprises: the contrast change of the corresponding image area of the object between the frames of images meets a first preset condition, and/or the change of a plurality of contrasts of the corresponding image area of the object in each frame of images, which is obtained by filtering through a plurality of filters, meets a second preset condition.
36. The apparatus of claim 34, wherein a relative contrast of an image region corresponding to a glass, a wall, or a sky in the image to be processed does not satisfy a predetermined condition.
37. The apparatus according to claim 34, wherein when determining whether there is an object in the plurality of images to be processed and whether the relative contrast of the image area corresponding to the object satisfies a preset condition, the processor is specifically configured to:
determining the recognition results of a plurality of regions in the image according to the image to be processed, wherein the recognition result of each region comprises the corresponding contrast of the region in each frame of image;
respectively judging whether the relative contrast of each region meets a third preset condition according to the identification results of the regions;
if an area with the relative contrast meeting a third preset condition exists, determining that an object exists in the multiple frames of images to be processed, and the relative contrast of the image area corresponding to the object meets the preset condition;
if the relative contrast of the image area corresponding to the object meets a preset condition, performing focusing processing on the image area corresponding to the object, where the processor is specifically configured to: and focusing the area meeting the third preset condition.
38. The apparatus according to claim 37, wherein, in determining the recognition results of the plurality of regions in the image from the image to be processed, the processor is specifically configured to:
each frame image to be processed is processed as follows: the image is filtered through a plurality of filters respectively, and a contrast set of each of a plurality of regions of the image is obtained, wherein the contrast set of each region comprises the contrast of the region obtained after the image is filtered through each of the plurality of filters.
39. The apparatus according to claim 38, wherein when determining whether the relative contrast of each region satisfies the third preset condition according to the recognition results of the plurality of regions, the processor is specifically configured to:
for each frame of image, scoring each region according to a set of contrasts of the regions in the image;
and for each region, determining whether the relative contrast of the region meets the third preset condition according to the score of the region in each frame of image.
40. The apparatus of claim 39, wherein the processor, in scoring each region based on a set of contrasts for the plurality of regions in the image, is specifically configured to:
and for each region, scoring the region according to the difference between the contrast ratios in the contrast ratio aggregate corresponding to the region.
41. The apparatus of claim 39, wherein the plurality of filters comprises a high frequency filter and a low frequency filter;
when scoring each region according to the set of contrasts of the plurality of regions in the image, the processor is specifically configured to:
performing filtering processing by using the high-frequency filter and the low-frequency filter respectively for each region; and scoring the region according to a ratio of the contrast obtained by the high frequency filter to the contrast obtained by the low frequency filter.
42. The apparatus according to claim 39, wherein when determining whether the relative contrast of the region satisfies the third preset condition according to the score of the region in each frame image, the processor is specifically configured to:
determining a comprehensive score of the region according to the score of the region in each frame image;
and if the comprehensive score is larger than a first threshold value, determining that the relative contrast of the region meets the third preset condition.
43. The apparatus according to claim 37, wherein when determining whether the relative contrast of each region satisfies a third preset condition according to the recognition results of the plurality of regions, the processor is specifically configured to:
for each region, determining a contrast curve of the region in the moving process of a focusing motor according to the contrast of the region in each frame of image;
and judging whether the relative contrast of the region meets the third preset condition or not according to the contrast curve.
44. The apparatus according to claim 43, wherein when determining whether the relative contrast of the region satisfies a third preset condition according to the contrast curve, the processor is specifically configured to:
determining a peak value of the contrast curve;
and judging whether the relative contrast of the region meets a third preset condition or not according to the peak value of the contrast curve.
45. The apparatus according to claim 44, wherein when determining whether the relative contrast of the region satisfies a third preset condition according to the peak value of the contrast curve, the processor is specifically configured to:
scoring the region according to the number of peaks and/or the size of peaks of the contrast curve;
judging whether the relative contrast of the region meets the third preset condition or not according to the score of the region;
and if the score of the region is greater than a second threshold value, the relative contrast of the region meets the third preset condition.
46. The apparatus of claim 45, wherein a mapping table of correspondence between peak numbers and score scores is determined;
and determining the score of the region in the mapping table according to the number of peaks of the contrast curve.
47. The apparatus of claim 45, wherein the processor, when scoring the region according to a peak magnitude of the contrast curve, is specifically configured to:
if the contrast curve has a plurality of peak values, determining a main peak according to the size of each peak value;
determining an effective peak value from other peak values except the main peak value, wherein the effective peak value is a peak value of which the ratio to the main peak value exceeds a preset value;
determining a score for the region based on the number of valid peaks in the contrast curve.
48. The apparatus according to claim 37, wherein when performing the focusing process on the area satisfying the third preset condition, the processor is specifically configured to:
determining a focusing position corresponding to each region in the regions meeting the third preset condition according to the identification result of the regions meeting the third preset condition;
determining at least one connected domain according to the focusing position corresponding to each region;
if a connected domain meeting the third preset condition exists, the connected domain is an image area where the object is located, and the object is an object contained in the connected domain;
and if the focal positions of any two adjacent regions are the same or the distance between the focal positions of any two adjacent regions is less than a preset distance, the two regions belong to the same communicated domain.
49. A focus control apparatus, comprising:
a memory for storing a computer program;
a processor for executing the computer program stored in the memory to implement:
acquiring multiple frames of images to be processed, wherein the multiple frames of images to be processed comprise multiple frames of images shot by a lens in the moving process of a focusing motor;
and if the elongated object exists in the image to be processed and meets the preset requirement, focusing by taking the elongated object as a target.
50. The apparatus of claim 49, wherein the object is an elongated object if the length to width ratio of the object exceeds a preset ratio.
51. The apparatus of claim 49, wherein the elongated object comprises a wire.
52. The apparatus according to claim 49, wherein when the elongated object is targeted for focusing processing if the elongated object exists in the image to be processed and the elongated object meets a preset requirement, the processor is specifically configured to:
determining a focusing position corresponding to each of a plurality of regions of the image according to the image to be processed;
determining at least one connected domain according to the focusing positions corresponding to the plurality of regions;
if a connected domain meeting the preset requirement exists, focusing by taking the connected domain as a target;
and if the focusing positions of any two adjacent areas meet the requirement of a preset position, the two areas belong to the same communicated domain.
53. The apparatus of claim 52, wherein in determining the in-focus position for each of the plurality of regions of the image, the processor is specifically configured to:
and determining the in-focus position of each area in a plurality of areas of the image, the relative contrast of which meets a preset condition.
54. The apparatus according to claim 52, wherein when determining the in-focus position corresponding to each of the plurality of regions of the image according to the image to be processed, the processor is specifically configured to:
determining the recognition results of a plurality of areas of the image according to the image to be processed, wherein the recognition result of each area comprises the corresponding contrast of the area in each frame of image;
and aiming at each region, determining a focusing position corresponding to the region according to the corresponding recognition result.
55. The apparatus of claim 54, wherein when determining the in-focus position corresponding to the region according to the corresponding recognition result, the processor is specifically configured to:
and determining the focusing position corresponding to the region according to the contrast change of the region in each frame image.
56. The apparatus of claim 52, wherein when determining at least one connected component from the in-focus positions corresponding to the plurality of regions, the processor is specifically configured to: if the focusing positions of any two adjacent areas are the same, determining that the two areas belong to the same connected domain;
or if the distance between the focusing positions of any two adjacent areas is smaller than the preset distance, determining that the two areas belong to the same connected domain.
57. The apparatus of claim 52, wherein if there is a connected component that meets a predetermined requirement, the processor is specifically configured to, when focusing on the connected component as a target:
if the number of the connected domains is multiple, screening each connected domain according to the area of each connected domain;
and selecting the connected domains meeting the preset requirements as targets to carry out focusing treatment in the screened connected domains.
58. The apparatus of claim 57, wherein in filtering each connected component by its area, the processor is specifically configured to:
for each connected domain, if the area of the connected domain is larger than a preset area, or the ratio of the area of the connected domain to other areas is larger than a preset area ratio, the connected domain passes through screening, wherein the other areas are the sum of the areas of other connected domains except the connected domain.
59. The apparatus according to claim 57, wherein when selecting a connected component that meets a preset requirement as a target for focusing among the connected components that pass the filtering, the processor is specifically configured to:
and selecting the connected domain in the foreground as a target to carry out focusing processing in the screened connected domain.
60. The apparatus of claim 57, wherein the processor is further configured to:
if no connected domain passes the screening, determining focusing positions corresponding to a plurality of regions in the safe region of the image;
grouping the multiple regions according to focusing positions corresponding to the multiple regions, and grouping the regions at the same focusing position into a group;
and carrying out focusing processing according to a group of corresponding focusing positions with the largest number of areas.
61. The apparatus according to claim 57, wherein when selecting a connected component that meets a preset requirement as a target for focusing among the connected components that pass the filtering, the processor is specifically configured to:
identifying a category of each region in the connected domain that passes the screening;
and selecting the area with the category meeting the preset requirement as a target to carry out focusing processing.
62. The apparatus according to claim 61, wherein when selecting an area with a category satisfying a preset requirement as a target for focusing, the processor is specifically configured to:
and if the preset type exists in the types of the regions, focusing the regions of the preset type as targets.
63. The apparatus according to claim 62, wherein the apparatus is applied to inspection equipment, and the preset category is a category corresponding to an inspection target of the inspection equipment.
64. The apparatus according to claim 63, wherein the inspection device is an electric tower inspection device and the predetermined category is an electric tower.
65. The apparatus of claim 62, wherein the processor is further configured to:
determining the current working state of the equipment;
and determining the preset category according to the working state.
66. The apparatus of claim 65, wherein the operating condition comprises any one of: patrol state, navigation state, following state and standby state.
67. A focus control apparatus, comprising:
the focusing motor is used for moving a lens, and the focusing motor is used for focusing the image of the lens;
the first determining circuit is used for determining whether an object exists in the multiple frames of images to be processed and whether the relative contrast of image areas corresponding to the object meets a preset condition; wherein, the relative contrast is determined according to an output result obtained by filtering the image area corresponding to the object by at least one filter;
and the first focusing processing circuit is used for carrying out focusing processing on the image area corresponding to the object when the relative contrast of the image area corresponding to the object meets a preset condition.
68. A focus control apparatus, comprising:
the second image acquisition circuit is used for acquiring a plurality of frames of images to be processed, wherein the plurality of frames of images to be processed comprise a plurality of frames of images shot by the lens in the moving process of the focusing motor;
and the second focusing processing circuit is used for focusing by taking the elongated object as a target when the elongated object exists in the image to be processed and meets a preset requirement.
69. A photographing apparatus, characterized by comprising: the focus control apparatus of any of claims 34-48.
70. A photographing apparatus, characterized by comprising: the focus control apparatus of any of claims 49-66.
71. A movable platform, comprising: a camera device as claimed in claim 69.
72. A movable platform, comprising: a camera device as claimed in claim 70.
73. A computer-readable storage medium, characterized in that program instructions for implementing the focus control method according to any one of claims 1 to 15 are stored in the computer-readable storage medium.
74. A computer-readable storage medium, characterized in that program instructions for implementing the focus control method according to any one of claims 16 to 33 are stored in the computer-readable storage medium.
CN202080004951.XA 2020-04-14 2020-04-14 Focusing control method, device, equipment, movable platform and storage medium Pending CN112640425A (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/084800 WO2021207945A1 (en) 2020-04-14 2020-04-14 Focusing control method, apparatus, and device, movable platform, and storage medium

Publications (1)

Publication Number Publication Date
CN112640425A true CN112640425A (en) 2021-04-09

Family

ID=75291244

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202080004951.XA Pending CN112640425A (en) 2020-04-14 2020-04-14 Focusing control method, device, equipment, movable platform and storage medium

Country Status (2)

Country Link
CN (1) CN112640425A (en)
WO (1) WO2021207945A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114245023B (en) * 2022-02-24 2022-06-03 浙江华创视讯科技有限公司 Focusing processing method and device, camera device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101950063A (en) * 2009-07-10 2011-01-19 佛山普立华科技有限公司 Automatic focusing system and automatic focusing method
US20150070566A1 (en) * 2013-09-12 2015-03-12 Mitutoyo Corporation Information processing apparatus, information processing method, program, and vision measuring apparatus
CN105629628A (en) * 2014-10-30 2016-06-01 展讯通信(上海)有限公司 Automatic focusing method and device
CN108076278A (en) * 2016-11-10 2018-05-25 阿里巴巴集团控股有限公司 A kind of Atomatic focusing method, device and electronic equipment

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100561326C (en) * 2007-07-06 2009-11-18 鸿富锦精密工业(深圳)有限公司 Autofocus system and automatic focusing method
JP2012054810A (en) * 2010-09-02 2012-03-15 Olympus Corp Image processing device, image processing method, imaging apparatus, and image processing program
JP5888890B2 (en) * 2011-07-21 2016-03-22 オリンパス株式会社 Focus control device
CN103108128B (en) * 2013-02-18 2016-08-03 广东欧珀移动通信有限公司 A kind of method of auto-focusing, system and mobile terminal
CN104460184B (en) * 2014-11-17 2017-05-03 天津三星通信技术研究有限公司 Method and facility for focusing in shooting device
CN106707674B (en) * 2015-11-17 2021-02-26 深圳光峰科技股份有限公司 Automatic focusing method of projection equipment and projection equipment
JP2017129613A (en) * 2016-01-18 2017-07-27 オリンパス株式会社 Focus adjustment device and focus adjustment method
CN106412423A (en) * 2016-09-19 2017-02-15 珠海格力电器股份有限公司 Focusing method and device
CN109510936B (en) * 2017-09-14 2021-03-19 展讯通信(上海)有限公司 Continuous automatic focusing method and system
CN110033418B (en) * 2019-04-15 2023-03-24 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and electronic equipment
CN110248096B (en) * 2019-06-28 2021-03-12 Oppo广东移动通信有限公司 Focusing method and device, electronic equipment and computer readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101950063A (en) * 2009-07-10 2011-01-19 佛山普立华科技有限公司 Automatic focusing system and automatic focusing method
US20150070566A1 (en) * 2013-09-12 2015-03-12 Mitutoyo Corporation Information processing apparatus, information processing method, program, and vision measuring apparatus
CN105629628A (en) * 2014-10-30 2016-06-01 展讯通信(上海)有限公司 Automatic focusing method and device
CN108076278A (en) * 2016-11-10 2018-05-25 阿里巴巴集团控股有限公司 A kind of Atomatic focusing method, device and electronic equipment

Also Published As

Publication number Publication date
WO2021207945A1 (en) 2021-10-21

Similar Documents

Publication Publication Date Title
CN110248096B (en) Focusing method and device, electronic equipment and computer readable storage medium
CN109714519B (en) Method and system for automatically adjusting image frame
EP2549738B1 (en) Method and camera for determining an image adjustment parameter
CN110149482A (en) Focusing method, device, electronic equipment and computer readable storage medium
KR101412752B1 (en) Apparatus and method for digital auto-focus
US20080136958A1 (en) Camera having a focus adjusting system and a face recognition function
CN110191287B (en) Focusing method and device, electronic equipment and computer readable storage medium
US6470148B2 (en) Distance measuring device
CN112203012B (en) Image definition calculation method, automatic focusing method and system
US6362852B2 (en) Focus control apparatus and method for use with a video camera or the like
CN105046719B (en) A kind of video frequency monitoring method and system
CN106991418B (en) Winged insect detection method and device and terminal
CN110324536B (en) Image change automatic sensing focusing method for microscope camera
CN110248101B (en) Focusing method and device, electronic equipment and computer readable storage medium
JP5392198B2 (en) Ranging device and imaging device
CN102780847A (en) Camera automatic focusing control method focused on moving target
CN113572958B (en) Method and equipment for automatically triggering camera to focus
CN105430277B (en) Autofocus control method and device
US9053355B2 (en) System and method for face tracking
CN103354599A (en) Automatic focusing method applied to moving light source scene and automatic focusing apparatus
CN103168461B (en) Device for assisting focusing of a camera
CN112640425A (en) Focusing control method, device, equipment, movable platform and storage medium
CN110062150B (en) Automatic focusing method and device
US8179471B2 (en) Focusing device and image pickup apparatus
US20130044212A1 (en) Imaging device and distance information detecting method

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20210409