WO2021102961A1 - Focusing method for photographing apparatus, image processing device, and storage medium - Google Patents
Focusing method for photographing apparatus, image processing device, and storage medium Download PDFInfo
- Publication number
- WO2021102961A1 WO2021102961A1 PCT/CN2019/122109 CN2019122109W WO2021102961A1 WO 2021102961 A1 WO2021102961 A1 WO 2021102961A1 CN 2019122109 W CN2019122109 W CN 2019122109W WO 2021102961 A1 WO2021102961 A1 WO 2021102961A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- focus area
- block
- focus
- candidate
- initial
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
Definitions
- the present invention relates to the field of communication technology, in particular to a focusing method, image processing equipment and storage medium of a photographing device.
- the embodiment of the present invention provides a focusing method, image processing equipment and storage medium of a photographing device, which can improve the focusing success rate of the photographing device.
- the initial focus area does not meet the contrast focus condition, the initial focus area is expanded to obtain a candidate focus area, and the photographing device is subjected to contrast focus processing according to the candidate focus area.
- an embodiment of the present invention provides an image processing device, which is characterized in that it includes a memory and a processor;
- the memory is used to store program code
- the processor is used to call program code, and when the program code is executed, it is used to perform the following operations:
- the initial focus area does not meet the contrast focus condition, the initial focus area is expanded to obtain a candidate focus area, and the photographing device is subjected to contrast focus processing according to the candidate focus area.
- an embodiment of the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, the computer program includes program instructions, and the program instructions are When executing, the processor is caused to execute the focusing method of the photographing device of the first aspect.
- the embodiment of the present invention controls the camera to acquire the preview image and determine the initial focus area of the preview image when the camera is in focus; if the initial focus area does not meet the contrast and focus conditions, the initial focus area is expanded to obtain the candidate focus area, Further performing contrast focusing processing on the photographing device according to the candidate focus area, which realizes that when the initial focusing area does not meet the contrast focusing condition, the focusing processing is performed on the photographing device in a larger range, which can improve the focus success rate.
- FIG. 1 is a schematic flowchart of a focusing method of a photographing device according to an embodiment of the present invention
- FIG. 2b is another schematic diagram of obtaining an initial focus area of a preview image according to an embodiment of the present invention.
- 2c is another schematic diagram of obtaining an initial focus area of a preview image according to an embodiment of the present invention.
- the embodiment of the present invention proposes a focusing scheme for a photographing device based on contrast focusing.
- the initial focus area is expanded to obtain the candidate focus area. Enlarge the focus target area and calculate the contrast difference of the focus target in a larger range, which can improve the focus success rate.
- an embodiment of the present invention provides a focusing method of the photographing device.
- 1 is a schematic flowchart of a focusing method of a photographing device according to an embodiment of the present invention.
- the focusing method shown in FIG. 1 may be executed by an image processing device, and specifically may be executed by a processor of the image processing device, as shown in FIG.
- the focusing method includes the following steps:
- Step S101 Control the photographing device to obtain a preview image.
- the photographing device may be any photographing device that can be used to photograph images, such as a digital camera, a drone camera, a handheld pan-tilt camera, and a mobile phone camera.
- the preview image is obtained by shooting an object in the shooting scene by the shooting device, and the preview image may be understood as an image used to focus the shooting device, based on the preview image and the focusing method provided by the embodiment of the present invention
- the camera is controlled to take photos of the objects in the shooting scene.
- the image obtained by shooting may be the image finally output to the user for viewing.
- Step S102 Determine the initial focus area of the preview image.
- the preview image is any one of a plurality of preview images.
- the initial focus area of the preview image may be determined according to the operation position at which the user inputs an operation instruction to the photographing device and the preset size and shape information of the initial focus area.
- the user can specify an operating position by clicking, double-clicking, or long-pressing the camera or the physical button on the camera.
- the image processing device selects an area with a preset size and a preset shape centered on the operating position.
- the initial focus area of the preview image For example, the shape of the initial focus area set by the image processing device for the camera is a rectangle with a preset size. After the user determines the operating position on the camera, the image processing device selects a rectangular area of the preset size with the operating position as the center.
- the initial focus area of the preview image is any one of a plurality of preview images.
- the initial focus area of the preview image may be determined according to the operation position at which the user inputs an operation instruction to the photographing device and the prese
- the initial focus area of the preview image may be determined according to the user's operation instruction to the shooting device and the blocks included in the preview image. It should be understood that during image processing, in order to facilitate processing and improve processing efficiency, the image is usually divided into blocks, and corresponding processing is performed for each block. In the embodiment of the present invention, the initial focus area of the preview image is determined At this time, the preview image can also be divided into multiple blocks, and the initial focus area is determined according to the user's operation instructions and the blocks included in the preview image.
- the initial focus area meeting the contrast and focus condition may mean that the multiple initial focus reference values corresponding to the initial focus area satisfy the reference value condition indicated by the contrast condition, and the multiple initial focus reference values satisfy the reference value condition indicated by the contrast condition. It may include one or more of the following: there is a peak among multiple initial focus reference values, each initial focus reference value is greater than the reference threshold, or there are a certain number of initial focus reference values greater than the reference threshold, and the difference between the maximum value and the minimum value is greater than the difference Value threshold.
- the multiple initial focus reference values corresponding to the initial focus area can also be referred to as the AF statistical value (also called the contrast value, or the result of the AF evaluation function), which is obtained by calculating the reference value of the initial focus area of each preview image of.
- the AF statistical value also called the contrast value, or the result of the AF evaluation function
- generally FIR filter, IIR filter and Sobel edge detection operator can be used to calculate the reference value of the initial focus area of each preview image.
- the following uses Sobel edge detection operator as an example to introduce how to calculate each The initial focus reference value corresponding to the initial focus area of the preview object.
- the edge detection operator performs edge detection processing on the associated blocks to obtain the sum of squares of each associated block; further, obtains the weight corresponding to each associated block, and compares the sum of squares of each associated block to the corresponding associated area The weights corresponding to the blocks are multiplied and added, and the result obtained is the initial focus reference value corresponding to the initial focus area of the preview image.
- the initial focus reference value of the initial focus area corresponding to each preview image can be calculated. From the foregoing, it can be seen that each preview image is taken by the camera when the focus motor is at each adjustment position. Therefore, the initial focus area
- the corresponding multiple initial focus reference values essentially refer to the corresponding initial focus reference values when the focus motor is located at each adjustment position.
- FIG. 3 which is a schematic diagram of the relationship between the adjustment position, the preview image, and the initial focus reference value of a focus motor according to an embodiment of the present invention.
- 301 represents the camera
- 302 represents the shooting scene. Assuming that the adjustment position of the focus motor includes position 1, position 2, and position 3.
- the first type After the initial focus area is obtained, it can be judged whether the initial focus area meets the contrast and focus conditions. When the initial focus area meets the contrast and focus conditions, the camera is subjected to contrast focus processing according to the initial focus area; When the area does not meet the contrast and focus conditions, the initial focus area is expanded to obtain a candidate focus area, and the camera device is subjected to contrast focus processing according to the candidate focus area. In this way, if the initial focus area meets the contrast and focus conditions, the step of expanding the initial focus area to obtain a candidate focus area may not be performed, which can save part of the power consumption of the image processing device.
- the implementation manner of performing contrast focusing processing on the photographing device according to the candidate focus area may be: finding a target position of the focus motor according to the candidate focus reference value corresponding to the candidate focus area of each preview image, and when the focus motor is at At this target position, the camera can take a clearer image. How to perform contrast focusing processing on the shooting device according to the candidate focus area will be described in detail in the following embodiments.
- an embodiment of the present invention also provides another focusing method of a photographing device.
- FIG. 4 is a schematic flowchart of another focusing method of a photographing device provided by this embodiment.
- the focusing method shown in FIG. 4 may be executed by an image processing device, and specifically may be executed by a processor of the image processing device.
- the focusing method shown in FIG. 4 may include the following steps:
- Step S402 Determine the initial focus area of each preview image.
- step S401 and step S402 reference may be made to the description of the relevant steps in the embodiment shown in FIG. 1, which will not be repeated here.
- Step S403 Detect whether the focus object corresponding to the initial focus area needs a preset type of shooting object with multiple focus areas for focusing processing.
- the focus object corresponding to the initial focus area is a preset type of shooting object that requires multiple focus areas for focus processing; if so, trigger If the initial focus area does not meet the contrast and focus conditions, then expand the initial focus area to obtain a candidate focus area, and perform contrast focus processing on the photographing device according to the candidate focus area; if not, based on the initial focus area
- the focus area performs focus processing on the photographing device.
- the preset type of shooting objects can be summarized based on historical shooting experience, or can be specified by the user, such as white clouds, white walls, and so on.
- step S403-Step S405 may not be executed, and the object processing can be performed on the camera according to the initial focus area;
- step S403 to step S405 are executed again, which can effectively save the power consumption of the image processing device and improve the focus processing efficiency.
- Step S404 if yes, if the initial focus area does not meet the contrast focus condition, the initial focus area is expanded to obtain a candidate focus area, and the candidate focus area includes the first candidate focus area and the second candidate focus area.
- the candidate focus area may include a first candidate focus area
- the implementation manner of expanding the initial focus area to obtain the candidate focus area may be: partition the preview image to obtain multiple blocks, and obtain The weight value of each block; based on the weight value of at least one first block adjacent to the initial focus area, a first target block is determined in the at least one first block, and the first The weight value of the target block is greater than the weight values of other blocks in the at least one first block; the first candidate focus area is obtained according to the first target block and the initial focus area.
- the number of the first target block may be one or more
- obtaining the first candidate focus area according to the first target block and the initial focus area may be the combination of the first target block and the initial focus area They are combined together to form the first candidate focus area.
- the number of the first target block may be at least one, and the number of the first target block may be based on the number of blocks of the initial focus area and the number of blocks of the first candidate focus area by the image processing device.
- the implementation manner for determining the first target block in the at least one first block may be: selecting from the at least one first block The first block with the largest weight value is used as the first target block; if the number of first target blocks is at least two, the implementation of determining the first target block in the at least one first block is : Sort each first block in at least one first block in ascending order of weight value, and select the first block with the same number as the first target block from front to back in the first block after the arrangement. Block, the selected first block is used as the first target block.
- the at least one first block adjacent to the initial focus area may include a directly adjacent block directly adjacent to the initial focus area and an indirect adjacent area indirectly adjacent to the initial focus area.
- the block is called the immediate adjacent area of the initial focus area Block; if there are other blocks between a block and the edge block of the initial focus area (in this case, the adjacent step is equal to the number of other blocks, for example, there are 2 other blocks, then the adjacent step 2), the block is called an indirect adjacent block of the initial focus area.
- 501 represents a preview image
- the preview image includes multiple blocks, suppose 502 represents the initial focus area, the initial focus area is composed of 3x3 blocks, block A and block B are two located in For the block at the edge of the initial focus area, there are no other blocks between the block C and the block A, and the two blocks are directly adjacent, then the block C is called the directly adjacent block of the initial focus area. If there is a block C between block D and block A, block D can be called an indirect adjacent block of the initial focus area. Similarly, block E and block F are also called initial focus The indirect adjacent block of the area.
- the at least one first block adjacent to the initial focus area may refer to the remaining blocks in the preview image excluding the blocks included in the initial focus area, which are adjacent to the initial focus area within a certain adjacent step.
- the specific adjacent step length may be determined according to the number and shape of blocks included in the first candidate focus area set by the image processing device, and the number and shape of blocks included in the initial focus area.
- the adjacent step length can be set to 0-1, that is to say A block with an adjacent step length of 0 and an adjacent step length of 1 between the edge block of the initial focus area is determined as the first block adjacent to the initial focus area.
- the block division of the preview image may be performed by the image processing device calling the AF stat module for auto-focus statistics, and the AF stat module may perform the preview image on the preview image by default.
- the division rule of the block division, the division rule may include the window size used for the block division, the size of each block after division, and so on.
- the weight value of each block in the preview image may be set according to the position of the initial focus area in the preview image and the image composition rule.
- the image composition rules may include ensuring that the shooting subject is located in the center of the captured image as much as possible. To ensure that the subject in the captured image is clearer, the initial focus area can be expanded as far as possible to the area where the subject exists (that is, the center of the image) to obtain the candidate focus area, so as to facilitate the focus processing of the camera based on the candidate focus area Later, the subject in the image captured by the camera is clearer.
- the weight value of each block satisfies the following:
- the weight value of the block at the edge position of the preview image is smaller than the weight value of the block at the non-edge position of the preview image, the weight value of each block and the distance between the corresponding block and the center of the preview image Into a negative correlation.
- the closer to the center of the preview image the greater the weight value of the block.
- the user's operating position is the upper left corner of the preview image, and considering the image composition rules, the edge is often not within the user's attention range, and a smaller weight value can be set for the edge block on the preview image.
- FIG. 6a is a schematic diagram of determining the weight value of a block provided by an embodiment of the present invention.
- 601 represents a preview image, assuming that the initial focus area is 602, and 603 represents the center of the preview image, and the preview image is divided into 25 areas.
- Blocks the following takes the block A, block B, block C and block D included in the 25 blocks as examples to illustrate the setting of the weight value for each block according to the position of the initial focus area in the preview image and the image composition rules After that, the relationship between the weight value of each block.
- block A and block B are located at the non-edge position of the preview image
- block C and block D are located at the edge position of the preview image, so based on the above, the weight values of block C and block D are both smaller than the block
- the weight value of B is also less than the weight value of block A; in addition, as can be seen from Figure 6a, the distance between block C and the center of the preview image is less than the distance between block D and the center of the preview image, based on the weight value and distance The distance between the center of the preview image is negatively correlated, and the weight value of block C is greater than the weight value of block D.
- block A, block B, block C, and block D in the descending order of weight value are: weight value of block A> weight value of block B> weight value of block C> The weight value of block D.
- the weight value of each block in the preview image may also be set based on the semantic segmentation data of the preview image and the position of the initial focus area in the preview image.
- the weight value is set for each block according to the following conditions: the weight value of the block having the same semantics as the initial focus area is greater than the weight value of the block having different semantics from the initial focus area, and The weight value of each block and the distance between the corresponding block and the center of the initial focus area are negatively correlated. It should be understood that the initial focus area is determined according to the operation instructions entered by the user, and the operation position where the user enters the operation instructions should be where there is an object of interest to the user.
- the data is segmented according to semantics, it will be a block with the same semantics as the initial focus area.
- Setting a higher weight can ensure that when expanding the initial focus area, the first choice is to add blocks with the same semantics as the initial focus area to the initial focus area to obtain the candidate focus area. In this way, users can still be retained in the candidate focus area Objects of interest, in turn, can ensure that images satisfactory to the user are captured, and improve user experience.
- FIG. 6b is another schematic diagram of determining the weight value of a block provided by an embodiment of the present invention.
- 604 represents a preview image, assuming that the initial focus area is 605, and 606 represents the center of the initial focus area, assuming that the preview image is divided into 25 blocks, the following takes block A, block B, and block C as examples to illustrate the weight of each block after the weight value is set for each block according to the semantic segmentation data of the preview image and the position of the initial focus area The size relationship between. From the initial focus area, it can be seen that the object that the user may be interested in is a person.
- Block A and Block B are the blocks on the person, that is, Block A and Block B are blocks with the same semantics as the initial focus area.
- the weight values of block A and block B are both greater than the weight value of block C; in addition, the distance between block A and the center of the initial focus area is less than the distance between block B and the center of the initial focus area, based on the weight of the above block The value is negatively correlated with the distance between the corresponding block and the center of the initial focus area. It can be seen that the weight value of block A is greater than the weight value of block B. Based on the above, the relationship between the weight values of block A, block B, and block C is: the weight value of block A>the weight value of block B>the weight value of block C.
- the candidate focus area may include a second candidate focus area in addition to the first candidate focus area.
- expanding the initial focus area to obtain the candidate focus area further includes: based on a weight value of at least one second block adjacent to the first candidate focus area , Determining a second target block in the at least one second block, and the weight value of the second target block is greater than the weight value of other blocks in the at least one second block; The target block and the first candidate focus area are obtained to obtain the second candidate focus area, and the second candidate focus area is composed of the second target block and the first candidate focus area.
- the number of the second target block may be at least one, and the number of the second target block may be determined by the image processing device according to the number of blocks of the first candidate focus area and the number of blocks of the second candidate focus area.
- the image processing device may set the number of blocks of the first candidate focus area when the first candidate focus area is obtained by performing an expansion process on the initial focus area (also referred to as expanding the initial focus area by one level); and Set, continue to expand the first candidate focus area to obtain the second candidate focus area, the number of blocks in the second candidate focus area; then according to the number of blocks in the first candidate focus area and the blocks in the second candidate focus area
- the at least one second block adjacent to the first candidate focus area may include a block directly adjacent to the first candidate focus area.
- the adjacent direct adjacent block and the indirect adjacent block indirectly adjacent to the first candidate focus area.
- the at least one second block adjacent to the first candidate focus area refers to the remaining blocks in the preview image excluding the blocks in the first candidate focus area that are in a certain step adjacent to the first candidate focus area. Neighboring blocks within the long.
- the specific size of the adjacent step may be determined according to the number and shape of the blocks included in the first candidate focus area set by the image processing device, and the number and shape of the blocks included in the second candidate focus area set by the image processing device.
- the number of candidate focus areas obtained by expanding the initial focus area is different due to different modes and different block division rules. For some shooting devices, it may be affected by the angle of view or working mode.
- the initial focus area can be expanded by two stages to obtain the first candidate focus area and the second candidate focus area; for some shooting devices, it may only It is allowed to expand the initial focus area by one level to obtain the first candidate focus area. Therefore, in order to accurately expand the initial focus area to obtain the candidate focus area, after each expansion of the initial focus area to obtain the first candidate focus area, it can be determined whether the camera meets the conditions for continuing expansion.
- the focus area is expanded to obtain the second candidate focus area.
- the method further includes: determining Whether the ratio between the number of blocks included in the first candidate focus area and the number of blocks included in the preview image is less than a preset ratio;
- the method further includes : Determine the working mode in the process of controlling the photographing device to obtain the preview image; if the working mode is a preset mode, trigger the execution of the at least one first focus area adjacent to the first candidate focus area.
- the preset working mode includes a dual-lens mode. If the working mode of the shooting device is a dual-lens mode, the initial focus area can be expanded more times to obtain more candidate focus areas, and even the entire preview image can be expanded.
- Step S405 Perform contrast and focus processing on the camera according to the candidate focus area.
- the candidate focus area includes a first candidate focus area and a second candidate focus area
- the performing contrast focus processing on the shooting device according to the candidate focus area includes: if the first candidate focus area satisfies all According to the contrast and focus condition, perform contrast and focus processing on the photographing device according to the first candidate focus area to obtain the target position of the focus motor; if the first candidate focus area does not meet the contrast and focus condition, then Performing contrast focusing processing on the photographing device according to the second candidate focus area to obtain the target position of the focusing motor.
- the first candidate focus area meeting the contrast and focus condition may mean that the multiple first focus reference values corresponding to the first candidate focus area satisfy the reference value condition indicated by the contrast and focus condition, that is, none of the multiple first focus reference values There are multiple peaks, each of the first focus reference values is greater than a preset value or there are a certain number of first focus reference values that are greater than the reference threshold, and the difference between the maximum value and the minimum value is greater than the difference threshold.
- the multiple first focus reference values corresponding to the first candidate focus area are obtained by calculating the reference value of the first candidate focus area of each preview image. For the specific calculation method, refer to the calculation of the initial focus reference value in the embodiment of FIG. 1 The method is not repeated here.
- the performing contrast focusing processing on the photographing device according to the first candidate focus area to obtain the target position of the focusing motor includes: acquiring the target from the plurality of first focus reference values Focus reference value, and obtain a target preview image corresponding to the target focus reference value from the plurality of preview images; determine the adjustment position of the focus motor when the target preview image is taken as the focus motor target location.
- the target focus reference value refers to the maximum value of a plurality of first focus reference values.
- the shooting device is controlled to shoot when the focus motor is at the target position when the image is captured, so that a clearer image can be obtained.
- the shooting device is controlled to acquire multiple preview images, and the initial focus area of each preview image is determined; in the case where it is determined that the focus object in the initial focus area is a preset type of shooting object, if the initial focus is determined If the area does not meet the contrast and focus condition, the initial focus area is expanded to obtain the first candidate focus area and the second candidate focus area, and the photographing device is further subjected to contrast focus processing according to the first candidate focus area and the second candidate focus area
- the steps can save the power consumption of the terminal.
- the camera can be focused on one or more larger ranges, which can improve the focus success rate.
- the embodiments of the present invention also provide an image processing device, which may include a photographing device, may also be included in the photographing device, or be other equipment independent of the photographing device.
- an image processing device which may include a photographing device, may also be included in the photographing device, or be other equipment independent of the photographing device.
- FIG. 7 which is a schematic structural diagram of an image processing device provided by an embodiment of the present invention
- the image processing device shown in FIG. 7 may at least include a processor 701 and a memory 702, and a bus 703 can be used between the processor 701 and the memory 702. Phase connection.
- a program code is stored in the memory 702, and the processor 701 calls the program code.
- the program code is executed, it is used to perform the following operations: control the camera to obtain the preview image; determine the initial focus area of the preview image If the initial focus area does not meet the contrast and focus conditions, then expand the initial focus area to obtain a candidate focus area, and perform contrast focus processing on the photographing device according to the candidate focus area.
- the candidate focus area includes a first candidate focus area
- the processor 701 when the processor 701 is used to obtain the candidate focus area of the preview image, perform the following operations: divide the preview image into blocks Obtain multiple blocks, and obtain the weight value of each block; based on the weight value of at least one first block adjacent to the initial focus area, determine a first target in the at least one first block Block, the weight value of the first target block is greater than the weight value of other blocks in the at least one first block; according to the first target block and the initial focus area, the first Candidate focus area, the first candidate focus area is composed of the first target block and the initial focus area.
- the candidate focus area further includes a second candidate focus area
- the processor 701 when the processor 701 is used to obtain the candidate focus area of the preview image, perform the following operations: The weight value of at least one second block adjacent to the region, a second target block is determined in the at least one second block, and the weight value of the second target block is greater than the at least one second block Weight values of other blocks in the middle; according to the second target block and the first candidate focus area, the second candidate focus area is obtained, and the second candidate focus area is composed of the second target block and The first candidate focus area composition.
- the processor 701 is further configured to determine whether the ratio between the number of blocks included in the first candidate focus area and the number of blocks included in the preview image is less than a preset ratio; if so, , Triggering the execution of the step of determining a second target block in the at least one second block based on the weight value of the at least one second block adjacent to the first candidate focus area.
- the processor 701 is further configured to: determine a working mode in the process of controlling the camera to obtain the preview image; if the working mode is a preset mode, trigger the execution of the The step of determining a second target block in the at least one second block with a weight value of at least one second block adjacent to the first candidate focus area.
- the preset mode includes a dual lens mode.
- the weight value of each block is set based on the position of the initial focus area in the preview image and the image composition rule; wherein, the plurality of blocks are located in the preview image.
- the weight value of the block at the edge of the image is smaller than the weight value of the block at the non-edge position of the preview image, and the weight value of each block is negatively related to the distance between the corresponding block and the center of the preview image .
- the weight value of each block is set based on the semantic segmentation data and the position of the initial focus area in the preview image; wherein, the weight value of the initial focus area is the same as that of the initial focus area.
- the weight value of a semantic block is greater than the weight value of a block having semantics different from the initial focus area, and the weight value of each block and the distance between the corresponding block and the center of the initial focus area are negative Related.
- the processor 701 performs the following operations when performing contrast focusing processing on the photographing device according to the candidate focus area: if the first candidate focus area satisfies the contrast focus condition, Then, perform contrast focusing processing on the photographing device according to the first candidate focus area to obtain the target position of the focus motor; if the first candidate focus area does not meet the contrast and focus conditions, then according to the second candidate focus area The candidate focus area performs contrast focus processing on the shooting device to obtain the target position of the focus motor.
- the focus motor corresponds to a plurality of adjustment positions
- the preview image is acquired by the photographing device when the focus motor is in each adjustment position.
- the processor 701 is further configured to: perform reference value calculation on the initial focus area of each preview image to obtain multiple initial focus reference values corresponding to the initial focus area; If the initial focus reference value does not meet the reference value condition indicated by the focus contrast condition, it is determined that the initial focus area does not meet the contrast focus condition.
- the processor 701 is further configured to store a plurality of initial focus reference values corresponding to the initial focus area, a plurality of first focus reference values corresponding to the first candidate focus area, and the first focus area.
- the processor 701 when the processor 701 performs contrast focusing processing on the photographing device according to the first candidate focus area to obtain the target position of the focusing motor, the processor 701 performs the following operations: Acquire a target focus reference value from a focus reference value, and acquire a target preview image corresponding to the target focus reference value from the plurality of preview images; the adjustment position of the focus motor when the target preview image is taken Determined as the target position of the focus motor.
- the processor 701 is further configured to: detect whether the focus object corresponding to the initial focus area is a preset type of shooting object that requires multiple focus areas for focus processing; if so, trigger the execution of the acquisition The step of previewing the candidate focus area of the image; if not, perform focus processing on the photographing device based on the initial focus area.
- the embodiment of the present invention controls the camera to acquire the preview image and determines the initial focus area of the preview image when the camera is focused; if the initial focus area does not meet the contrast and focus conditions, the initial focus area is expanded to obtain the candidate focus area, Further, performing contrast focusing processing on the photographing device according to the candidate focus area, realizes that when the initial focusing area does not meet the contrast focusing condition, the focusing processing is performed on the photographing device in a larger range, which can improve the focus success rate.
- the program can be stored in a computer readable storage medium, and the program can be stored in a computer readable storage medium. During execution, it may include the procedures of the above-mentioned method embodiments.
- the storage medium may be a magnetic disk, an optical disc, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM), etc.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Studio Devices (AREA)
- Automatic Focus Adjustment (AREA)
Abstract
A focusing method for a photographing apparatus, an image processing device and a storage medium. Said method comprises: controlling a photographing apparatus to acquire a preview image (S101); determining an initial focusing area of the preview image (S102); and if the initial focusing area does not satisfy a contrast detection auto focus condition, expanding the initial focusing area to obtain a candidate focusing area, and performing, according to the candidate focusing area, contrast detection auto focus processing on the photographing apparatus (S103). By means of said method, the focusing success rate of the photographing apparatus can be improved.
Description
本发明涉及通信技术领域,尤其涉及一种拍摄装置的对焦方法、图像处理设备及存储介质。The present invention relates to the field of communication technology, in particular to a focusing method, image processing equipment and storage medium of a photographing device.
在采用拍摄装置拍摄图像时,为了得到清晰的图像必不可少的步骤就是对焦,所谓对焦是指通过拍摄装置对焦电机变动物距和相距的位置,使被拍物成像清晰的过程。目前常用的对焦方法包括对比度对焦(Contrast Detection Auto Focus,CDAF)(或称为反差对焦)顾名思义对比度对焦是基于对比度检测进行对焦的。具体来说,对比度对焦是假设对焦成功后相邻像素点的对比度最大。在实际应用中,基于CDAF对低对比度较的拍摄物体(比如白云、白墙等)对焦时,可能容易拍摄物体上个像素点之间对比度差异不大,导致对焦失败,从而导致拍摄得到的图像不清晰。因此,在图像拍摄时如何提高对拍摄装置对焦的成功率成为研究的热点问题。When using a photographing device to take an image, the indispensable step in order to obtain a clear image is focusing. The so-called focusing refers to the process of changing the distance and distance of the object through the focusing motor of the photographing device to make the image of the object clear. Currently commonly used focusing methods include Contrast Detection Auto Focus (CDAF) (or called Contrast Focus), as the name implies, contrast focusing is based on contrast detection for focusing. Specifically, the contrast focusing is based on the assumption that the contrast of adjacent pixels is the largest after the focusing is successful. In practical applications, when focusing on low-contrast objects (such as white clouds, white walls, etc.) based on CDAF, it may be easy for the contrast difference between the pixels on the object to be small, resulting in focus failure and resulting in the captured image Not clear. Therefore, how to improve the success rate of focusing on the camera during image shooting has become a hot issue of research.
发明内容Summary of the invention
本发明实施例提供了一种拍摄装置的对焦方法、图像处理设备及存储介质,可以提高拍摄装置的对焦成功率。The embodiment of the present invention provides a focusing method, image processing equipment and storage medium of a photographing device, which can improve the focusing success rate of the photographing device.
第一方面,本发明实施例提供了一种拍摄装置的对焦方法,其特征在于,包括:In a first aspect, an embodiment of the present invention provides a focusing method of a photographing device, which is characterized in that it includes:
控制拍摄装置获取预览图像;Control the camera to obtain the preview image;
确定所述预览图像的初始对焦区域;Determining the initial focus area of the preview image;
如果所述初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,根据所述候选对焦区域对所述拍摄装置进行对比度对焦处理。If the initial focus area does not meet the contrast focus condition, the initial focus area is expanded to obtain a candidate focus area, and the photographing device is subjected to contrast focus processing according to the candidate focus area.
第二方面,本发明实施例提供了一种图像处理设备,其特征在于,包括存储器和处理器;In a second aspect, an embodiment of the present invention provides an image processing device, which is characterized in that it includes a memory and a processor;
所述存储器,用于存储程序代码;The memory is used to store program code;
所述处理器,用于调用程序代码,当所述程序代码被执行时,用于执行以下操作:The processor is used to call program code, and when the program code is executed, it is used to perform the following operations:
控制拍摄装置获取预览图像;Control the camera to obtain the preview image;
确定所述预览图像的初始对焦区域;Determining the initial focus area of the preview image;
如果所述初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,根据所述候选对焦区域对所述拍摄装置进行对比度对焦处理。If the initial focus area does not meet the contrast focus condition, the initial focus area is expanded to obtain a candidate focus area, and the photographing device is subjected to contrast focus processing according to the candidate focus area.
相应的,本发明实施例还提供了一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行上述第一方面的拍摄装置的对焦方法。Correspondingly, an embodiment of the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, the computer program includes program instructions, and the program instructions are When executing, the processor is caused to execute the focusing method of the photographing device of the first aspect.
本发明实施例在进行拍摄装置对焦时,控制拍摄装置获取预览图像,并确定预览图像的初始对焦区域;如果该初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,进一步地根据候选对焦区域对所述拍摄装置进行对比度对焦处理,实现了对于初始对焦区域不满足对比度对焦条件时,在更大的范围内对拍摄装置进行对焦处理,可提高对焦成功率。The embodiment of the present invention controls the camera to acquire the preview image and determine the initial focus area of the preview image when the camera is in focus; if the initial focus area does not meet the contrast and focus conditions, the initial focus area is expanded to obtain the candidate focus area, Further performing contrast focusing processing on the photographing device according to the candidate focus area, which realizes that when the initial focusing area does not meet the contrast focusing condition, the focusing processing is performed on the photographing device in a larger range, which can improve the focus success rate.
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following will briefly introduce the drawings that need to be used in the embodiments. Obviously, the drawings in the following description are only some of the present invention. Embodiments, for those of ordinary skill in the art, without creative work, other drawings can be obtained based on these drawings.
图1是本发明实施例提供的一种拍摄装置的对焦方法的流程示意图;FIG. 1 is a schematic flowchart of a focusing method of a photographing device according to an embodiment of the present invention;
图2a是本发明实施例提供的一种获取预览图像的初始对焦区域的示意图;2a is a schematic diagram of obtaining an initial focus area of a preview image according to an embodiment of the present invention;
图2b是本发明实施例提供的另一种获取预览图像的初始对焦区域的示意图;FIG. 2b is another schematic diagram of obtaining an initial focus area of a preview image according to an embodiment of the present invention;
图2c是本发明实施例提供的又一种获取预览图像的初始对焦区域的示意图;2c is another schematic diagram of obtaining an initial focus area of a preview image according to an embodiment of the present invention;
图3是本发明实施例提供的一种对焦电机的调整位置、预览图像以及初始对焦参考值之间的关系示意图;3 is a schematic diagram of the relationship between the adjustment position of the focus motor, the preview image, and the initial focus reference value according to an embodiment of the present invention;
图4是本发明实施例提供的另一种拍摄装置的对焦方法的流程示意图;4 is a schematic flowchart of another focusing method of a photographing device according to an embodiment of the present invention;
图5是本发明实施例提供的一种确定初始对焦区域相邻的第一区块的示意图;FIG. 5 is a schematic diagram of determining a first block adjacent to an initial focus area according to an embodiment of the present invention;
图6a是本发明实施例提供的一种确定各个区块的权重值的示意图;Fig. 6a is a schematic diagram of determining the weight value of each block according to an embodiment of the present invention;
图6b是本发明实施例提供的另一种确定各个区块的权重值的示意图;6b is another schematic diagram of determining the weight value of each block provided by an embodiment of the present invention;
图7是本发明实施例提供的一种图像处理设备的结构示意图。Fig. 7 is a schematic structural diagram of an image processing device provided by an embodiment of the present invention.
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
对焦是通过拍摄装置的光学镜头的折射作用,将拍摄场景中的物体光线聚集在针对拍摄装置镜头中央的图像传感器表面的感光区域,使曝光的图像更清晰的过程,如果对焦不好,拍摄得到的图像会显得很模糊。本发明实施例提供了一种拍摄装置的对焦方案,可以应用在多种拍摄装置(比如数码相机、无人机相机以及手持云台相机)的单次智能对焦AF-s以及多次连续对焦AF-c的应用场景中。由于目前的对比度对焦CDAF是统计用户点对焦区域(也即初始对焦区域)的对比度,如果初始对焦区域内的对焦对象对比度很低,例如白云、白墙等,那么对焦对象的对比度差异可能不大,很容易导致对焦失败。为了解决该问题,本发明实施例基于对比度对焦提出了一种拍摄装置的对焦方案,在检测到初始对焦区域内对焦对象的对比度差异不大时,扩大所述初始对焦区域得到候选对焦区域,以扩大对焦对象区域,在更大范围内计算对焦对象的对比度差异,从而可提高对焦成功率。Focusing is the process of focusing the object light in the shooting scene on the photosensitive area of the image sensor surface in the center of the lens of the shooting device through the refraction of the optical lens of the shooting device to make the exposed image clearer. If the focus is not good, the shooting will be obtained. The image will appear blurry. The embodiment of the present invention provides a focusing solution for a shooting device, which can be applied to a single smart focus AF-s and multiple continuous focus AF of a variety of shooting devices (such as digital cameras, drone cameras, and handheld pan-tilt cameras) -c application scenarios. Since the current contrast focus CDAF is to count the contrast of the user's focus area (that is, the initial focus area), if the contrast of the focus object in the initial focus area is very low, such as white clouds, white walls, etc., the contrast difference of the focus object may not be large , It is easy to cause focus failure. In order to solve this problem, the embodiment of the present invention proposes a focusing scheme for a photographing device based on contrast focusing. When it is detected that the contrast of the focus object in the initial focus area is not much different, the initial focus area is expanded to obtain the candidate focus area. Enlarge the focus target area and calculate the contrast difference of the focus target in a larger range, which can improve the focus success rate.
例如,用户点对焦白墙(也即初始对焦区域包括的对焦对象为白墙),由于白墙的对比度差异不大,可能导致不容易对焦,如果此时采用本发明实施例,在检测到白墙属于低对比度对象或者说检测到初始对焦区域不满足对比度对焦条件时,扩大初始对焦区域得到候选对焦区域,候选对焦区域可包含更多对 焦对象,比如白墙上的插座、灯、贴纸,这些对焦对象的对比度差异较大,基于这些对焦对象可以辅助完成对比度对焦,从而提高对焦成功率。For example, if the user focuses on a white wall (that is, the focus object included in the initial focus area is a white wall), since the contrast of the white wall is not very different, it may be difficult to focus. If the embodiment of the present invention is used at this time, the white wall is detected. When the wall is a low-contrast object or it is detected that the initial focus area does not meet the contrast and focus conditions, expand the initial focus area to obtain a candidate focus area. The candidate focus area can contain more focus objects, such as sockets, lights, stickers, etc. on a white wall. The contrast of the focus objects is quite different. Based on these focus objects, the contrast focus can be assisted to improve the focus success rate.
本发明实施例提供的拍摄装置的对焦方案具体可包括:控制拍摄装置获取预览图像;确定所述预览图像的初始对焦区域;如果所述初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,根据所述候选对焦区域对所述拍摄装置进行对比度对焦处理。实现了对于初始对焦区域不满足对比度对焦条件时,在更大的范围内对拍摄装置进行对焦处理,可提高对焦成功率。The focusing scheme of the photographing device provided by the embodiment of the present invention may specifically include: controlling the photographing device to obtain a preview image; determining the initial focus area of the preview image; if the initial focus area does not meet the contrast and focus conditions, expanding the initial focus A candidate focus area is obtained from the area, and contrast focus processing is performed on the photographing device according to the candidate focus area. When the initial focus area does not meet the contrast and focus conditions, the camera can focus on the camera in a larger range, which can improve the focus success rate.
基于上述的拍摄装置的对焦方案,本发明实施例提供了一种拍摄装置的对焦方法。参考图1,为本发明实施例提供的一种拍摄装置的对焦方法的流程示意图,图1所示的对焦方法可由图像处理设备执行,具体可由图像处理设备的处理器执行,图1所示的对焦方法包括如下步骤:Based on the above-mentioned focusing solution of the photographing device, an embodiment of the present invention provides a focusing method of the photographing device. 1 is a schematic flowchart of a focusing method of a photographing device according to an embodiment of the present invention. The focusing method shown in FIG. 1 may be executed by an image processing device, and specifically may be executed by a processor of the image processing device, as shown in FIG. The focusing method includes the following steps:
步骤S101、控制拍摄装置获取预览图像。Step S101: Control the photographing device to obtain a preview image.
其中,所述拍摄装置可以是数码相机、无人机相机、手持云台相机、手机相机等任意一种可以用于拍摄图像的拍摄装置。所述预览图像是通过所述拍摄装置对拍摄场景中的物体进行拍摄得到的,所述预览图像可以理解为用于对拍摄装置进行对焦的图像,基于预览图像和本发明实施例提供的对焦方法为拍摄装置进行对焦处理后,再控制拍摄装置对拍摄场景内的物体进行拍摄,此时拍摄得到的图像可以是最后输出给用户查看的图像。Wherein, the photographing device may be any photographing device that can be used to photograph images, such as a digital camera, a drone camera, a handheld pan-tilt camera, and a mobile phone camera. The preview image is obtained by shooting an object in the shooting scene by the shooting device, and the preview image may be understood as an image used to focus the shooting device, based on the preview image and the focusing method provided by the embodiment of the present invention After performing the focusing processing for the camera, the camera is controlled to take photos of the objects in the shooting scene. At this time, the image obtained by shooting may be the image finally output to the user for viewing.
由前述可知,本发明实施例提供的对焦方法是基于对比度对焦提出的,所谓对比度对焦也叫反差对焦,是目前最基本的对焦算法,具体实现中,通过移动对焦电机,获取对焦电机在不同调整位置对应的一系列预览图像,然后根据获取的预览图像进行对焦处理。基于此,步骤S101中所述预览图像是拍摄装置在对焦电机处于每个调整位置时获取到的,也就是说预览图像的数量为多个。From the foregoing, it can be seen that the focusing method provided by the embodiment of the present invention is based on contrast focusing. The so-called contrast focusing is also called contrast focusing. It is the most basic focusing algorithm at present. In the specific implementation, the focusing motor can be adjusted in different ways by moving the focusing motor. A series of preview images corresponding to the positions, and then focus processing is performed according to the acquired preview images. Based on this, the preview image in step S101 is acquired by the photographing device when the focus motor is at each adjustment position, that is, the number of preview images is multiple.
步骤S102、确定预览图像的初始对焦区域。Step S102: Determine the initial focus area of the preview image.
其中,所述预览图像为多个预览图像中的任意一个。在一个实施例中,预览图像的初始对焦区域可以是根据用户对拍摄装置输入操作指令的操作位置和初始对焦区域的预设尺寸和形状信息确定的。具体实现中,用户可以通过点 击、双击或者长按拍摄装置或者拍摄装置上的物理按钮等操作指定一个操作位置,图像处理设备选择以该操作位置为中心的预设尺寸和预设形状的区域作为预览图像的初始对焦区域。比如,图像处理设备为拍摄装置设置的初始对焦区域形状为预设尺寸的矩形,当用户在拍摄装置上确定了操作位置后,图像处理设备选择以操作位置为中心的预设尺寸的矩形区域作为预览图像的初始对焦区域。Wherein, the preview image is any one of a plurality of preview images. In one embodiment, the initial focus area of the preview image may be determined according to the operation position at which the user inputs an operation instruction to the photographing device and the preset size and shape information of the initial focus area. In specific implementation, the user can specify an operating position by clicking, double-clicking, or long-pressing the camera or the physical button on the camera. The image processing device selects an area with a preset size and a preset shape centered on the operating position. The initial focus area of the preview image. For example, the shape of the initial focus area set by the image processing device for the camera is a rectangle with a preset size. After the user determines the operating position on the camera, the image processing device selects a rectangular area of the preset size with the operating position as the center. The initial focus area of the preview image.
举例来说,参考图2a为本发明实施例提供的一种确定预览图像对应的初始对焦区域的示意图,假设图像处理设备预先设置初始对焦区域的大小为长度为A,宽度为B的矩形,用户通过点击操作指定了一个操作位置C,图像处理设备以操作位置C为中心,找到一个长度为A,宽度为B的矩形201,将该矩形201作为预览图像的初始对焦区域。For example, referring to FIG. 2a is a schematic diagram of determining the initial focus area corresponding to a preview image provided by an embodiment of the present invention. Assuming that the image processing device presets the size of the initial focus area as a rectangle with length A and width B, the user An operation position C is designated by a click operation, and the image processing device takes the operation position C as the center, finds a rectangle 201 with a length A and a width B, and uses the rectangle 201 as the initial focus area of the preview image.
又一个实施例中,预览图像的初始对焦区域可以是根据用户对拍摄装置的操作指令和预览图像包括的区块确定的。应当理解的,在图像处理时,为了方便处理和提高处理效率,通常情况下会将图像分割成区块,针对每个区块进行相应处理,本发明实施例中在确定预览图像的初始对焦区域时也可以将预览图像划分为多个区块,根据用户的操作指令和预览图像包括的区块确定初始对焦区域。具体实现中,如果用户的操作指令对应的操作位置落在一个区块中间位置上,则可以将该区块(后续该区块称为与初始对焦区域相关的关联区块)确定为预览图像的初始对焦区域;如果用户的操作指令对应的操作位置落在一个区块的非中间位置,则根据与该区块以及与操作位置距离最近的另外一个或多个区块确定初始对焦区域(此处所提及的区块均可称为初始对焦区域相关的关联区块)。可选的,初始对焦区域的尺寸和形状信息可以是预先设定的,在根据与该区块以及与操作位置距离最近的另外一个或多个区块确定初始对焦区域时,可以操作位置为中心,分别截取上述几个区块的一部分组成预览图像的初始对焦区域,In another embodiment, the initial focus area of the preview image may be determined according to the user's operation instruction to the shooting device and the blocks included in the preview image. It should be understood that during image processing, in order to facilitate processing and improve processing efficiency, the image is usually divided into blocks, and corresponding processing is performed for each block. In the embodiment of the present invention, the initial focus area of the preview image is determined At this time, the preview image can also be divided into multiple blocks, and the initial focus area is determined according to the user's operation instructions and the blocks included in the preview image. In specific implementation, if the operation position corresponding to the user's operation instruction falls on the middle position of a block, the block (the subsequent block is referred to as the associated block related to the initial focus area) can be determined as the preview image Initial focus area; if the operation position corresponding to the user's operation instruction falls in a non-middle position of a block, the initial focus area will be determined according to the block and the other one or more blocks closest to the operation position (here The mentioned blocks can all be referred to as the associated blocks related to the initial focus area). Optionally, the size and shape information of the initial focus area can be preset. When the initial focus area is determined according to the block and another block or blocks closest to the operating position, the operating position can be the center , Respectively intercept a part of the above several blocks to form the initial focus area of the preview image,
举例来说,参考图2b和图2c,为本发明实施例提供的另一种获取预览图像的初始对焦区域的示意图,假设图像处理设备将预览图像等分为多个区块,每个区块为AxB的矩形。预先设定初始对焦区域的尺寸和形状与一个区块的尺寸和形状相同。如果用户输入的操作位置位于图2b所示的D位置处,可见该操作位置位于区块202的中间,则图像处理设备可以将区块202作为预览图 像的初始对焦区域。如果用户输入的操作位置位于图2c所示的区块202的E位置处,则可以根据区块202和操作位置最近的区块203确定初始对焦区域。具体实现中,可以操作位置E作为中心,分别截取区块202和区块203的一部分组成初始对焦区域。For example, referring to FIGS. 2b and 2c, which are another schematic diagrams of obtaining the initial focus area of a preview image provided by an embodiment of the present invention, it is assumed that the image processing device divides the preview image into multiple blocks, and each block It is an AxB rectangle. The size and shape of the initial focus area are set in advance to be the same as the size and shape of a block. If the operating position input by the user is located at the D position shown in FIG. 2b, it can be seen that the operating position is located in the middle of the block 202, and the image processing device can use the block 202 as the initial focus area of the preview image. If the operation position input by the user is located at the position E of the block 202 shown in FIG. 2c, the initial focus area can be determined according to the block 202 and the block 203 with the closest operation position. In a specific implementation, the position E can be operated as the center, and a part of the block 202 and the block 203 can be respectively intercepted to form the initial focus area.
在其他实施例中,图像处理设备可以根据拍摄场景中的物体自动为预览图像设置一个初始对焦区域。比如,图像处理设备将预览图像划分为多个区块后,选择预览图像中间一个或多个区块组成初始对焦区域,或者选择图像中具有代表意义的几个区块(比如包括人物的区块)作为初始对焦区域。In other embodiments, the image processing device may automatically set an initial focus area for the preview image according to the objects in the shooting scene. For example, after the image processing device divides the preview image into multiple blocks, select one or more blocks in the middle of the preview image to form the initial focus area, or select several blocks with representative meaning in the image (such as blocks including people). ) As the initial focus area.
步骤S103、如果初始对焦区域不满足对比度对焦条件,则扩大初始对焦区域得到候选对焦区域,并根据候选对焦区域对拍摄装置进行对比度对焦处理。Step S103: If the initial focus area does not meet the contrast focus condition, the initial focus area is expanded to obtain a candidate focus area, and the camera device is subjected to contrast focus processing according to the candidate focus area.
在一个实施例中,初始对焦区域满足对比度对焦条件可以指初始对焦区域对应的多个初始对焦参考值满足对比度条件指示的参考值条件,所述多个初始对焦参考值满足对比度指示的参考值条件可以包括以下一种或多种:多个初始对焦参考值中存在一个峰值,各个初始对焦参考值大于参考阈值或者存在一定数量的初始对焦参考值大于参考阈值、最大值与最小值之差大于差值阈值。其中,所述初始对焦区域对应的多个初始对焦参考值,也可以称为AF统计值(也叫反差值,或者AF评价函数结果)是对每个预览图像的初始对焦区域进行参考值计算得到的。In one embodiment, the initial focus area meeting the contrast and focus condition may mean that the multiple initial focus reference values corresponding to the initial focus area satisfy the reference value condition indicated by the contrast condition, and the multiple initial focus reference values satisfy the reference value condition indicated by the contrast condition. It may include one or more of the following: there is a peak among multiple initial focus reference values, each initial focus reference value is greater than the reference threshold, or there are a certain number of initial focus reference values greater than the reference threshold, and the difference between the maximum value and the minimum value is greater than the difference Value threshold. Wherein, the multiple initial focus reference values corresponding to the initial focus area can also be referred to as the AF statistical value (also called the contrast value, or the result of the AF evaluation function), which is obtained by calculating the reference value of the initial focus area of each preview image of.
具体实现中,一般可以采用FIR滤波器、IIR滤波器以及Sobel检边算子对每个预览图像的初始对焦区域进行参考值计算,下面以采用Sobel检边算子为例,介绍如何计算每个预览对象的初始对焦区域对应的初始对焦参考值。假设拍摄装置获取到的预览图像大小为4096x3040,对预览图像进行32x32划分,将预览图像等分成1024个区块,每个区块大小为128x95;获取初始对焦区域相关的关联区块,然后采用Sobel检边算子对关联区块进行边缘检测处理,得到每个关联区块的平方和;进一步的,获取每个关联区块对应的权重,将每个关联区块的平方和与相应的关联区块对应的权重进行相乘并相加,得到的结果即为该预览图像的初始对焦区域对应的初始对焦参考值。In specific implementation, generally FIR filter, IIR filter and Sobel edge detection operator can be used to calculate the reference value of the initial focus area of each preview image. The following uses Sobel edge detection operator as an example to introduce how to calculate each The initial focus reference value corresponding to the initial focus area of the preview object. Assuming that the size of the preview image acquired by the camera is 4096x3040, the preview image is divided into 32x32, and the preview image is equally divided into 1024 blocks, each block size is 128x95; to obtain the associated blocks related to the initial focus area, and then use Sobel The edge detection operator performs edge detection processing on the associated blocks to obtain the sum of squares of each associated block; further, obtains the weight corresponding to each associated block, and compares the sum of squares of each associated block to the corresponding associated area The weights corresponding to the blocks are multiplied and added, and the result obtained is the initial focus reference value corresponding to the initial focus area of the preview image.
其中,每个关联区块对应的权重可以是根据每个关联区块与操作位置的距离确定的,与操作位置距离越近的关联区块对应的权重越大,且各个关联区块 对应的权重之和等于1。例如,在图2b中初始对焦区域相关的关联区块只有区块202,则区块202的权重等于1;在图2c中初始对焦区域相关的关联区块包括区块202和区块203,并且区块202与操作位置的距离更近一点,因此可以设置区块202的权重大于区块203的权重,并且区块202的权重与区块203的权重之和等于1。Among them, the weight corresponding to each associated block can be determined according to the distance between each associated block and the operating position. The closer the distance to the operating position, the greater the weight corresponding to the associated block, and the weight corresponding to each associated block The sum is equal to 1. For example, in Figure 2b, the associated block related to the initial focus area is only block 202, and the weight of block 202 is equal to 1. In Figure 2c, the associated block related to the initial focus area includes block 202 and block 203, and The distance between the block 202 and the operating position is closer, so the weight of the block 202 can be set to be greater than the weight of the block 203, and the sum of the weight of the block 202 and the weight of the block 203 is equal to one.
按照上述方法可以计算出每个预览图像对应的初始对焦区域的初始对焦参考值,由前述可知,每个预览图像是拍摄装置在对焦电机处于每个调整位置时拍摄得到的,因此,初始对焦区域对应的多个初始对焦参考值实质上是指对焦电机位于每个调整位置时对应的初始对焦参考值。为了方便理解,参考图3,为本发明实施例提供的一种对焦电机所述的调整位置、预览图像以及初始对焦参考值之间的关系示意图。在图3中301表示拍摄装置,302表示拍摄场景,假设对焦电机的调整位置包括位置1、位置2以及位置3,每当对焦电机处于一个新的调整位置时,控制拍摄装置获取一张预览图像,因此可以得到预览图像1、预览图像2以及预览图像3。每个预览图像的初始对焦区域相同,均为长度为A,宽度为B的矩形。然后图像处理设备按照上述方法计算每张预览图像对应的初始对焦区域的初始对焦参考值,得到初始对焦参考值1、初始对焦参考值2以及初始对焦参考值3,这三个初始对焦参考值称为初始对焦区域对应的初始对焦参考值。According to the above method, the initial focus reference value of the initial focus area corresponding to each preview image can be calculated. From the foregoing, it can be seen that each preview image is taken by the camera when the focus motor is at each adjustment position. Therefore, the initial focus area The corresponding multiple initial focus reference values essentially refer to the corresponding initial focus reference values when the focus motor is located at each adjustment position. For ease of understanding, refer to FIG. 3, which is a schematic diagram of the relationship between the adjustment position, the preview image, and the initial focus reference value of a focus motor according to an embodiment of the present invention. In Figure 3, 301 represents the camera, and 302 represents the shooting scene. Assuming that the adjustment position of the focus motor includes position 1, position 2, and position 3. When the focus motor is in a new adjustment position, the camera is controlled to obtain a preview image , So preview image 1, preview image 2, and preview image 3 can be obtained. The initial focus area of each preview image is the same, which is a rectangle with length A and width B. Then the image processing device calculates the initial focus reference value of the initial focus area corresponding to each preview image according to the above method, and obtains the initial focus reference value 1, the initial focus reference value 2, and the initial focus reference value 3. These three initial focus reference values are called Is the initial focus reference value corresponding to the initial focus area.
在本发明实施例中,步骤S103可包括以下两种实施例方式:In the embodiment of the present invention, step S103 may include the following two embodiments:
第一种:在获取到初始对焦区域后可以首先判断初始对焦区域是否满足对比度对焦条件,在初始对焦区域满足对比度对焦条件的情况下,根据初始对焦区域对拍摄装置进行对比度对焦处理;在初始对焦区域不满足对比度对焦条件的情况下,扩大初始对焦区域得到候选对焦区域,并根据候选对焦区域对拍摄装置进行对比度对焦处理。这样一来,如果初始对焦区域满足对比度对焦条件,则可不执行扩大初始对焦区域得到候选对焦区域的步骤,可以节省图像处理设备的一部分功耗开销。The first type: After the initial focus area is obtained, it can be judged whether the initial focus area meets the contrast and focus conditions. When the initial focus area meets the contrast and focus conditions, the camera is subjected to contrast focus processing according to the initial focus area; When the area does not meet the contrast and focus conditions, the initial focus area is expanded to obtain a candidate focus area, and the camera device is subjected to contrast focus processing according to the candidate focus area. In this way, if the initial focus area meets the contrast and focus conditions, the step of expanding the initial focus area to obtain a candidate focus area may not be performed, which can save part of the power consumption of the image processing device.
第二种:获取到初始对焦区域后,可以扩大初始对焦区域得到候选对焦区域,然后根据初始对焦区域和候选对焦区域对拍摄装置进行对焦处理。这样一来,在根据初始对焦区域对拍摄装置进行对焦处理失败后,可不用执行获取候选对焦区域的步骤,直接根据候选对焦区域继续对拍摄装置进行对焦处理,节 省了对焦处理所花费的时间,提高对焦效率。在实际应用中,可以根据需要选择上述任一种对焦处理过程进行对焦处理,本发明实施例中不做限定。The second type: After the initial focus area is obtained, the initial focus area can be expanded to obtain the candidate focus area, and then the camera is focused on the camera according to the initial focus area and the candidate focus area. In this way, after the camera fails to focus on the camera based on the initial focus area, the step of obtaining the candidate focus area can be omitted, and the camera can continue to focus on the camera based on the candidate focus area, which saves the time spent on focus processing. Improve focusing efficiency. In practical applications, any of the above-mentioned focusing processing procedures can be selected for focusing processing as required, which is not limited in the embodiment of the present invention.
其中,所述根据候选对焦区域对所述拍摄装置进行对比度对焦处理的实施方式可以为:根据每个预览图像的候选对焦区域对应的候选对焦参考值找到一个对焦电机的目标位置,当对焦电机处于该目标位置时,拍摄装置可以拍摄得到较为清晰的图像。对于具体如何根据候选对焦区域对拍摄装置进行对比度对焦处理将在后面的实施例中具体介绍。Wherein, the implementation manner of performing contrast focusing processing on the photographing device according to the candidate focus area may be: finding a target position of the focus motor according to the candidate focus reference value corresponding to the candidate focus area of each preview image, and when the focus motor is at At this target position, the camera can take a clearer image. How to perform contrast focusing processing on the shooting device according to the candidate focus area will be described in detail in the following embodiments.
本发明实施例在进行拍摄装置对焦时,控制拍摄装置获取预览图像,并确定预览图像的初始对焦区域;如果该初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,进一步地根据候选对焦区域对所述拍摄装置进行对比度对焦处理,实现了对于初始对焦区域不满足对比度对焦条件时,在更大的范围内对拍摄装置进行对焦处理,可提高对焦成功率。The embodiment of the present invention controls the camera to acquire the preview image and determine the initial focus area of the preview image when the camera is in focus; if the initial focus area does not meet the contrast and focus conditions, the initial focus area is expanded to obtain the candidate focus area, Further performing contrast focusing processing on the photographing device according to the candidate focus area, which realizes that when the initial focusing area does not meet the contrast focusing condition, the focusing processing is performed on the photographing device in a larger range, which can improve the focus success rate.
基于上述的拍摄装置的对焦方法,本发明实施例还提供了另一种拍摄装置的对焦方法,参考图4,为本方实施例提供的另一种拍摄装置的对焦方法的流程示意图。图4所示的对焦方法可由图像处理设备执行,具体可由图像处理设备的处理器执行,图4所示的对焦方法可包括以下步骤:Based on the above-mentioned focusing method of a photographing device, an embodiment of the present invention also provides another focusing method of a photographing device. Refer to FIG. 4, which is a schematic flowchart of another focusing method of a photographing device provided by this embodiment. The focusing method shown in FIG. 4 may be executed by an image processing device, and specifically may be executed by a processor of the image processing device. The focusing method shown in FIG. 4 may include the following steps:
步骤S401、控制拍摄装置获取多个预览图像,每个预览图像是对焦电机处于一个调整位置时获取到的。Step S401: Control the photographing device to obtain a plurality of preview images, each of which is obtained when the focus motor is in an adjustment position.
步骤S402、确定每个预览图像的初始对焦区域。Step S402: Determine the initial focus area of each preview image.
在一个实施例中,步骤S401和步骤S402中包括的一些可行的实施方式可参见图1所示的实施例中相关步骤的描述,在此不再赘述。In an embodiment, for some feasible implementation manners included in step S401 and step S402, reference may be made to the description of the relevant steps in the embodiment shown in FIG. 1, which will not be repeated here.
步骤S403、检测初始对焦区域对应的对焦对象是否需要多对焦区域进行对焦处理的预设类型的拍摄对象。Step S403: Detect whether the focus object corresponding to the initial focus area needs a preset type of shooting object with multiple focus areas for focusing processing.
在一个实施例中,在确定了预览图像的初始对焦区域之后,可以检测所述初始对焦区域对应的对焦对象是否为需要多对焦区域进行对焦处理的预设类型的拍摄对象;如果是,则触发执行如果初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,并根据所述候选对焦区域对所述拍摄装置进行对比度对焦处理的步骤;如果不是,则基于所述初始对焦区域对所述拍摄装置进行对焦处理。其中,预设类型的拍摄对象可以是根据历史的拍 摄经验总结出的,也可以是用户指定的,比如白云、白墙等等。In one embodiment, after the initial focus area of the preview image is determined, it can be detected whether the focus object corresponding to the initial focus area is a preset type of shooting object that requires multiple focus areas for focus processing; if so, trigger If the initial focus area does not meet the contrast and focus conditions, then expand the initial focus area to obtain a candidate focus area, and perform contrast focus processing on the photographing device according to the candidate focus area; if not, based on the initial focus area The focus area performs focus processing on the photographing device. Among them, the preset type of shooting objects can be summarized based on historical shooting experience, or can be specified by the user, such as white clouds, white walls, and so on.
这样一来,如果初始对焦区域对应的对焦对象是不需要多对焦区域进行对焦的拍摄对象,则可以不执行步骤S403-步骤S405,执行根据初始对焦区域便可对拍摄装置进行对象处理;在初始对焦区域的对焦对象需要多对焦区域对焦时,再执行步骤S403-步骤S405,可以有效的节省图像处理设备的功耗开销,提高对焦处理效率。In this way, if the focus object corresponding to the initial focus area is a subject that does not require multiple focus areas for focusing, step S403-Step S405 may not be executed, and the object processing can be performed on the camera according to the initial focus area; When the focus object in the focus area needs to be focused in multiple focus areas, step S403 to step S405 are executed again, which can effectively save the power consumption of the image processing device and improve the focus processing efficiency.
步骤S404、若是,则如果初始对焦区域不满足对比度对焦条件,则扩大初始对焦区域得到候选对焦区域,候选对焦区域包括第一候选对焦区域和第二候选对焦区域。Step S404, if yes, if the initial focus area does not meet the contrast focus condition, the initial focus area is expanded to obtain a candidate focus area, and the candidate focus area includes the first candidate focus area and the second candidate focus area.
在一个实施例中,候选对焦区域可以包括第一候选对焦区域,所述扩大初始对焦区域得到候选对焦区域的实施方式可以为:对所述预览图像进行区块划分得到多个区块,并获取每个区块的权重值;基于与所述初始对焦区域相邻的至少一个第一区块的权重值,在所述至少一个第一区块中确定出第一目标区块,所述第一目标区块的权重值大于所述至少一个第一区块中其他区块的权重值;根据所述第一目标区块和所述初始对焦区域得到所述第一候选对焦区域。其中,所述第一目标区块的数量可以为一个或多个,根据所述第一目标区块和所述初始对焦区域得到第一候选对焦区域可以是将第一目标区块和初始对焦区域组合在一起构成第一候选对焦区域。In an embodiment, the candidate focus area may include a first candidate focus area, and the implementation manner of expanding the initial focus area to obtain the candidate focus area may be: partition the preview image to obtain multiple blocks, and obtain The weight value of each block; based on the weight value of at least one first block adjacent to the initial focus area, a first target block is determined in the at least one first block, and the first The weight value of the target block is greater than the weight values of other blocks in the at least one first block; the first candidate focus area is obtained according to the first target block and the initial focus area. Wherein, the number of the first target block may be one or more, and obtaining the first candidate focus area according to the first target block and the initial focus area may be the combination of the first target block and the initial focus area They are combined together to form the first candidate focus area.
在一个实施例中,第一目标区块的数量可以为至少一个,所述第一目标区块的数量可以是图像处理设备根据初始对焦区域的区块数量和第一候选对焦区域的区块数量确定的。具体实现中,图像处理设备可以设置当对初始对焦区域进行一次扩大处理(也可以称为将初始对焦区域扩大一级)得到第一候选对焦区域时,第一候选对焦区域的区块数量,然后根据第一候选对焦区域的区块数量和初始对焦区域的区块数量确定第一目标区块的数量。比如图像处理设备设置初始对焦区域包括1x1个区块,对初始对焦区域进行一次扩大处理得到第一候选对焦区域包括3x3个区块,则第一目标区块的数量应该为9-1=8个。In one embodiment, the number of the first target block may be at least one, and the number of the first target block may be based on the number of blocks of the initial focus area and the number of blocks of the first candidate focus area by the image processing device. definite. In a specific implementation, the image processing device can set the number of blocks in the first candidate focus area when the initial focus area is expanded once (also referred to as expanding the initial focus area by one level) to obtain the first candidate focus area, and then The number of first target blocks is determined according to the number of blocks in the first candidate focus area and the number of blocks in the initial focus area. For example, the image processing device sets the initial focus area to include 1x1 blocks, and performs an expansion process on the initial focus area to get the first candidate focus area to include 3x3 blocks, then the number of first target blocks should be 9-1=8 .
在一个实施例中,如果第一目标区块的数量为一个,则在所述至少一个第一区块中确定出第一目标区块的实施方式可以为:从至少一个第一区块中选择权重值最大的第一区块作为第一目标区块;如果第一目标区块的数量为至少两个,则在所述至少一个第一区块中确定出第一目标区块的实施方式为:将至少 一个第一区块中各个第一区块按照权重值由大到小排序,在排列后的第一区块中由前向后依次选择与第一目标区块的数量相同的第一区块,将选择的第一区块作为第一目标区块。In an embodiment, if the number of the first target block is one, the implementation manner for determining the first target block in the at least one first block may be: selecting from the at least one first block The first block with the largest weight value is used as the first target block; if the number of first target blocks is at least two, the implementation of determining the first target block in the at least one first block is : Sort each first block in at least one first block in ascending order of weight value, and select the first block with the same number as the first target block from front to back in the first block after the arrangement. Block, the selected first block is used as the first target block.
在一个实施例中,与初始对焦区域相邻的至少一个第一区块可以包括与初始对焦区域直接相邻的直接相邻区块和与初始对焦区域间接相邻的间接相邻区域。其中,如果一个区块与初始对焦区域的边缘区块之间不存在其他区块(这种情况可以简称为相邻步长为0),则称该区块为初始对焦区域的直接相邻区块;如果一个区块与初始对焦区域的边缘区块之间存在其他区块(这种情况下,相邻步长等于其他区块的数量,比如存在2个其他区块,则相邻步长为2),则称该区块为初始对焦区域的间接相邻区块。举例来说,如图5中501表示预览图像,预览图像包括多个区块,假设502表示初始对焦区域,该初始对焦区域由3x3个区块组成,区块A和区块B为两个位于初始对焦区域边缘的区块,区块C和区块A之间不存在其他区块,两个区块直接相邻,则称区块C为初始对焦区域的直接相邻区块。再如区块D与区块A之间存在一个区块C,则区块D可以称为初始对焦区域的间接相邻区块,同理的,区块E和区块F也称为初始对焦区域的间接相邻区块。In one embodiment, the at least one first block adjacent to the initial focus area may include a directly adjacent block directly adjacent to the initial focus area and an indirect adjacent area indirectly adjacent to the initial focus area. Among them, if there is no other block between a block and the edge block of the initial focus area (this situation can be referred to as the adjacent step size is 0), then the block is called the immediate adjacent area of the initial focus area Block; if there are other blocks between a block and the edge block of the initial focus area (in this case, the adjacent step is equal to the number of other blocks, for example, there are 2 other blocks, then the adjacent step 2), the block is called an indirect adjacent block of the initial focus area. For example, as shown in Figure 5, 501 represents a preview image, the preview image includes multiple blocks, suppose 502 represents the initial focus area, the initial focus area is composed of 3x3 blocks, block A and block B are two located in For the block at the edge of the initial focus area, there are no other blocks between the block C and the block A, and the two blocks are directly adjacent, then the block C is called the directly adjacent block of the initial focus area. If there is a block C between block D and block A, block D can be called an indirect adjacent block of the initial focus area. Similarly, block E and block F are also called initial focus The indirect adjacent block of the area.
基于上述,所述与初始对焦区域相邻的至少一个第一区块可以指预览图像中除去初始对焦区域包括的区块的剩余区块中在一定相邻步长内与初始对焦区域相邻的区块,该相邻步长具体为多少可以依据图像处理设备设置的第一候选对焦区域包括的区块数量、形状以及初始对焦区域包括的区块数量和形状确定。比如,初始对焦区块包括的区块数量为1x1,形状为矩形,第一候选对焦区域包括的区块数量为3x3,形状为矩形,则相邻步长可以设置为0-1,可以就是说将与初始对焦区域的边缘区块之间相邻步长为0和相邻步长为1的区块均确定为初始对焦区域相邻的第一区块。Based on the above, the at least one first block adjacent to the initial focus area may refer to the remaining blocks in the preview image excluding the blocks included in the initial focus area, which are adjacent to the initial focus area within a certain adjacent step. For blocks, the specific adjacent step length may be determined according to the number and shape of blocks included in the first candidate focus area set by the image processing device, and the number and shape of blocks included in the initial focus area. For example, if the number of blocks included in the initial focus area is 1x1, the shape is rectangular, and the number of blocks included in the first candidate focus area is 3x3, and the shape is rectangular, the adjacent step length can be set to 0-1, that is to say A block with an adjacent step length of 0 and an adjacent step length of 1 between the edge block of the initial focus area is determined as the first block adjacent to the initial focus area.
在一个实施例中,上述确定第一候选对焦区域的过程中,所述对预览图像进行区块划分可以是图像处理设备调用自动对焦统计AF stat模块执行的,AF stat模块可以默认对预览图像进行区块划分的划分规则,所述划分规则可以包括用于区块划分的窗口尺寸,划分后每个区块的尺寸等。In one embodiment, in the above process of determining the first candidate focus area, the block division of the preview image may be performed by the image processing device calling the AF stat module for auto-focus statistics, and the AF stat module may perform the preview image on the preview image by default. The division rule of the block division, the division rule may include the window size used for the block division, the size of each block after division, and so on.
在一个实施例中,上述预览图像中每个区块的权重值可以是根据初始对焦区域在所述预览图像中的位置和图像构图规则设置的。应当理解的,拍摄场景 中的物体包括拍摄主体和拍摄背景,用户在使用拍摄装置拍摄时往往更多关注拍摄主体,图像构图规则可以包括尽可能保证拍摄主体位于拍摄得到的图像的中心,因此为了保证拍摄得到的图像中拍摄主体是更为清晰的,可以尽可能向存在拍摄主体的区域(也即图像中心)扩大初始对焦区域得到候选对焦区域,以便于根据该候选对焦区域对拍摄装置对焦处理后,拍摄装置拍摄的图像中拍摄主体更为清晰。In an embodiment, the weight value of each block in the preview image may be set according to the position of the initial focus area in the preview image and the image composition rule. It should be understood that the objects in the shooting scene include the shooting subject and the shooting background. Users often pay more attention to the shooting subject when shooting with the shooting device. The image composition rules may include ensuring that the shooting subject is located in the center of the captured image as much as possible. To ensure that the subject in the captured image is clearer, the initial focus area can be expanded as far as possible to the area where the subject exists (that is, the center of the image) to obtain the candidate focus area, so as to facilitate the focus processing of the camera based on the candidate focus area Later, the subject in the image captured by the camera is clearer.
基于上述描述,为了达到上述目的,在根据初始对焦区域中的位置和图像构图规则设置每个区块的权重值后,使得每个区块的权重值满足以下:所述多个区块中位于所述预览图像边缘位置的区块的权重值小于,位于所述预览图像非边缘位置的区块的权重值,所述每个区块的权重值和相应区块与所述预览图像中心的距离成负相关。换句话说,越靠近预览图像中心的区块权重值越大。比如用户的操作位置为预览图像的左上角,则考虑到图像构图规则,边缘往往不在用户的关注范围内,则可为预览图像上处于边缘处的区块设置更小的权重值。Based on the above description, in order to achieve the above purpose, after the weight value of each block is set according to the position in the initial focus area and the image composition rule, the weight value of each block satisfies the following: The weight value of the block at the edge position of the preview image is smaller than the weight value of the block at the non-edge position of the preview image, the weight value of each block and the distance between the corresponding block and the center of the preview image Into a negative correlation. In other words, the closer to the center of the preview image, the greater the weight value of the block. For example, the user's operating position is the upper left corner of the preview image, and considering the image composition rules, the edge is often not within the user's attention range, and a smaller weight value can be set for the edge block on the preview image.
例如,参考图6a是本发明实施例提供的一种确定区块的权重值的示意图,601表示预览图像,假设初始对焦区域为602,603表示预览图像的中心,预览图像被划分为25个区块,下面以25个区块中包括的区块A、区块B、区块C以及区块D为例说明根据初始对焦区域在预览图像中的位置和图像构图规则为各个区块设置权重值后,各个区块的权重值大小关系。由于区块A和区块B位于预览图像的非边缘位置处,区块C和区块D位于预览图像的边缘位置处,因此基于上述,区块C和区块D的权重值均小于区块B的权重值,也均小于区块A的权重值;另外,由图6a中可以看出,区块C距离预览图像中心的距离小于区块D距离预览图像中心的距离,基于权重值和距离预览图像中心的距离成负相关,则区块C的权重值大于区块D的权重值。同理的,区块A距离预览图像中心的距离小于区块B距离预览图像中心的距离,因此区块A的权重值的大于区块B的权重值。基于此,区块A、区块B、区块C以及区块D按照权重值由大到小的顺序为:区块A的权重值>区块B的权重值>区块C的权重值>区块D的权重值。For example, referring to Figure 6a is a schematic diagram of determining the weight value of a block provided by an embodiment of the present invention. 601 represents a preview image, assuming that the initial focus area is 602, and 603 represents the center of the preview image, and the preview image is divided into 25 areas. Blocks, the following takes the block A, block B, block C and block D included in the 25 blocks as examples to illustrate the setting of the weight value for each block according to the position of the initial focus area in the preview image and the image composition rules After that, the relationship between the weight value of each block. Since block A and block B are located at the non-edge position of the preview image, block C and block D are located at the edge position of the preview image, so based on the above, the weight values of block C and block D are both smaller than the block The weight value of B is also less than the weight value of block A; in addition, as can be seen from Figure 6a, the distance between block C and the center of the preview image is less than the distance between block D and the center of the preview image, based on the weight value and distance The distance between the center of the preview image is negatively correlated, and the weight value of block C is greater than the weight value of block D. Similarly, the distance between the block A and the center of the preview image is less than the distance between the block B and the center of the preview image, so the weight value of the block A is greater than the weight value of the block B. Based on this, block A, block B, block C, and block D in the descending order of weight value are: weight value of block A> weight value of block B> weight value of block C> The weight value of block D.
在其他实施例中,上述预览图像中每个区块的权重值还可以是基于所述预览图像的语义分割数据和所述初始对焦区域在所述预览图像中的位置设置的。 具体实现中,按照以下条件为各个区块设置权重值:与所述初始对焦区域具有相同语义的区块的权重值大于,与所述初始对焦区域具有不同语义的区块的权重值,且所述每个区块的权重值和相应区块与所述初始对焦区域中心的距离成负相关。应当理解的,初始对焦区域是根据用户输入的操作指令确定的,用户输入操作指令的操作位置应该是存在用户感兴趣的物体,如果按照语义分割数据,将与初始对焦区域具有相同语义的区块设置较高的权重,可以保证在扩大初始对焦区域时,首选将与初始对焦区域具有相同语义的区块添加到初始对焦区域以得到候选对焦区域,这样一来,候选对焦区域中可仍然保留用户感兴趣的物体,进而可保证拍摄得到用户满意的图像,提高用户体验。In other embodiments, the weight value of each block in the preview image may also be set based on the semantic segmentation data of the preview image and the position of the initial focus area in the preview image. In specific implementation, the weight value is set for each block according to the following conditions: the weight value of the block having the same semantics as the initial focus area is greater than the weight value of the block having different semantics from the initial focus area, and The weight value of each block and the distance between the corresponding block and the center of the initial focus area are negatively correlated. It should be understood that the initial focus area is determined according to the operation instructions entered by the user, and the operation position where the user enters the operation instructions should be where there is an object of interest to the user. If the data is segmented according to semantics, it will be a block with the same semantics as the initial focus area. Setting a higher weight can ensure that when expanding the initial focus area, the first choice is to add blocks with the same semantics as the initial focus area to the initial focus area to obtain the candidate focus area. In this way, users can still be retained in the candidate focus area Objects of interest, in turn, can ensure that images satisfactory to the user are captured, and improve user experience.
例如,参考图6b是本发明实施例提供的另一种确定区块的权重值的示意图,604表示预览图像,假设初始对焦区域为605,606表示初始对焦区域的中心,假设预览图像被划分为25个区块,下面以区块A、区块B、区块C为例说明在根据预览图像的语义分割数据和初始对焦区域的位置为各个区块设置了权重值之后,各个区块的权重之间的大小关系。由初始对焦区域可见用户可能感兴趣的物体为人物,区块A和区块B是与人物上的区块,也即区块A和区块B是与初始对焦区域具有相同语义的区块,因此区块A和区块B的权重值均大于区块C的权重值;另外,区块A与初始对焦区域中心的距离小于区块B与初始对焦区域中心的距离,基于上述区块的权重值和相应区块与初始对焦区域中心的距离成负相关可知,区块A的权重值大于区块B的权重值。基于上述,区块A、区块B以及区块C的权重值大小关系为:区块A的权重值>区块B的权重值>区块C的权重值。For example, referring to Figure 6b is another schematic diagram of determining the weight value of a block provided by an embodiment of the present invention. 604 represents a preview image, assuming that the initial focus area is 605, and 606 represents the center of the initial focus area, assuming that the preview image is divided into 25 blocks, the following takes block A, block B, and block C as examples to illustrate the weight of each block after the weight value is set for each block according to the semantic segmentation data of the preview image and the position of the initial focus area The size relationship between. From the initial focus area, it can be seen that the object that the user may be interested in is a person. Block A and Block B are the blocks on the person, that is, Block A and Block B are blocks with the same semantics as the initial focus area. Therefore, the weight values of block A and block B are both greater than the weight value of block C; in addition, the distance between block A and the center of the initial focus area is less than the distance between block B and the center of the initial focus area, based on the weight of the above block The value is negatively correlated with the distance between the corresponding block and the center of the initial focus area. It can be seen that the weight value of block A is greater than the weight value of block B. Based on the above, the relationship between the weight values of block A, block B, and block C is: the weight value of block A>the weight value of block B>the weight value of block C.
在一个实施例中,候选对焦区域除了包括第一候选对焦区域,还可以包括第二候选对焦区域。具体实现中,如果候选对焦区域还包括第二候选对焦区域,则扩大初始对焦区域得到候选对焦区域,还包括:基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块,所述第二目标区块的权重值大于所述至少一个第二区块中其他区块的权重值;根据所述第二目标区块和所述第一候选对焦区域,得到所述第二候选对焦区域,所述第二候选对焦区域由所述第二目标区块和所述第一候选对焦区域组成。In an embodiment, the candidate focus area may include a second candidate focus area in addition to the first candidate focus area. In specific implementation, if the candidate focus area further includes a second candidate focus area, expanding the initial focus area to obtain the candidate focus area further includes: based on a weight value of at least one second block adjacent to the first candidate focus area , Determining a second target block in the at least one second block, and the weight value of the second target block is greater than the weight value of other blocks in the at least one second block; The target block and the first candidate focus area are obtained to obtain the second candidate focus area, and the second candidate focus area is composed of the second target block and the first candidate focus area.
其中,第二目标区块的数量可以为至少一个,所述第二目标区块的数量可以是图像处理设备根据第一候选对焦区域的区块数量和第二候选对焦区域的区块数量确定的。具体实现中,图像处理设备可以设置当对初始对焦区域进行一次扩大处理(也可以称为将初始对焦区域扩大一级)得到第一候选对焦区域时,第一候选对焦区域的区块数量;并设置,继续对第一候选对焦区域进行扩大处理得到第二候选对焦区域时,第二候选对焦区域的区块数量;然后根据第一候选对焦区域的区块数量和第二候选对焦区域的区块数量确定第二目标区块的数量。比如图像处理设备设置第一候选对焦区域包括3x3个区块,第二候选对焦区域包括5x5个区块,则第二目标区块的数量应该为25-9=16个。The number of the second target block may be at least one, and the number of the second target block may be determined by the image processing device according to the number of blocks of the first candidate focus area and the number of blocks of the second candidate focus area. . In a specific implementation, the image processing device may set the number of blocks of the first candidate focus area when the first candidate focus area is obtained by performing an expansion process on the initial focus area (also referred to as expanding the initial focus area by one level); and Set, continue to expand the first candidate focus area to obtain the second candidate focus area, the number of blocks in the second candidate focus area; then according to the number of blocks in the first candidate focus area and the blocks in the second candidate focus area The quantity determines the quantity of the second target block. For example, if the image processing device sets the first candidate focus area to include 3x3 blocks and the second candidate focus area to include 5x5 blocks, the number of second target blocks should be 25-9=16.
在一个实施例中,基于前述对所述初始对焦区域相邻的至少一个区块的介绍,所述第一候选对焦区域相邻的至少一个第二区块可包括与第一候选对焦区域直接相邻的直接相邻区块以及和第一候选对焦区域间接相邻的间接相邻区块。换句话说,所述第一候选对焦区域相邻的至少一个第二区块是指预览图像中除去第一候选对焦区域中区块的剩余区块中与第一候选对焦区域在一定相邻步长内相邻的区块。该相邻步长具体为多少可以依据图像处理设备设置的第一候选对焦区域包括的区块数量、形状以及第二候选对焦区域包括的区块数量和形状确定的。In one embodiment, based on the foregoing introduction of at least one block adjacent to the initial focus area, the at least one second block adjacent to the first candidate focus area may include a block directly adjacent to the first candidate focus area. The adjacent direct adjacent block and the indirect adjacent block indirectly adjacent to the first candidate focus area. In other words, the at least one second block adjacent to the first candidate focus area refers to the remaining blocks in the preview image excluding the blocks in the first candidate focus area that are in a certain step adjacent to the first candidate focus area. Neighboring blocks within the long. The specific size of the adjacent step may be determined according to the number and shape of the blocks included in the first candidate focus area set by the image processing device, and the number and shape of the blocks included in the second candidate focus area set by the image processing device.
应当理解的,候选对焦区域的数量越多,候选对焦区域的尺寸越大,对拍摄装置进行对焦处理时对焦成功率越高,但是由于不同拍摄装置的产品形态不同,视场角大小不同、工作模式不同以及区块划分规则不同,扩大初始对焦区域得到的候选对焦区域数量不同。对于某些拍摄装置而言,可能受到视场角或者工作模式的影响,可以将初始对焦区域扩大两级得到第一候选对焦区域和第二候选对焦区域;对于某些拍摄装置而言,可能只允许将初始对焦区域扩大一级得到第一候选对焦区域。因此,为了准确地扩大初始对焦区域得到候选对焦区域,在每次对初始对焦区域进行一次扩大得到第一候选对焦区域后,可判断拍摄装置是否满足继续扩大的条件,如果满足,则继续对初始对焦区域进行扩大得到第二候选对焦区域。It should be understood that the larger the number of candidate focus areas and the larger the size of the candidate focus areas, the higher the focus success rate when focusing on the camera. However, due to the different product forms of different camera devices, the size of the field of view is different. The number of candidate focus areas obtained by expanding the initial focus area is different due to different modes and different block division rules. For some shooting devices, it may be affected by the angle of view or working mode. The initial focus area can be expanded by two stages to obtain the first candidate focus area and the second candidate focus area; for some shooting devices, it may only It is allowed to expand the initial focus area by one level to obtain the first candidate focus area. Therefore, in order to accurately expand the initial focus area to obtain the candidate focus area, after each expansion of the initial focus area to obtain the first candidate focus area, it can be determined whether the camera meets the conditions for continuing expansion. The focus area is expanded to obtain the second candidate focus area.
在一个实施例中,基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块之前,还包括:判断所述第一候选对焦区域包括的区块数量与所述预览图像包括的区块数量之间 的比值是否小于预设比值;如果是,则触发执行所述基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块的步骤。例如,假设拍摄装置对预览图像进行区块划分得到15x15个区块时,如果初始对焦区域为3x3=9个,对初始对焦区域扩大得到第一候选对焦区域为5x5=25个,此时第一候选对焦区域的区块数量与预览图像的区块数量比值为25/225=11%,如果预先设置预设比值为等于或者小于11%比如10%则确定当前拍摄装置不适合继续对初始对焦区域扩大。再如,在上述例子中,如果将预览图像划分为32x32个区块,则第一候选对焦区域的区块数量与预览图像的区块数量比值为25/1024=2.4%,2.4%小于上述预设比值,则可继续对初始对焦区域进行扩大,得到第二候选对焦区域。In one embodiment, based on the weight value of at least one second block adjacent to the first candidate focus area, before determining the second target block in the at least one second block, the method further includes: determining Whether the ratio between the number of blocks included in the first candidate focus area and the number of blocks included in the preview image is less than a preset ratio; The step of determining the second target block in the at least one second block is the weight value of the adjacent at least one second block. For example, suppose that when the camera divides the preview image into 15x15 blocks, if the initial focus area is 3x3=9, the first candidate focus area is 5x5=25 by expanding the initial focus area. At this time, the first candidate focus area is 5x5=25. The ratio of the number of blocks in the candidate focus area to the number of blocks in the preview image is 25/225 = 11%. If the preset ratio is set to be equal to or less than 11%, such as 10%, it is determined that the current camera is not suitable for continuing to focus on the initial focus area. expand. For another example, in the above example, if the preview image is divided into 32x32 blocks, the ratio of the number of blocks in the first candidate focus area to the number of blocks in the preview image is 25/1024=2.4%, 2.4% is less than the above prediction If the ratio is set, the initial focus area can be continuously expanded to obtain the second candidate focus area.
在其他实施例中,所述基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块之前,还包括:确定在控制所述拍摄装置获取所述预览图像的过程中的工作模式;如果所述工作模式为预设模式,则触发执行所述基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块的步骤。其中,预设工作模式包括双镜头模式,如果拍摄装置的工作模式为双镜头模式时,可以对初始对焦区域进行更多次扩大,得到更多的候选对焦区域,甚至可以扩大到整个预览图像。In other embodiments, based on the weight value of at least one second block adjacent to the first candidate focus area, before the second target block is determined in the at least one second block, the method further includes : Determine the working mode in the process of controlling the photographing device to obtain the preview image; if the working mode is a preset mode, trigger the execution of the at least one first focus area adjacent to the first candidate focus area. The weight value of the two blocks, the step of determining the second target block in the at least one second block. Among them, the preset working mode includes a dual-lens mode. If the working mode of the shooting device is a dual-lens mode, the initial focus area can be expanded more times to obtain more candidate focus areas, and even the entire preview image can be expanded.
步骤S405、根据候选对焦区域对拍摄装置进行对比度对焦处理。Step S405: Perform contrast and focus processing on the camera according to the candidate focus area.
在一个实施例中,所述候选对焦区域包括第一候选对焦区域和第二候选对焦区域,所述根据候选对焦区域对拍摄装置进行对比度对焦处理,包括:如果所述第一候选对焦区域满足所述对比度对焦条件,则根据所述第一候选对焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置;如果所述第一候选对焦区域不满足所述对比度对焦条件,则根据所述第二候选对焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置。In one embodiment, the candidate focus area includes a first candidate focus area and a second candidate focus area, and the performing contrast focus processing on the shooting device according to the candidate focus area includes: if the first candidate focus area satisfies all According to the contrast and focus condition, perform contrast and focus processing on the photographing device according to the first candidate focus area to obtain the target position of the focus motor; if the first candidate focus area does not meet the contrast and focus condition, then Performing contrast focusing processing on the photographing device according to the second candidate focus area to obtain the target position of the focusing motor.
其中,所述第一候选对焦区域满足对比度对焦条件可以指第一候选对焦区域对应的多个第一对焦参考值满足对比度对焦条件指示的参考值条件,也即多个第一对焦参考值中不存在多个峰值,每个第一对焦参考值均大于预设值或者存在一定数量的第一对焦参考值大于参考阈值,最大值与最小值之差大于差值 阈值。其中,第一候选对焦区域对应的多个第一对焦参考值是对每个预览图像的第一候选对焦区域进行参考值计算得到的,具体计算方法可参考图1实施例中计算初始对焦参考值的方法,在此不再赘述。Wherein, the first candidate focus area meeting the contrast and focus condition may mean that the multiple first focus reference values corresponding to the first candidate focus area satisfy the reference value condition indicated by the contrast and focus condition, that is, none of the multiple first focus reference values There are multiple peaks, each of the first focus reference values is greater than a preset value or there are a certain number of first focus reference values that are greater than the reference threshold, and the difference between the maximum value and the minimum value is greater than the difference threshold. Among them, the multiple first focus reference values corresponding to the first candidate focus area are obtained by calculating the reference value of the first candidate focus area of each preview image. For the specific calculation method, refer to the calculation of the initial focus reference value in the embodiment of FIG. 1 The method is not repeated here.
在一个实施例中,所述根据所述第一候选对焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置,包括:从所述多个第一对焦参考值中获取目标对焦参考值,并从所述多个预览图像中获取所述目标对焦参考值对应的目标预览图像;将拍摄所述目标预览图像时所述对焦电机所处的调整位置确定为所述对焦电机的目标位置。其中,所述目标对焦参考值是指多个第一对焦参考值中的最大值。In an embodiment, the performing contrast focusing processing on the photographing device according to the first candidate focus area to obtain the target position of the focusing motor includes: acquiring the target from the plurality of first focus reference values Focus reference value, and obtain a target preview image corresponding to the target focus reference value from the plurality of preview images; determine the adjustment position of the focus motor when the target preview image is taken as the focus motor target location. Wherein, the target focus reference value refers to the maximum value of a plurality of first focus reference values.
在一个实施例中,得到对焦电机的目标位置后确定对拍摄装置的对焦完成,后续在拍摄图像时控制对焦电机在目标位置时拍摄装置进行拍摄,可以得到更为清晰的图像。In one embodiment, after the target position of the focus motor is obtained, it is determined that the focusing of the shooting device is completed, and then the shooting device is controlled to shoot when the focus motor is at the target position when the image is captured, so that a clearer image can be obtained.
本发明实施例中,控制拍摄装置获取多个预览图像,并确定各个预览图像的初始对焦区域;在确定出初始对焦区域的对焦对象为预设类型的拍摄对象的情况下,再执行如果初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到第一候选对焦区域和第二候选对焦区域,进一步地根据第一候选对焦区域和第二候选对焦区域对所述拍摄装置进行对比度对焦处理的步骤,可以节省终端的功耗开销。另外,实现了对于初始对焦区域不满足对比度对焦条件的情况,可以在一个或多个更大的范围内对拍摄装置进行对焦处理,可提高对焦成功率。In the embodiment of the present invention, the shooting device is controlled to acquire multiple preview images, and the initial focus area of each preview image is determined; in the case where it is determined that the focus object in the initial focus area is a preset type of shooting object, if the initial focus is determined If the area does not meet the contrast and focus condition, the initial focus area is expanded to obtain the first candidate focus area and the second candidate focus area, and the photographing device is further subjected to contrast focus processing according to the first candidate focus area and the second candidate focus area The steps can save the power consumption of the terminal. In addition, it is realized that when the initial focus area does not meet the contrast and focus conditions, the camera can be focused on one or more larger ranges, which can improve the focus success rate.
基于上述方法实施例,本发明实施例还提供了一种图像处理设备,所述图像处理设备可以包括拍摄装置,也可以包括在拍摄装置内,或者是独立与拍摄装置的其他设备。参考图7,为本发明实施例提供的一种图像处理设备的结构示意图,图7所示的图像处理设备可至少包括处理器701和存储器702,处理器701和存储器702之间可通过总线703相连接。Based on the foregoing method embodiments, the embodiments of the present invention also provide an image processing device, which may include a photographing device, may also be included in the photographing device, or be other equipment independent of the photographing device. Referring to FIG. 7, which is a schematic structural diagram of an image processing device provided by an embodiment of the present invention, the image processing device shown in FIG. 7 may at least include a processor 701 and a memory 702, and a bus 703 can be used between the processor 701 and the memory 702. Phase connection.
在一个实施例中,存储器702中存储有程序代码,处理器701调用程序代码,当程序代码被执行时,用于执行以下操作:控制拍摄装置获取预览图像;确定所述预览图像的初始对焦区域;如果所述初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,根据所述候选对焦区域对 所述拍摄装置进行对比度对焦处理。In one embodiment, a program code is stored in the memory 702, and the processor 701 calls the program code. When the program code is executed, it is used to perform the following operations: control the camera to obtain the preview image; determine the initial focus area of the preview image If the initial focus area does not meet the contrast and focus conditions, then expand the initial focus area to obtain a candidate focus area, and perform contrast focus processing on the photographing device according to the candidate focus area.
在一个实施例中,所述候选对焦区域包括第一候选对焦区域,所述处理器701在用于获取所述预览图像的候选对焦区域时,执行如下操作:对所述预览图像进行区块划分得到多个区块,并获取每个区块的权重值;基于与所述初始对焦区域相邻的至少一个第一区块的权重值,在所述至少一个第一区块中确定第一目标区块,所述第一目标区块的权重值大于所述至少一个第一区块中其他区块的权重值;根据所述第一目标区块和所述初始对焦区域,得到所述第一候选对焦区域,所述第一候选对焦区域由所述第一目标区块和所述初始对焦区域组成。In one embodiment, the candidate focus area includes a first candidate focus area, and when the processor 701 is used to obtain the candidate focus area of the preview image, perform the following operations: divide the preview image into blocks Obtain multiple blocks, and obtain the weight value of each block; based on the weight value of at least one first block adjacent to the initial focus area, determine a first target in the at least one first block Block, the weight value of the first target block is greater than the weight value of other blocks in the at least one first block; according to the first target block and the initial focus area, the first Candidate focus area, the first candidate focus area is composed of the first target block and the initial focus area.
在一个实施例中,所述候选对焦区域还包括第二候选对焦区域,所述处理器701在用于获取所述预览图像的候选对焦区域时,执行如下操作:基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块,所述第二目标区块的权重值大于所述至少一个第二区块中其他区块的权重值;根据所述第二目标区块和所述第一候选对焦区域,得到所述第二候选对焦区域,所述第二候选对焦区域由所述第二目标区块和所述第一候选对焦区域组成。In one embodiment, the candidate focus area further includes a second candidate focus area, and when the processor 701 is used to obtain the candidate focus area of the preview image, perform the following operations: The weight value of at least one second block adjacent to the region, a second target block is determined in the at least one second block, and the weight value of the second target block is greater than the at least one second block Weight values of other blocks in the middle; according to the second target block and the first candidate focus area, the second candidate focus area is obtained, and the second candidate focus area is composed of the second target block and The first candidate focus area composition.
在一个实施例中,所述处理器701还用于:判断所述第一候选对焦区域包括的区块数量与所述预览图像包括的区块数量之间的比值是否小于预设比值;如果是,则触发执行所述基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块的步骤。In an embodiment, the processor 701 is further configured to determine whether the ratio between the number of blocks included in the first candidate focus area and the number of blocks included in the preview image is less than a preset ratio; if so, , Triggering the execution of the step of determining a second target block in the at least one second block based on the weight value of the at least one second block adjacent to the first candidate focus area.
在一个实施例中,所述处理器701还用于:确定在控制所述拍摄装置获取所述预览图像的过程中的工作模式;如果所述工作模式为预设模式,则触发执行所述基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块的步骤。In an embodiment, the processor 701 is further configured to: determine a working mode in the process of controlling the camera to obtain the preview image; if the working mode is a preset mode, trigger the execution of the The step of determining a second target block in the at least one second block with a weight value of at least one second block adjacent to the first candidate focus area.
在一个实施例中,所述预设模式包括双镜头模式。In one embodiment, the preset mode includes a dual lens mode.
在一个实施例中,所述每个区块的权重值是基于所述初始对焦区域在所述预览图像中的位置和图像构图规则设置的;其中,所述多个区块中位于所述预览图像边缘位置的区块的权重值小于,位于所述预览图像非边缘位置的区块的权重值,所述每个区块的权重值和相应区块与所述预览图像中心的距离成负相 关。In an embodiment, the weight value of each block is set based on the position of the initial focus area in the preview image and the image composition rule; wherein, the plurality of blocks are located in the preview image. The weight value of the block at the edge of the image is smaller than the weight value of the block at the non-edge position of the preview image, and the weight value of each block is negatively related to the distance between the corresponding block and the center of the preview image .
在一个实施例中,所述每个区块的权重值是基于所述语义分割数据和所述初始对焦区域在所述预览图像中的位置设置的;其中,与所述初始对焦区块具有相同语义的区块的权重值大于,与所述初始对焦区域具有不同语义的区块的权重值,且所述每个区块的权重值和相应区块与所述初始对焦区域中心的距离成负相关。In an embodiment, the weight value of each block is set based on the semantic segmentation data and the position of the initial focus area in the preview image; wherein, the weight value of the initial focus area is the same as that of the initial focus area. The weight value of a semantic block is greater than the weight value of a block having semantics different from the initial focus area, and the weight value of each block and the distance between the corresponding block and the center of the initial focus area are negative Related.
在一个实施例中,所述处理器701在所述根据所述候选对焦区域对所述拍摄装置进行对比度对焦处理时,执行如下操作:如果所述第一候选对焦区域满足所述对比度对焦条件,则根据所述第一候选对焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置;如果所述第一候选对焦区域不满足所述对比度对焦条件,则根据所述第二候选对焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置。In one embodiment, the processor 701 performs the following operations when performing contrast focusing processing on the photographing device according to the candidate focus area: if the first candidate focus area satisfies the contrast focus condition, Then, perform contrast focusing processing on the photographing device according to the first candidate focus area to obtain the target position of the focus motor; if the first candidate focus area does not meet the contrast and focus conditions, then according to the second candidate focus area The candidate focus area performs contrast focus processing on the shooting device to obtain the target position of the focus motor.
在一个实施例中,在对焦处理过程中,所述对焦电机对应多个调整位置,所述预览图像是所述拍摄装置在所述对焦电机处于每个调整位置时获取到的。In one embodiment, during the focusing process, the focus motor corresponds to a plurality of adjustment positions, and the preview image is acquired by the photographing device when the focus motor is in each adjustment position.
在一个实施例中,所述处理器701还用于:对每个预览图像的所述初始对焦区域进行参考值计算,得到所述初始对焦区域对应的多个初始对焦参考值;如果所述多个初始对焦参考值不满足对焦对比度条件指示的参考值条件,则确定所述初始对焦区域不满足所述对比度对焦条件。In one embodiment, the processor 701 is further configured to: perform reference value calculation on the initial focus area of each preview image to obtain multiple initial focus reference values corresponding to the initial focus area; If the initial focus reference value does not meet the reference value condition indicated by the focus contrast condition, it is determined that the initial focus area does not meet the contrast focus condition.
在一个实施例中,所述处理器701还用于:存储所述初始对焦区域对应的多个初始对焦参考值、所述第一候选对焦区域对应的多个第一对焦参考值以及所述第二候选对焦区域对应的多个第二对焦参考值,所述第一对焦参考值是对所述每个预览图像的所述第一候选对焦区域进行参考值计算得到的,所述第二对焦参考值是对所述每个预览图像的所述第二候选对焦区域进行参考值计算得到的。In one embodiment, the processor 701 is further configured to store a plurality of initial focus reference values corresponding to the initial focus area, a plurality of first focus reference values corresponding to the first candidate focus area, and the first focus area. A plurality of second focus reference values corresponding to two candidate focus areas, where the first focus reference value is obtained by performing reference value calculation on the first candidate focus area of each preview image, and the second focus reference The value is obtained by performing reference value calculation on the second candidate focus area of each preview image.
在一个实施例中,所述处理器701在根据所述第一候选对焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置时,执行如下操作:从所述多个第一对焦参考值中获取目标对焦参考值,并从所述多个预览图像中获取所述目标对焦参考值对应的目标预览图像;将拍摄所述目标预览图像时所述对焦电机所处的调整位置确定为所述对焦电机的目标位置。In one embodiment, when the processor 701 performs contrast focusing processing on the photographing device according to the first candidate focus area to obtain the target position of the focusing motor, the processor 701 performs the following operations: Acquire a target focus reference value from a focus reference value, and acquire a target preview image corresponding to the target focus reference value from the plurality of preview images; the adjustment position of the focus motor when the target preview image is taken Determined as the target position of the focus motor.
在一个实施例中,所述处理器701还用于:检测所述初始对焦区域对应的对焦对象是否为需要多对焦区域进行对焦处理的预设类型的拍摄对象;如果是,则触发执行获取所述预览图像的候选对焦区域的步骤;如果不是,则基于所述初始对焦区域对所述拍摄装置进行对焦处理。In one embodiment, the processor 701 is further configured to: detect whether the focus object corresponding to the initial focus area is a preset type of shooting object that requires multiple focus areas for focus processing; if so, trigger the execution of the acquisition The step of previewing the candidate focus area of the image; if not, perform focus processing on the photographing device based on the initial focus area.
本发明实施例在进行拍摄装置对焦时,控制拍摄装置获取预览图像,并确定预览图像的初始对焦区域;如果该初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,进一步地根据候选对焦区域对所述拍摄装置进行对比度对焦处理,实现了对于初始对焦区域不满足对比度对焦条件时,在更大的范围内对拍摄装置进行对焦处理,可提高对焦成功率。The embodiment of the present invention controls the camera to acquire the preview image and determines the initial focus area of the preview image when the camera is focused; if the initial focus area does not meet the contrast and focus conditions, the initial focus area is expanded to obtain the candidate focus area, Further, performing contrast focusing processing on the photographing device according to the candidate focus area, realizes that when the initial focusing area does not meet the contrast focusing condition, the focusing processing is performed on the photographing device in a larger range, which can improve the focus success rate.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing relevant hardware through a computer program. The program can be stored in a computer readable storage medium, and the program can be stored in a computer readable storage medium. During execution, it may include the procedures of the above-mentioned method embodiments. Wherein, the storage medium may be a magnetic disk, an optical disc, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM), etc.
以上所揭露的仅为本发明部分实施例而已,当然不能以此来限定本发明之权利范围,因此依本发明权利要求所作的等同变化,仍属本发明所涵盖的范围。The above-disclosed are only some embodiments of the present invention, which of course cannot be used to limit the scope of rights of the present invention. Therefore, equivalent changes made according to the claims of the present invention still fall within the scope of the present invention.
Claims (29)
- 一种拍摄装置的对焦方法,其特征在于,包括:A focusing method of a photographing device, characterized in that it comprises:控制拍摄装置获取预览图像;Control the camera to obtain the preview image;确定所述预览图像的初始对焦区域;Determining the initial focus area of the preview image;如果所述初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,并根据所述候选对焦区域对所述拍摄装置进行对比度对焦处理。If the initial focus area does not meet the contrast focus condition, the initial focus area is expanded to obtain a candidate focus area, and the photographing device is subjected to contrast focus processing according to the candidate focus area.
- 如权利要求1所述的方法,其特征在于,所述候选对焦区域包括第一候选对焦区域,所述扩大所述初始对焦区域得到候选对焦区域,包括:The method according to claim 1, wherein the candidate focus area comprises a first candidate focus area, and the expanding the initial focus area to obtain the candidate focus area comprises:对所述预览图像进行区块划分得到多个区块,并获取每个区块的权重值;Dividing the preview image into blocks to obtain multiple blocks, and obtaining a weight value of each block;基于与所述初始对焦区域相邻的至少一个第一区块的权重值,在所述至少一个第一区块中确定第一目标区块,所述第一目标区块的权重值大于所述至少一个第一区块中其他区块的权重值;Based on the weight value of at least one first block adjacent to the initial focus area, a first target block is determined in the at least one first block, and the weight value of the first target block is greater than the weight value of the first target block. At least one weight value of other blocks in the first block;根据所述第一目标区块和所述初始对焦区域,得到所述第一候选对焦区域,所述第一候选对焦区域由所述第一目标区块和所述初始对焦区域组成。The first candidate focus area is obtained according to the first target block and the initial focus area, and the first candidate focus area is composed of the first target block and the initial focus area.
- 如权利要求2所述的方法,其特征在于,所述候选对焦区域还包括第二候选对焦区域,所述扩大所述初始对焦区域得到候选对焦区域,还包括:3. The method of claim 2, wherein the candidate focus area further comprises a second candidate focus area, and said expanding the initial focus area to obtain the candidate focus area further comprises:基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块,所述第二目标区块的权重值大于所述至少一个第二区块中其他区块的权重值;Based on the weight value of at least one second block adjacent to the first candidate focus area, a second target block is determined in the at least one second block, and the weight value of the second target block is greater than Weight values of other blocks in the at least one second block;根据所述第二目标区块和所述第一候选对焦区域,得到所述第二候选对焦区域,所述第二候选对焦区域由所述第二目标区块和所述第一候选对焦区域组成。According to the second target block and the first candidate focus area, the second candidate focus area is obtained, and the second candidate focus area is composed of the second target block and the first candidate focus area .
- 如权利要求3所述的方法,其特征在于,所述基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第 二目标区块之前,还包括:The method according to claim 3, wherein the determining the second block in the at least one second block based on the weight value of the at least one second block adjacent to the first candidate focus area Before the target block, it also includes:判断所述第一候选对焦区域包括的区块数量与所述预览图像包括的区块数量之间的比值是否小于预设比值;Determining whether the ratio between the number of blocks included in the first candidate focus area and the number of blocks included in the preview image is less than a preset ratio;如果是,则触发执行所述基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块的步骤。If yes, trigger execution of the step of determining a second target block in the at least one second block based on the weight value of the at least one second block adjacent to the first candidate focus area.
- 如权利要求3所述的方法,其特征在于,所述基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块之前,还包括:The method according to claim 3, wherein the determining the second block in the at least one second block based on the weight value of the at least one second block adjacent to the first candidate focus area Before the target block, it also includes:确定在控制所述拍摄装置获取所述预览图像的过程中的工作模式;Determining the working mode in the process of controlling the photographing device to acquire the preview image;如果所述工作模式为预设模式,则触发执行所述基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块的步骤。If the working mode is the preset mode, triggering the execution of the determination based on the weight value of at least one second block adjacent to the first candidate focus area in the at least one second block The steps of the target block.
- 如权利要求5所述的方法,其特征在于,所述预设模式包括双镜头模式。The method of claim 5, wherein the preset mode includes a dual-lens mode.
- 如权利要求2所述的方法,其特征在于,所述每个区块的权重值是基于所述初始对焦区域在所述预览图像中的位置和图像构图规则设置的;3. The method of claim 2, wherein the weight value of each block is set based on the position of the initial focus area in the preview image and image composition rules;其中,所述多个区块中位于所述预览图像边缘位置的区块的权重值小于,位于所述预览图像非边缘位置的区块的权重值,所述每个区块的权重值和相应区块与所述预览图像中心的距离成负相关。Wherein, the weight value of the block located at the edge position of the preview image among the plurality of blocks is smaller than the weight value of the block located at the non-edge position of the preview image, and the weight value of each block and the corresponding The distance between the block and the center of the preview image is negatively correlated.
- 如权利要求2所述的方法,其特征在于,所述每个区块的权重值是基于所述预览图像的语义分割数据和所述初始对焦区域在所述预览图像中的位置设置的;3. The method of claim 2, wherein the weight value of each block is set based on the semantic segmentation data of the preview image and the position of the initial focus area in the preview image;其中,与所述初始对焦区域具有相同语义的区块的权重值大于,与所述初始对焦区域具有不同语义的区块的权重值,且所述每个区块的权重值和相应区块与所述初始对焦区域中心的距离成负相关。Wherein, the weight value of the block having the same semantics as the initial focus area is greater than the weight value of the block having different semantics from the initial focus area, and the weight value of each block and the corresponding block are the same as those of the initial focus area. The distance of the center of the initial focus area is negatively correlated.
- 如权利要求3所述的方法,其特征在于,所述根据所述候选对焦区域对所述拍摄装置进行对比度对焦处理,包括:The method of claim 3, wherein the performing contrast focusing processing on the photographing device according to the candidate focus area comprises:如果所述第一候选对焦区域满足所述对比度对焦条件,则根据所述第一候选对焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置;If the first candidate focus area satisfies the contrast focus condition, performing contrast focus processing on the photographing device according to the first candidate focus area to obtain the target position of the focus motor;如果所述第一候选对焦区域不满足所述对比度对焦条件,则根据所述第二候选对焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置。If the first candidate focus area does not satisfy the contrast and focus condition, then perform contrast focus processing on the photographing device according to the second candidate focus area to obtain the target position of the focus motor.
- 如权利要求9所述的方法,其特征在于,在对焦处理过程中,所述对焦电机对应多个调整位置,所述预览图像是所述拍摄装置在所述对焦电机处于每个调整位置时获取到的。The method of claim 9, wherein during the focusing process, the focus motor corresponds to a plurality of adjustment positions, and the preview image is obtained by the photographing device when the focus motor is at each adjustment position Arrived.
- 如权利要求10所述的方法,其特征在于,所述方法还包括:The method of claim 10, wherein the method further comprises:对每个预览图像的所述初始对焦区域进行参考值计算,得到所述初始对焦区域对应的多个初始对焦参考值;Performing reference value calculation on the initial focus area of each preview image to obtain multiple initial focus reference values corresponding to the initial focus area;如果所述多个初始对焦参考值不满足对焦对比度条件指示的参考值条件,则确定所述初始对焦区域不满足所述对比度对焦条件。If the multiple initial focus reference values do not meet the reference value condition indicated by the focus contrast condition, it is determined that the initial focus area does not meet the contrast focus condition.
- 如权利要求11所述的方法,其特征在于,所述确定所述初始对焦区域不满足所述对比度对焦条件之前,还包括:The method according to claim 11, wherein before the determining that the initial focus area does not satisfy the contrast and focus condition, the method further comprises:存储所述初始对焦区域对应的多个初始对焦参考值、所述第一候选对焦区域对应的多个第一对焦参考值以及所述第二候选对焦区域对应的多个第二对焦参考值,所述第一对焦参考值是对所述每个预览图像的所述第一候选对焦区域进行参考值计算得到的,所述第二对焦参考值是对所述每个预览图像的所述第二候选对焦区域进行参考值计算得到的。Store multiple initial focus reference values corresponding to the initial focus area, multiple first focus reference values corresponding to the first candidate focus area, and multiple second focus reference values corresponding to the second candidate focus area, so The first focus reference value is obtained by reference value calculation of the first candidate focus area of each preview image, and the second focus reference value is the second candidate focus area of each preview image The focus area is calculated by reference value.
- 如权利要求12所述的方法,其特征在于,所述根据所述第一候选对 焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置,包括:The method of claim 12, wherein the performing contrast focusing processing on the photographing device according to the first candidate focus area to obtain the target position of the focusing motor comprises:从所述多个第一对焦参考值中获取目标对焦参考值,并从所述多个预览图像中获取所述目标对焦参考值对应的目标预览图像;Acquiring a target focus reference value from the plurality of first focus reference values, and acquiring a target preview image corresponding to the target focus reference value from the plurality of preview images;将拍摄所述目标预览图像时所述对焦电机所处的调整位置确定为所述对焦电机的目标位置。The adjustment position of the focus motor when the target preview image is taken is determined as the target position of the focus motor.
- 如权利要求1所述的方法,其特征在于,所述确定所述预览图像的初始对焦区域之后,所述方法还包括:8. The method according to claim 1, wherein after the determining the initial focus area of the preview image, the method further comprises:检测所述初始对焦区域对应的对焦对象是否为需要多对焦区域进行对焦处理的预设类型的拍摄对象;Detecting whether the focus object corresponding to the initial focus area is a preset type of shooting object that requires multiple focus areas to perform focus processing;如果是,则触发执行如果初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,并根据所述候选对焦区域对所述拍摄装置进行对比度对焦处理的步骤;If yes, trigger execution of the step of expanding the initial focus area to obtain a candidate focus area if the initial focus area does not meet the contrast focus condition, and perform contrast focus processing on the photographing device according to the candidate focus area;如果不是,则基于所述初始对焦区域对所述拍摄装置进行对焦处理。If not, performing focusing processing on the photographing device based on the initial focusing area.
- 一种图像处理设备,其特征在于,包括存储器和处理器:An image processing device, which is characterized in that it comprises a memory and a processor:所述存储器,用于存储程序代码;The memory is used to store program code;所述处理器,用于调用所述程序代码,当所述程序代码被执行时,用于执行以下操作:The processor is configured to call the program code, and when the program code is executed, it is configured to perform the following operations:控制拍摄装置获取预览图像;Control the camera to obtain the preview image;确定所述预览图像的初始对焦区域;Determining the initial focus area of the preview image;如果所述初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,根据所述候选对焦区域对所述拍摄装置进行对比度对焦处理。If the initial focus area does not meet the contrast focus condition, the initial focus area is expanded to obtain a candidate focus area, and the photographing device is subjected to contrast focus processing according to the candidate focus area.
- 如权利要求15所述的图像处理设备,其特征在于,所述候选对焦区域包括第一候选对焦区域,所述处理器在用于获取所述预览图像的候选对焦区域时,执行如下操作:15. The image processing device according to claim 15, wherein the candidate focus area comprises a first candidate focus area, and the processor performs the following operations when used to obtain the candidate focus area of the preview image:对所述预览图像进行区块划分得到多个区块,并获取每个区块的权重值;Dividing the preview image into blocks to obtain multiple blocks, and obtaining a weight value of each block;基于与所述初始对焦区域相邻的至少一个第一区块的权重值,在所述至少一个第一区块中确定第一目标区块,所述第一目标区块的权重值大于所述至少一个第一区块中其他区块的权重值;Based on the weight value of at least one first block adjacent to the initial focus area, a first target block is determined in the at least one first block, and the weight value of the first target block is greater than the weight value of the first target block. At least one weight value of other blocks in the first block;根据所述第一目标区块和所述初始对焦区域,得到所述第一候选对焦区域,所述第一候选对焦区域由所述第一目标区块和所述初始对焦区域组成。The first candidate focus area is obtained according to the first target block and the initial focus area, and the first candidate focus area is composed of the first target block and the initial focus area.
- 如权利要求16所述的图像处理设备,其特征在于,所述候选对焦区域还包括第二候选对焦区域,所述处理器在用于获取所述预览图像的候选对焦区域时,执行如下操作:15. The image processing device of claim 16, wherein the candidate focus area further comprises a second candidate focus area, and the processor performs the following operations when used to obtain the candidate focus area of the preview image:基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块,所述第二目标区块的权重值大于所述至少一个第二区块中其他区块的权重值;Based on the weight value of at least one second block adjacent to the first candidate focus area, a second target block is determined in the at least one second block, and the weight value of the second target block is greater than Weight values of other blocks in the at least one second block;根据所述第二目标区块和所述第一候选对焦区域,得到所述第二候选对焦区域,所述第二候选对焦区域由所述第二目标区块和所述第一候选对焦区域组成。According to the second target block and the first candidate focus area, the second candidate focus area is obtained, and the second candidate focus area is composed of the second target block and the first candidate focus area .
- 如权利要求17所述的图像处理设备,其特征在于,所述处理器还用于:18. The image processing device of claim 17, wherein the processor is further configured to:判断所述第一候选对焦区域包括的区块数量与所述预览图像包括的区块数量之间的比值是否小于预设比值;如果是,则触发执行所述基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二目标区块的步骤。Determine whether the ratio between the number of blocks included in the first candidate focus area and the number of blocks included in the preview image is less than a preset ratio; The step of determining the second target block in the at least one second block for the weight value of at least one adjacent second block.
- 如权利要求17所述的图像处理设备,其特征在于,所述处理器还用于:18. The image processing device of claim 17, wherein the processor is further configured to:确定在控制所述拍摄装置获取所述预览图像的过程中的工作模式;Determining the working mode in the process of controlling the photographing device to acquire the preview image;如果所述工作模式为预设模式,则触发执行所述基于与所述第一候选对焦区域相邻的至少一个第二区块的权重值,在所述至少一个第二区块中确定第二 目标区块的步骤。If the working mode is the preset mode, triggering the execution of the determination based on the weight value of at least one second block adjacent to the first candidate focus area in the at least one second block The steps of the target block.
- 如权利要求19所述的图像处理设备,其特征在于,所述预设模式包括双镜头模式。19. The image processing device of claim 19, wherein the preset mode comprises a dual-lens mode.
- 如权利要求16所述的图像处理设备,其特征在于,所述每个区块的权重值是基于所述初始对焦区域在所述预览图像中的位置和图像构图规则设置的;其中,所述多个区块中位于所述预览图像边缘位置的区块的权重值小于,位于所述预览图像非边缘位置的区块的权重值,所述每个区块的权重值和相应区块与所述预览图像中心的距离成负相关。The image processing device according to claim 16, wherein the weight value of each block is set based on the position of the initial focus area in the preview image and the image composition rule; wherein, the The weight value of the block located at the edge position of the preview image among the plurality of blocks is smaller than the weight value of the block located at the non-edge position of the preview image, the weight value of each block and the corresponding block and all The distance between the center of the preview image is negatively correlated.
- 如权利要求16所述的图像处理设备,其特征在于,所述每个区块的权重值是基于所述语义分割数据和所述初始对焦区域在所述预览图像中的位置设置的;16. The image processing device of claim 16, wherein the weight value of each block is set based on the semantic segmentation data and the position of the initial focus area in the preview image;其中,与所述初始对焦区块具有相同语义的区块的权重值大于,与所述初始对焦区域具有不同语义的区块的权重值,且所述每个区块的权重值和相应区块与所述初始对焦区域中心的距离成负相关。Wherein, the weight value of the block having the same semantics as the initial focus area is greater than the weight value of the block having different semantics from the initial focus area, and the weight value of each block and the corresponding block There is a negative correlation with the distance from the center of the initial focus area.
- 如权利要求17所述的图像处理设备,其特征在于,所述处理器在所述根据所述候选对焦区域对所述拍摄装置进行对比度对焦处理时,执行如下操作:18. The image processing device according to claim 17, wherein the processor performs the following operations when performing contrast focusing processing on the photographing device according to the candidate focus area:如果所述第一候选对焦区域满足所述对比度对焦条件,则根据所述第一候选对焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置;If the first candidate focus area satisfies the contrast focus condition, performing contrast focus processing on the photographing device according to the first candidate focus area to obtain the target position of the focus motor;如果所述第一候选对焦区域不满足所述对比度对焦条件,则根据所述第二候选对焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置。If the first candidate focus area does not satisfy the contrast and focus condition, then perform contrast focus processing on the photographing device according to the second candidate focus area to obtain the target position of the focus motor.
- 如权利要求23所述的图像处理设备,其特征在于,在对焦处理过程 中,所述对焦电机对应多个调整位置,所述预览图像是所述拍摄装置在所述对焦电机处于每个调整位置时获取到的。The image processing device according to claim 23, wherein, during the focusing process, the focus motor corresponds to a plurality of adjustment positions, and the preview image shows that the photographing device is at each adjustment position of the focus motor. Obtained at the time.
- 如权利要求24所述的图像处理设备,其特征在于,所述处理器还用于:The image processing device according to claim 24, wherein the processor is further configured to:对每个预览图像的所述初始对焦区域进行参考值计算,得到所述初始对焦区域对应的多个初始对焦参考值;Performing reference value calculation on the initial focus area of each preview image to obtain multiple initial focus reference values corresponding to the initial focus area;如果所述多个初始对焦参考值不满足对焦对比度条件指示的参考值条件,则确定所述初始对焦区域不满足所述对比度对焦条件。If the multiple initial focus reference values do not meet the reference value condition indicated by the focus contrast condition, it is determined that the initial focus area does not meet the contrast focus condition.
- 如权利要求25所述的图像处理设备,其特征在于,所述处理器还用于:The image processing device according to claim 25, wherein the processor is further configured to:存储所述初始对焦区域对应的多个初始对焦参考值、所述第一候选对焦区域对应的多个第一对焦参考值以及所述第二候选对焦区域对应的多个第二对焦参考值,所述第一对焦参考值是对所述每个预览图像的所述第一候选对焦区域进行参考值计算得到的,所述第二对焦参考值是对所述每个预览图像的所述第二候选对焦区域进行参考值计算得到的。Store multiple initial focus reference values corresponding to the initial focus area, multiple first focus reference values corresponding to the first candidate focus area, and multiple second focus reference values corresponding to the second candidate focus area, so The first focus reference value is obtained by reference value calculation of the first candidate focus area of each preview image, and the second focus reference value is the second candidate focus area of each preview image The focus area is calculated by reference value.
- 如权利要求26所述的图像处理设备,其特征在于,所述处理器在根据所述第一候选对焦区域对所述拍摄装置进行对比度对焦处理,得到所述对焦电机的目标位置时,执行如下操作:The image processing device according to claim 26, wherein the processor performs the following when performing contrast focusing processing on the photographing device according to the first candidate focus area to obtain the target position of the focusing motor operating:从所述多个第一对焦参考值中获取目标对焦参考值,并从所述多个预览图像中获取所述目标对焦参考值对应的目标预览图像;Acquiring a target focus reference value from the plurality of first focus reference values, and acquiring a target preview image corresponding to the target focus reference value from the plurality of preview images;将拍摄所述目标预览图像时所述对焦电机所处的调整位置确定为所述对焦电机的目标位置。The adjustment position of the focus motor when the target preview image is taken is determined as the target position of the focus motor.
- 如权利要求15所述的图像处理设备,其特征在于,所述处理器还用于:15. The image processing device according to claim 15, wherein the processor is further configured to:检测所述初始对焦区域对应的对焦对象是否为需要多对焦区域进行对焦 处理的预设类型的拍摄对象;Detecting whether the focus object corresponding to the initial focus area is a preset type of shooting object that requires multiple focus areas for focusing processing;如果是,则触发执行如果所述初始对焦区域不满足对比度对焦条件,则扩大所述初始对焦区域得到候选对焦区域,并根据所述候选对焦区域对所述拍摄装置进行对比度对焦处理的步骤;If yes, trigger execution of the step of expanding the initial focus area to obtain a candidate focus area if the initial focus area does not meet the contrast focus condition, and perform contrast focus processing on the photographing device according to the candidate focus area;如果不是,则基于所述初始对焦区域对所述拍摄装置进行对焦处理。If not, performing focusing processing on the photographing device based on the initial focusing area.
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行如权利要求1-14所述的拍摄装置的对焦方法。A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program includes program instructions that, when executed by a processor, cause the processor to execute The focusing method of the photographing device described in claim 1-14.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2019/122109 WO2021102961A1 (en) | 2019-11-29 | 2019-11-29 | Focusing method for photographing apparatus, image processing device, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2019/122109 WO2021102961A1 (en) | 2019-11-29 | 2019-11-29 | Focusing method for photographing apparatus, image processing device, and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021102961A1 true WO2021102961A1 (en) | 2021-06-03 |
Family
ID=76129874
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/122109 WO2021102961A1 (en) | 2019-11-29 | 2019-11-29 | Focusing method for photographing apparatus, image processing device, and storage medium |
Country Status (1)
Country | Link |
---|---|
WO (1) | WO2021102961A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117714856A (en) * | 2023-05-29 | 2024-03-15 | 荣耀终端有限公司 | Focusing control method, electronic equipment and medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012220890A (en) * | 2011-04-13 | 2012-11-12 | Nikon Corp | Focus adjustment device |
CN104270562A (en) * | 2014-08-15 | 2015-01-07 | 广东欧珀移动通信有限公司 | Method and device for focusing when photographing |
CN105357444A (en) * | 2015-11-27 | 2016-02-24 | 努比亚技术有限公司 | Focusing method and device |
US20160234426A1 (en) * | 2015-02-10 | 2016-08-11 | Canon Kabushiki Kaisha | Image capturing apparatus, method of displaying image, and storage medium storing program |
CN106303205A (en) * | 2015-06-12 | 2017-01-04 | 中兴通讯股份有限公司 | Focusing area method of adjustment and device |
CN107566731A (en) * | 2017-09-28 | 2018-01-09 | 努比亚技术有限公司 | A kind of focusing method and terminal, computer-readable storage medium |
CN108337424A (en) * | 2017-01-17 | 2018-07-27 | 中兴通讯股份有限公司 | A kind of phase focusing method and its device |
CN108668086A (en) * | 2018-08-16 | 2018-10-16 | Oppo广东移动通信有限公司 | Atomatic focusing method, device, storage medium and terminal |
CN109480766A (en) * | 2018-11-14 | 2019-03-19 | 深圳盛达同泽科技有限公司 | Retina Atomatic focusing method, device, system and fundus camera |
-
2019
- 2019-11-29 WO PCT/CN2019/122109 patent/WO2021102961A1/en active Application Filing
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012220890A (en) * | 2011-04-13 | 2012-11-12 | Nikon Corp | Focus adjustment device |
CN104270562A (en) * | 2014-08-15 | 2015-01-07 | 广东欧珀移动通信有限公司 | Method and device for focusing when photographing |
US20160234426A1 (en) * | 2015-02-10 | 2016-08-11 | Canon Kabushiki Kaisha | Image capturing apparatus, method of displaying image, and storage medium storing program |
CN106303205A (en) * | 2015-06-12 | 2017-01-04 | 中兴通讯股份有限公司 | Focusing area method of adjustment and device |
CN105357444A (en) * | 2015-11-27 | 2016-02-24 | 努比亚技术有限公司 | Focusing method and device |
CN108337424A (en) * | 2017-01-17 | 2018-07-27 | 中兴通讯股份有限公司 | A kind of phase focusing method and its device |
CN107566731A (en) * | 2017-09-28 | 2018-01-09 | 努比亚技术有限公司 | A kind of focusing method and terminal, computer-readable storage medium |
CN108668086A (en) * | 2018-08-16 | 2018-10-16 | Oppo广东移动通信有限公司 | Atomatic focusing method, device, storage medium and terminal |
CN109480766A (en) * | 2018-11-14 | 2019-03-19 | 深圳盛达同泽科技有限公司 | Retina Atomatic focusing method, device, system and fundus camera |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117714856A (en) * | 2023-05-29 | 2024-03-15 | 荣耀终端有限公司 | Focusing control method, electronic equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111028189B (en) | Image processing method, device, storage medium and electronic equipment | |
US7903168B2 (en) | Camera and method with additional evaluation image capture based on scene brightness changes | |
CN107258077B (en) | System and method for Continuous Auto Focus (CAF) | |
JP4957850B2 (en) | Imaging apparatus, warning method, and program | |
JP4664379B2 (en) | Electronic device and image data processing method for image data processing | |
JP6267502B2 (en) | IMAGING DEVICE, IMAGING DEVICE CONTROL METHOD, AND PROGRAM | |
US20070237514A1 (en) | Varying camera self-determination based on subject motion | |
US20070248330A1 (en) | Varying camera self-determination based on subject motion | |
JP6223059B2 (en) | Imaging apparatus, control method thereof, and program | |
JP2003167182A (en) | Automatic focusing device | |
JP6472183B2 (en) | Image processing apparatus, control method thereof, and program | |
WO2021169686A1 (en) | Photo capture control method and apparatus and computer readable storage medium | |
CN106791451B (en) | Photographing method of intelligent terminal | |
US11871123B2 (en) | High dynamic range image synthesis method and electronic device | |
US20210158537A1 (en) | Object tracking apparatus and control method thereof | |
CN104601876A (en) | Method and device for detecting passerby | |
WO2011056994A2 (en) | Adaptive automatic exposure apparatus and method for digital images | |
CN113923347A (en) | Automatic focusing method and device, shooting terminal and computer readable storage medium | |
JP2009009072A (en) | Dynamic focus zone for camera | |
CN113473018B (en) | Video shooting method and device, shooting terminal and storage medium | |
WO2021102961A1 (en) | Focusing method for photographing apparatus, image processing device, and storage medium | |
JP5509621B2 (en) | Image processing apparatus, camera, and program | |
JP2015111226A (en) | Subject tracking device and control method of the same, imaging device, program, and storage medium | |
CN113873160B (en) | Image processing method, device, electronic equipment and computer storage medium | |
JP5564961B2 (en) | Imaging device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19953816 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19953816 Country of ref document: EP Kind code of ref document: A1 |