[go: up one dir, main page]

WO2018214502A1 - Background blurring method and device, terminal, and storage medium - Google Patents

Background blurring method and device, terminal, and storage medium Download PDF

Info

Publication number
WO2018214502A1
WO2018214502A1 PCT/CN2017/119578 CN2017119578W WO2018214502A1 WO 2018214502 A1 WO2018214502 A1 WO 2018214502A1 CN 2017119578 W CN2017119578 W CN 2017119578W WO 2018214502 A1 WO2018214502 A1 WO 2018214502A1
Authority
WO
WIPO (PCT)
Prior art keywords
sub
area picture
picture
preset central
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2017/119578
Other languages
French (fr)
Chinese (zh)
Inventor
陶然
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Publication of WO2018214502A1 publication Critical patent/WO2018214502A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof

Definitions

  • the present invention relates to terminal technologies, and in particular, to a background blurring method, device, terminal, and storage medium.
  • mobile terminals on the market mostly have built-in dual cameras, and through the two camera modules, photographs with clear background blur of the subject are taken.
  • the main principle is: in the dual camera shooting preview mode, the terminal uses two camera modules to synchronously obtain a preview of the current scene from different angles; in the preview image, according to the distance and angle between the dual camera modules The phase difference is calculated, and the depth of field of each pixel unit included in a preview image is calculated; the depth of field information of each pixel unit is used to realize the separation of the foreground area (ie, the area where the subject is located) and the background area, thereby realizing the virtual area of the background area. Processing.
  • the terminal cost of the dual camera module is higher than that of the terminal of the single camera module.
  • the embodiment of the present invention is expected to provide a background blurring method, device, terminal and storage medium, which is intended to capture a background blur effect by using only a single camera module. photo.
  • an embodiment of the present invention provides a background blurring method, which is applied to a single camera module, and the method includes:
  • the at least one sub-area picture to be blurred according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture Blurring processing.
  • the dividing the preview picture into the at least one sub-area picture according to the preset division policy includes:
  • the preview picture is divided into at least one sub-area picture according to the picture complexity of the preview picture.
  • the phase focusing parameter includes: the at least one sub-region picture and the two-dimensional gain map data and the phase difference conversion coefficient of the preset central region picture; wherein the two-dimensional gain map data includes The at least one sub-area picture and the left image data and the right image data of the preset center area picture are described.
  • the acquiring the phase focus parameter of the at least one sub-area picture and the preset central area picture includes:
  • the acquiring at least one relative distance information between the at least one sub-area picture and the preset central area picture according to the phase focus parameter of the at least one sub-area picture and the preset central area picture includes:
  • the method before determining at least one sub-area picture to be blurred by the at least one sub-area picture, the method further includes:
  • Receiving a touch instruction for photographing generating the first target image by the preview image, and saving at least one relative distance information between the at least one sub-region image and the preset central region image.
  • the determining, by the at least one sub-area picture, the at least one sub-area picture to be blurred includes:
  • the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture is at least one to be virtualized according to a preset blurring policy.
  • the processed sub-area picture is blurred, including:
  • an embodiment of the present invention provides a background blurring device, where the device includes: a region dividing module, a phase focusing parameter acquiring module, a relative distance acquiring module, a to-be-demagnetized region determining module, and a blurring processing module; ,
  • the area dividing module is configured to divide the preview picture into at least one sub-area picture according to a preset dividing policy
  • the phase focus parameter acquisition module is configured to acquire the phase focus parameter of the at least one sub-area picture and the preset central area picture;
  • the relative distance acquisition module is configured to acquire at least one relative between the at least one sub-area picture and the preset central area picture according to the at least one sub-area picture and the phase focus parameter of the preset central area picture Distance information;
  • the to-be-ambiguous area determining module is configured to determine, from the at least one sub-area picture, at least one sub-area picture to be blurred;
  • the imaginary processing module is configured to: according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, the at least one according to a preset blurring policy
  • the sub-area picture to be blurred is subjected to blurring processing.
  • the relative distance obtaining module is configured to:
  • the imaginary processing module is configured to:
  • an embodiment of the present invention provides a background blurring device, where the device includes: a communication interface, a memory, a processor, and a bus;
  • the bus is configured to connect the communication interface, the processor and the memory, and mutual communication between the devices;
  • the communication interface is configured to perform data transmission with an external network element
  • the memory is configured to store instructions and data
  • the processor is configured to execute the instructions to implement the background blurring method described above.
  • an embodiment of the present invention provides a computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors, To achieve the above background blurring method.
  • the embodiment of the present invention provides a terminal, where the terminal includes the background blurring device of any of the second aspect or the third aspect.
  • the background blurring method, device, terminal and storage medium can use the phase focusing technology built in the mobile terminal such as a smart phone or a tablet to perform area division on the preview screen, and can be based on each sub-area screen.
  • the phase focusing parameter obtains a relative distance between each sub-area picture and a preset central area picture, and after determining at least one sub-area picture to be blurred, can be based on at least one sub-area to be blurred
  • the relative distance between the picture and the picture of the central area is subjected to corresponding blurring processing on at least one picture of the sub-area to be blurred.
  • the method enables a mobile terminal such as a smart phone or a tablet to capture a photo with a background blur effect using only one camera module, and the method greatly reduces the overall machine cost compared to the terminal of the dual camera module.
  • FIG. 1 is a schematic diagram of a background blurring method according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of an interface display of a preview screen according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of a method for dividing a preview picture according to an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of a method for acquiring a phase focus parameter according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a working principle of shielding pixel points according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a correspondence relationship between a sub-area picture and a phase difference conversion coefficient according to an embodiment of the present invention
  • FIG. 7 is a schematic diagram of waveforms of left image data and right image data before and after calibration according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of a terminal interface in a background blur mode according to an embodiment of the present invention.
  • FIG. 9 is a schematic diagram of a method for performing blur processing on at least one sub-area picture to be blurred according to an embodiment of the present disclosure
  • FIG. 10 is a schematic diagram of an implementation process of a background blurring method according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of a background blurring device according to an embodiment of the present disclosure.
  • FIG. 12 is a schematic structural diagram of another background blurring device according to an embodiment of the present disclosure.
  • FIG. 13 is a schematic structural diagram of still another background blur device according to an embodiment of the present invention.
  • FIG. 14 is a schematic structural diagram of still another background blur device according to an embodiment of the present disclosure.
  • FIG. 15 is a schematic structural diagram of a background blurring terminal according to an embodiment of the present invention.
  • the autofocus technology adopted on mobile terminals such as smart phones mainly includes CDAFA (Contrast Detection Auto Focus), Phase Focus (PDAF, Phase Detection Auto Focus) and Laser Focus Auto (LDAF) technology.
  • CDAFA Contrast Detection Auto Focus
  • PDAF Phase Focus
  • LDAF Laser Focus Auto
  • contrast focusing is the most popular, most widely used, and relatively low cost autofocus technology, and it has become contrast focus.
  • the basic principle is that when we aim at the subject, the motor in the lens module will drive the lens to move from the bottom to the top.
  • the pixel sensor will comprehensively detect the entire scene range in the depth direction. And continue to record contrast values such as contrast. After finding the maximum contrast position, the lens that moves to the top will return to that position to complete the final focus. So one of the main drawbacks of contrast focusing is that it takes a long time.
  • Phase focusing technology overcomes the above-mentioned drawbacks of contrast focusing because of its fast focusing speed.
  • the basic principle is: take out the pair of opposite pixels from the photosensitive element, and respectively detect the amount of light entering the object in the scene, and compare the relative values of the left and right sides to quickly find out the accuracy.
  • the focus point after which the mirror motor will push the lens to the corresponding position to complete the focus.
  • the embodiment of the present invention provides a background blurring method, device and terminal under the condition that a mobile terminal has a single camera module built by using a phase focusing technology provided by a mobile terminal such as a smart phone or a tablet.
  • the figure shows a background blurring method provided by an embodiment of the present invention.
  • the method may include:
  • the central area screen including the shooting subject may be determined according to the position of the touch operation received on the touch screen of the terminal in the preview screen.
  • the number 1 in FIG. 2 is a preview screen
  • the number 2 is a focus frame
  • the number 3 is Prompt information
  • number 4 is the camera button; in order to make the subject clearer, the position of the subject in the preview screen is usually clicked by the touch operation, so as to achieve accurate focusing of the subject, and the terminal can be based on the figure.
  • the position of the focus frame shown in 2 determines the center area screen of the subject.
  • S140 Determine, from the at least one sub-area picture, at least one sub-area picture to be blurred.
  • the at least one sub-region to be blurred according to a preset blurring policy according to at least one relative distance information between the at least one sub-region image to be blurred and the preset central region image
  • the screen is blurred.
  • step S110 the preview picture is divided into at least one sub-area picture according to a preset division policy, as shown in FIG. 3, which may include the following:
  • S1101 analyzing, according to the preview screen information, a screen complexity of the preview screen
  • the preview picture is divided into at least one sub-area picture according to a picture complexity of the preview picture.
  • the image complexity is a description of the inherent complexity of the image. Therefore, the higher the complexity of the image, the more detailed the region of the preview image is, and the more the number of sub-region images obtained; Conversely, the lower the complexity of the picture, the simpler the division of the area of the preview picture, and the smaller the number of sub-area pictures obtained.
  • the image segmentation method since the method belongs to the prior art in the field of image processing, it will not be described herein.
  • the phase focus parameter described in step S120 may include: the at least one sub-area picture and the two-dimensional gain map data (2DGMD, Two-dimension Gain Map Data) and the phase of the preset central area picture.
  • a difference difference conversion coefficient PDCC
  • the two-dimensional gain map data includes left image data and right image data of the at least one sub-area picture and a preset central area picture.
  • the acquiring the phase focus parameter of the at least one sub-area picture and the preset central area picture, as shown in FIG. 4, may include the following:
  • the conventional SLR camera has a focus sensor, and a sub-reflector is mounted on the back of the reflector, and the sub-reflector sends a part of the light incident on the lens to the focus sensor, and the focus is determined by the distance measurement, and then the system Control the movement of the lens to complete autofocus.
  • terminals such as mobile phones and tablets are highly integrated by the camera module, it is not possible to directly integrate a separate focus sensor. Based on this, as shown in FIG. 5, people directly reserve some paired left and right opposite shielding pixels on the photosensitive element of the image sensor for phase detection; the paired shielding pixel points are as shown in FIG. 5(a).
  • the focusing system can determine the offset value of the focus by the difference between the image data obtained by the left and right pixel points respectively (such as the distance between the pixels), thereby achieving accurate focusing; wherein the left image obtained by the left and right pixel points respectively
  • the waveforms of the data and the right image data are shown in Fig. 5(b).
  • the method for generating the two-dimensional gain map data of the at least one sub-region image by the camera module may be as follows:
  • test scene that is, the shooting target uses a black and white vertical stripe card
  • the initial position of the lens is placed in the middle of macro and infinity
  • the object distance is set to 20cm
  • the light source adopts D65.
  • the brightness value ranges from (800, 1000), and both the digital gain and the analog gain are set to 1X and no band.
  • the lens may acquire one piece of original image data by capturing the shooting target once, or may acquire a plurality of pieces of original image data by capturing the shooting target a plurality of times.
  • it is necessary to perform mean calculation on the acquired plurality of original image data, and input the average image data obtained by the mean calculation into the following interface function PDAF_Cal_GainMap().
  • the parameter Multipleregions is a variable for indicating the number of sub-area pictures obtained by dividing the preview picture into regions, for example, dividing the preview picture into 3 ⁇ 3 sub-area pictures, that is, setting the parameter Multipleregions.
  • the two-dimensional gain map data of each sub-area picture can be obtained through the interface function PDAF_Cal_GainMap(...); therefore, under the condition that the parameter Multipleregions is not set, that is, the value of the parameter Multipleregions is set to 1
  • phase difference conversion coefficient of the at least one sub-area picture may be acquired by a phase difference conversion coefficient generation algorithm built in the camera module, and the generating algorithm may include:
  • test scene that is, the shooting target adopts a vertical stripe board with a blackboard, and the initial position of the lens is placed in the middle of macro and infinity, the object distance is set to 20cm, and the light source adopts D65.
  • the brightness value ranges from (800, 1000), and both the digital gain and the analog gain are set to 1X and no band.
  • the luminance value is set to 880.
  • the control motor moves the lens from the initial position to the infinity direction by 80%. After the motor is stabilized, the first original image is taken, and the lens position is recorded as LensPosition1.
  • the control motor moves the lens from the initial position to the macro direction by 80%. After the motor is stabilized, the second original image is taken, and the lens position is recorded as LensPosition2.
  • the parameter Multipleregions is a variable for indicating the number of sub-area pictures obtained by dividing the preview picture into regions, for example, as shown in FIG. 6( a ), the preview picture is divided into 3 ⁇ 3.
  • the sub-area picture, that is, the parameter Multipleregions is set to 3 ⁇ 3, the phase difference conversion coefficient of each sub-area picture can be obtained by the interface function PDAF_Cal_PDConversionCoef((7), see FIG. 6(b).
  • the preview picture is divided into a sub-area picture, and correspondingly, through the interface function PDAF_Cal_PDConversionCoef((7) A phase difference conversion coefficient of the sub-area picture (ie, the entire preview picture) can be obtained.
  • control motor moves the lens from the initial position to the infinity direction and the macro direction by 60%, and repeats steps S1302b to S1305b to output the second phase difference conversion coefficient K2 of the at least one sub-region picture.
  • steps S1302b to S1306b are repeated, and the third phase difference conversion coefficient K3 and the fourth phase difference conversion coefficient K4 of the at least one sub-region picture are respectively output.
  • K (K1+K2+K3+K4)/4 (1)
  • the method for acquiring the two-dimensional gain map data and the phase difference conversion coefficient of the preset central region picture is the same as the method for acquiring the two-dimensional gain map data and the phase difference conversion coefficient of the at least one sub-region picture, , will not repeat them here.
  • step S130 the acquiring at least one relative between the at least one sub-area picture and the preset central area picture according to the phase focus parameter of the at least one sub-area picture and the preset central area picture Distance information can include:
  • the left image data and the right image data of the at least one sub-area picture and the preset central area picture are respectively corresponding according to the at least one sub-area picture and the preset central area picture.
  • the left pixel point and the right pixel point of the preset pixel pair in the photosensitive element are acquired, and therefore, the left image data and the right image data are the result of the output of the photosensitive element.
  • the peak value of the left image data and the right image data is the maximum value of the light intensity; when the pixel value output by the photosensitive element, the left image data and the right image data
  • the peak value of the wave is the maximum value of the pixel value.
  • the peak values of the left image data and the right image data actually obtained by the left and right pixel points are not on the same horizontal plane. Therefore, before calculating the phase difference between the left image data and the right image data, as shown in FIG. 7, the left image data and the right image data are also required (see FIG. 7(a)).
  • the calibration is performed such that the peak values of the two are on the same horizontal plane, thereby facilitating calculation of the phase difference between the left image data and the right image data, and the calibration result is shown in Fig. 7(b).
  • the phase difference between the left image data and the right image data refers to a relative position difference between the left image data and the right image data. As shown in FIG.
  • the position corresponding to the peak value of the left image data is L1
  • the position corresponding to the peak value of the right image data is L2, which is easily obtained
  • the phase difference between the left image data and the right image data is
  • phase difference between the calibrated left image data and the right image data according to the at least one sub-area picture and the preset central area picture and the phase of the at least one sub-area picture and the preset central area picture Presetting a proportional relationship between the difference conversion coefficients, and acquiring a defocus distance of the at least one sub-area picture and the preset central area picture.
  • the preset proportional relationship may be as shown in the following formula (2), and therefore, the defocus distance of the at least one sub-area picture and the preset central area picture may be calculated according to the following formula (2):
  • ⁇ X i represents the defocus distance of the area picture i
  • K i represents the phase difference conversion coefficient of the area picture i
  • PD i represents between the left picture data and the right picture data of the area picture i Phase difference
  • defocus distance refers to the difference between the actual focus and the accurate focus, and actually reflects the distance that the sub-area picture i should actually move when achieving accurate focusing.
  • S1304 Calculate a defocus distance difference between the at least one sub-area picture and the preset central area picture based on a defocus distance of the preset central area picture.
  • S1305 Acquire at least one relative distance information between the at least one sub-area picture and the preset central area picture according to a defocus distance difference between the at least one sub-area picture and the preset central area picture.
  • the defocus distance difference between the at least one sub-area picture and the preset central area picture may be directly used to reflect the at least one sub-area picture and the preset The relative distance between the central area screens.
  • the method shown in FIG. 1 further includes
  • Receiving a touch instruction for photographing generating the first target image by the preview image, and saving at least one relative distance information between the at least one sub-region image and the preset central region image.
  • the determining, by the at least one sub-area picture, the at least one sub-area picture to be blurred may include:
  • the number 5 indicates the prompt information
  • the number 6 indicates the current processing mode
  • the number 7 indicates the selected image processing mode
  • the camera album is opened for processing.
  • the picture is selected and the picture processing mode is selected as the background blur mode.
  • the user can select the sub-area picture that needs to be blurred according to the prompt information “Please select the processing area” displayed on the terminal screen.
  • step S150 the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture is compared to the at least one according to a preset blurring policy.
  • the sub-area picture to be blurred is subjected to blurring processing, as shown in FIG. 9, and may include:
  • S1501 Determine, according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, a blur level of the at least one sub-area picture to be blurred;
  • S1502 Perform a blurring process on the at least one sub-area picture to be blurred according to the blur level of the at least one sub-area picture to be blurred.
  • the phase focusing parameter of each sub-region image can be realized.
  • Each sub-area screen has different degrees of blurring processing. The method enables a mobile terminal such as a smart phone or a tablet to capture a photo with a background blur effect using only one camera module, which greatly reduces the overall cost compared to the terminal of the dual camera module.
  • the figure shows another implementation process of the background blurring method provided by the embodiment of the present invention.
  • the implementation process includes:
  • the preview picture is divided into at least one sub-area picture according to a picture complexity of the preview picture.
  • phase focus parameter of the at least one sub-area picture and a preset central area picture from parameters pre-generated by the camera module, where the phase focus parameter includes the at least one sub-area picture and a preset Two-dimensional gain map data and phase difference conversion coefficient of the central region picture; the two-dimensional gain map data includes left image data acquired by the camera module through a left pixel point of a preset pixel pair and a right of the pixel pair The right image data acquired by the pixel.
  • ⁇ X i represents the defocus distance of the area picture i
  • K i represents the phase difference conversion coefficient of the area picture i
  • PD i represents between the left picture data and the right picture data of the area picture i Phase difference.
  • S907 Calculate a defocus distance difference between the at least one sub-area picture and the preset central area picture based on a defocus distance of the preset central area picture.
  • S909 Receive a touch instruction for photographing, generate a first target image by using the preview image, and save at least one relative distance information between the at least one sub-region image and the preset central region image.
  • S911 Determine, according to the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, a blur level of the at least one sub-area picture to be blurred.
  • S912 Perform a blurring process on the at least one sub-area picture to be blurred according to the blur level of the at least one sub-area picture to be blurred.
  • the method can utilize the phase focusing technology built in the mobile terminal such as a smart phone or a tablet, and based on the region division of the preview image, according to each sub-region image and the central region.
  • the phase focus parameter of the picture is obtained, and the relative distance between each sub-area picture and the central area picture is obtained, and after the user generates a first target image by taking a picture through the terminal, the at least one to be determined according to the sub-area picture selected by the user.
  • the figure shows a background blurring device 100 according to an embodiment of the present invention.
  • the device 100 mainly includes: a region dividing module 1010, a phase focus parameter acquisition module 1020, a relative distance acquisition module 1030, a to be blurred area determination module 1040, and a blurring processing module 1050;
  • the area dividing module 1010 is configured to divide the preview picture into at least one sub-area picture according to a preset dividing policy
  • the phase focus parameter acquisition module 1020 is configured to acquire the phase focus parameter of the at least one sub-area picture and the preset central area picture;
  • the relative distance obtaining module 1030 is configured to acquire at least one of the at least one sub-area picture and the preset central area picture according to the at least one sub-area picture and the phase focus parameter of the preset central area picture. Relative distance information;
  • the to-be-ambiguous area determining module 1040 is configured to determine, from the at least one sub-area picture, at least one sub-area picture to be blurred;
  • the imaginary processing module 1050 is configured to: according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, according to a preset ambiguity policy A sub-area picture to be blurred is subjected to blurring processing.
  • the area dividing module 1010 is further configured to:
  • the preview picture is divided into at least one sub-area picture according to the picture complexity of the preview picture.
  • the phase focusing parameter may include: the at least one sub-region picture and the two-dimensional gain map data and the phase difference conversion coefficient of the preset central region picture; wherein the two-dimensional gain map data includes The at least one sub-area picture and the left image data and the right image data of the preset center area picture.
  • phase focus parameter acquisition module 1020 is configured to:
  • the relative distance obtaining module 1030 is configured to:
  • the background blurring device further includes a target image generating module 1060 and a storage module 1070;
  • the target image generating module 1060 is configured to receive a touch instruction for photographing, and generate a first target image by using the preview image;
  • the storage module 1070 is configured to save at least one relative distance information between the at least one sub-area picture and the preset central area picture.
  • the to-be-ambiguous area determining module 1040 includes a display sub-module 10401 and a to-be-ambiguous area determining sub-module 10402.
  • the display submodule 10401 is configured to display the first target image
  • the to-be-ambiguous area determining sub-module 10402 is configured to determine at least one to be blurred from the at least one sub-area picture according to the position of the touch operation received by the display sub-module on the first target image.
  • the processed sub-area screen is configured to determine at least one to be blurred from the at least one sub-area picture according to the position of the touch operation received by the display sub-module on the first target image.
  • the blurring processing module 1050 is configured to:
  • each functional module in this embodiment may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software function module.
  • the integrated unit may be stored in a computer readable storage medium if it is implemented in the form of a software function module and is not sold or used as a stand-alone product.
  • the technical solution of the embodiment is essentially Said that the part contributing to the prior art or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium, comprising a plurality of instructions for making a computer device (may It is a personal computer, a server, or a network device, etc. or a processor that performs all or part of the steps of the method described in this embodiment.
  • the foregoing computer readable storage medium includes: a USB flash drive, a removable hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. Medium.
  • the computer program instructions corresponding to the background blurring method in this embodiment may be stored on a storage medium such as an optical disk, a hard disk, a U disk, or the like, and a computer program instruction corresponding to a background blurring method in the storage medium is When the electronic device is read or executed, the implementation is as follows:
  • the at least one sub-area picture to be blurred according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture Blurring processing.
  • the computer program is further configured to be executed when the processor is running:
  • the preview picture is divided into at least one sub-area picture according to the picture complexity of the preview picture.
  • the computer program is further configured to be executed when the processor is running:
  • the computer program is further configured to be executed when the processor is running:
  • the computer program is further configured to be executed when the processor is running:
  • Receiving a touch instruction for photographing generating the first target image by the preview image, and saving at least one relative distance information between the at least one sub-region image and the preset central region image.
  • the computer program is further configured to be executed when the processor is running:
  • the computer program is further configured to be executed when the processor is running:
  • a background blur device 100 may be provided, which may include: a communication interface 1401, a memory 1402, a processor 1403, and a bus 1404;
  • the bus 1404 is configured to connect the communication interface 1401, the processor 1403, and the memory 1402, and mutual communication between the devices;
  • the communication interface 1401 is configured to perform data transmission with an external network element
  • the memory 1402 is configured to store instructions and data
  • the processor 1403 is configured to execute the instruction to: divide the preview picture into at least one sub-area picture according to a preset division policy;
  • the at least one sub-area to be blurred according to a preset blurring policy
  • the screen is blurred.
  • the memory 1402 may be a volatile memory, such as a random access memory (RAM), or a non-volatile memory, such as a read only memory.
  • RAM random access memory
  • ROM Read-Only Memory
  • flash memory hard disk (HDD, Hard Disk Drive) or solid state drive (SSD, Solid-State Drive); or a combination of the above types of memory, and to the processor 1403 Provide instructions and data.
  • HDD Hard Disk Drive
  • SSD Solid-State Drive
  • the processor 1403 may be an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), or a Programmable Logic Device (PLD). At least one of a Programmable Logic Device, a Field Programmable Gate Array (FPGA), a Central Processing Unit (CPU), a controller, a microcontroller, and a microprocessor. It is to be understood that, for different devices, the electronic device for implementing the above-mentioned functions of the processor may be other, which is not limited in the embodiment of the present invention.
  • ASIC Application Specific Integrated Circuit
  • DSP Digital Signal Processor
  • DSPD Digital Signal Processing Device
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • CPU Central Processing Unit
  • controller a controller
  • microcontroller a microcontroller
  • the processor 1403 can be configured to:
  • phase focus parameter processed in the processor 1403 may include:
  • the processor 1403 can be configured to:
  • the processor 1403 can be configured to:
  • processor 1403 can also be configured to:
  • Receiving a touch instruction for photographing generating a target image by the preview image, and saving at least one relative distance information between the at least one sub-region image and the preset central region image.
  • the processor 1403 can be configured to:
  • the processor 1403 can be configured to:
  • FIG. 15 shows a background blurring terminal 15 provided by an embodiment of the present invention.
  • the terminal 15 includes any of the foregoing embodiments.
  • the background blur device 100 is configured to:
  • the at least one sub-area to be blurred according to a preset blurring policy
  • the screen is blurred.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

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

Abstract

Disclosed in embodiments of the present invention are a background blurring method and device, a terminal, and a storage medium. The method is applied to a single camera module. The method comprises: dividing a preview image into at least one sub-region image according to a preset division strategy; obtaining the at least one sub-region image and phase focusing parameters of a preset central region image; obtaining at least one piece of relative distance information between the at least one sub-region image and the preset central region image according to the at least one sub-region image and the phase focusing parameters of the preset central region image; determining at least one sub-region image to be blurred from among the at least one sub-region image; and blurring the at least one sub-region image to be blurred according to the at least one piece of relative distance information between the at least one sub-region image to be blurred and the preset central region image, and a preset blurring strategy.

Description

背景虚化方法、设备、终端及存储介质Background blur method, device, terminal, and storage medium

相关申请的交叉引用Cross-reference to related applications

本申请基于申请号为201710374328.3、申请日为2017年05月24日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。The present application is based on a Chinese patent application filed on Jan.

技术领域Technical field

本发明涉及终端技术,尤其涉及一种背景虚化方法、设备、终端及存储介质。The present invention relates to terminal technologies, and in particular, to a background blurring method, device, terminal, and storage medium.

背景技术Background technique

智能手机、平板等移动终端上的相机模组由于受体积小型化的限制,其摄像头的性能无法匹及数码相机的性能,因此也很难拍出背景虚化效果较好的照片,即主体比较清晰,背景比较模糊的照片。Camera modules on mobile phones such as smart phones and tablets are limited by the size of the camera, and the performance of the camera cannot match the performance of the digital camera. Therefore, it is difficult to take a photo with better background blur, that is, the main body comparison Clear, blurred background photos.

为了克服上述移动终端存在的缺陷,市面上的移动终端,尤其是智能手机,大多内置有双摄像头,通过两个摄像头模组拍摄出主体清晰背景虚化的照片。其主要原理是:在双摄像头拍摄预览模式下,终端利用两个摄像头模组,从不同角度同步获取当前场景的预览图;在预览图中,根据双摄像头模组之间的距离和角度所产生的相位差,计算出一预览图中所包含的各像素单元的景深深度;利用各像素单元的景深信息来实现前景区域(即拍摄主体所在区域)和背景区域的分离,从而实现背景区域的虚化处理。In order to overcome the shortcomings of the above mobile terminals, mobile terminals on the market, especially smart phones, mostly have built-in dual cameras, and through the two camera modules, photographs with clear background blur of the subject are taken. The main principle is: in the dual camera shooting preview mode, the terminal uses two camera modules to synchronously obtain a preview of the current scene from different angles; in the preview image, according to the distance and angle between the dual camera modules The phase difference is calculated, and the depth of field of each pixel unit included in a preview image is calculated; the depth of field information of each pixel unit is used to realize the separation of the foreground area (ie, the area where the subject is located) and the background area, thereby realizing the virtual area of the background area. Processing.

虽然具备双摄像头模组的终端能够拍摄出背景虚化的照片,但是相比于单个摄像头模组的终端,具备双摄像头模组的终端成本较高。Although the terminal with the dual camera module can capture the blurred background photos, the terminal cost of the dual camera module is higher than that of the terminal of the single camera module.

发明内容Summary of the invention

为了解决上述技术问题,节约整机成本,本发明实施例期望提供一种背景虚化方法、设备、终端及存储介质,旨在仅利用单个摄像头模组,即可拍摄出具有背景虚化效果的照片。In order to solve the above technical problem and save the whole machine cost, the embodiment of the present invention is expected to provide a background blurring method, device, terminal and storage medium, which is intended to capture a background blur effect by using only a single camera module. photo.

第一方面,本发明实施例提供了一种背景虚化方法,应用于单个摄像头模组,所述方法包括:In a first aspect, an embodiment of the present invention provides a background blurring method, which is applied to a single camera module, and the method includes:

按照预设的划分策略将预览画面划分为至少一个子区域画面;Dividing the preview picture into at least one sub-area picture according to a preset division strategy;

获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数;Acquiring the phase focus parameter of the at least one sub-area picture and the preset central area picture;

根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息;Acquiring at least one relative distance information between the at least one sub-area picture and the preset central area picture according to the at least one sub-area picture and the phase focus parameter of the preset central area picture;

从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面;Determining at least one sub-area picture to be blurred by the at least one sub-area picture;

根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化处理的子区域画面进行虚化处理。Performing, according to a preset blurring policy, the at least one sub-area picture to be blurred according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture Blurring processing.

在上述方案中,所述按照预设的划分策略将预览画面划分为至少一个子区域画面,包括:In the foregoing solution, the dividing the preview picture into the at least one sub-area picture according to the preset division policy includes:

根据所述预览画面信息分析所述预览画面的画面复杂度;And analyzing, according to the preview screen information, a screen complexity of the preview screen;

根据所述预览画面的画面复杂度将所述预览画面划分为至少一个子区域画面。The preview picture is divided into at least one sub-area picture according to the picture complexity of the preview picture.

在上述方案中,所述相位对焦参数,包括:所述至少一个子区域画面以及预设的中心区域画面的二维增益图数据和相位差转换系数;其中,所述二维增益图数据包括所述至少一个子区域画面以及预设的中心区域画面 的左图像数据和右图像数据。In the above aspect, the phase focusing parameter includes: the at least one sub-region picture and the two-dimensional gain map data and the phase difference conversion coefficient of the preset central region picture; wherein the two-dimensional gain map data includes The at least one sub-area picture and the left image data and the right image data of the preset center area picture are described.

在上述方案中,所述获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,包括:In the above solution, the acquiring the phase focus parameter of the at least one sub-area picture and the preset central area picture includes:

基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元件,通过所述感光元件中预设的像素对的左像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的左图像数据;Obtaining the at least one sub-area picture and the preset central area respectively by the left pixel points of the preset pixel pair in the photosensitive element based on the at least one sub-area picture and the photosensitive element corresponding to the preset central area picture Left image data of the screen;

基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元件,通过所述感光元件中预设的像素对的右像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的右图像数据;Obtaining the at least one sub-area picture and the preset central area respectively by the right pixel point of the preset pixel pair in the photosensitive element based on the at least one sub-area picture and the photosensitive element corresponding to the preset central area picture Right image data of the screen;

根据预设的相位差转换系数生成算法获取所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数。Acquiring the phase difference conversion coefficients of the at least one sub-area picture and the preset central area picture according to a preset phase difference conversion coefficient generation algorithm.

在上述方案中,所述根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息,包括:In the above solution, the acquiring at least one relative distance information between the at least one sub-area picture and the preset central area picture according to the phase focus parameter of the at least one sub-area picture and the preset central area picture ,include:

分别对所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据进行校准,使得所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据的波峰值相等;And calibrating left image data and right image data of the at least one sub-area picture and the preset central area picture, respectively, such that the at least one sub-area picture and the left image data and the right image data of the preset central area picture The peaks of the waves are equal;

分别计算所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差;Calculating, respectively, a phase difference between the calibrated left image data and the right image data of the at least one sub-area picture and the preset central area picture;

根据所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差与所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数之间预设的比例关系,获取所述至少一个子区域画面以及预设的中心区域画面的散焦距离;Converting a phase difference between the calibrated left image data and the right image data of the at least one sub-region picture and the preset central region picture and the phase difference of the at least one sub-region picture and the preset central region picture Presetting a proportional relationship between the coefficients, acquiring a defocus distance of the at least one sub-area picture and the preset central area picture;

以预设的中心区域画面的散焦距离为基准,计算所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差;Calculating a defocus distance difference between the at least one sub-area picture and the preset central area picture based on a defocus distance of the preset central area picture;

根据所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。Obtaining at least one relative distance information between the at least one sub-area picture and the preset central area picture according to a defocus distance difference between the at least one sub-area picture and the preset central area picture.

在上述方案中,在从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面之前,所述方法还包括:In the above solution, before determining at least one sub-area picture to be blurred by the at least one sub-area picture, the method further includes:

接收用于拍照的触控指令,将所述预览画面生成第一目标图像,并保存所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。Receiving a touch instruction for photographing, generating the first target image by the preview image, and saving at least one relative distance information between the at least one sub-region image and the preset central region image.

在上述方案中,所述从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面,包括:In the foregoing solution, the determining, by the at least one sub-area picture, the at least one sub-area picture to be blurred, includes:

通过终端屏幕显示所述第一目标图像,并根据所述终端屏幕接收的触控操作在所述第一目标图像上的位置,从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面。Displaying, by the terminal screen, the first target image, and determining, according to the position of the touch operation received by the terminal screen on the first target image, at least one to be blurred from the at least one sub-region image Sub-area picture.

在上述方案中,所述根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化处理的子区域画面进行虚化处理,包括:In the above solution, the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture is at least one to be virtualized according to a preset blurring policy. The processed sub-area picture is blurred, including:

根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,确定所述至少一个待虚化处理的子区域画面的虚化级别;Determining, according to the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, a blur level of the at least one sub-area picture to be blurred;

根据所述至少一个待虚化处理的子区域画面的虚化级别,对所述至少一个待虚化处理的子区域画面进行虚化处理。Performing a blurring process on the at least one sub-area picture to be blurred according to the blur level of the at least one sub-area picture to be blurred.

第二方面,本发明实施例提供了一种背景虚化设备,所述设备包括:区域划分模块、相位对焦参数获取模块、相对距离获取模块、待虚化区域确定模块和虚化处理模块;其中,In a second aspect, an embodiment of the present invention provides a background blurring device, where the device includes: a region dividing module, a phase focusing parameter acquiring module, a relative distance acquiring module, a to-be-demagnetized region determining module, and a blurring processing module; ,

所述区域划分模块,配置为按照预设的划分策略将预览画面划分为至 少一个子区域画面;The area dividing module is configured to divide the preview picture into at least one sub-area picture according to a preset dividing policy;

所述相位对焦参数获取模块,配置为获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数;The phase focus parameter acquisition module is configured to acquire the phase focus parameter of the at least one sub-area picture and the preset central area picture;

所述相对距离获取模块,配置为根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息;The relative distance acquisition module is configured to acquire at least one relative between the at least one sub-area picture and the preset central area picture according to the at least one sub-area picture and the phase focus parameter of the preset central area picture Distance information;

所述待虚化区域确定模块,配置为从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面;The to-be-ambiguous area determining module is configured to determine, from the at least one sub-area picture, at least one sub-area picture to be blurred;

所述虚化处理模块,配置为根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化处理的子区域画面进行虚化处理。The imaginary processing module is configured to: according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, the at least one according to a preset blurring policy The sub-area picture to be blurred is subjected to blurring processing.

在上述方案中,所述相对距离获取模块,配置为:In the above solution, the relative distance obtaining module is configured to:

分别对所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据进行校准,使得所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据的波峰值相等;And calibrating left image data and right image data of the at least one sub-area picture and the preset central area picture, respectively, such that the at least one sub-area picture and the left image data and the right image data of the preset central area picture The peaks of the waves are equal;

分别计算所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差;Calculating, respectively, a phase difference between the calibrated left image data and the right image data of the at least one sub-area picture and the preset central area picture;

根据所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差与所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数之间预设的比例关系,获取所述至少一个子区域画面以及预设的中心区域画面的散焦距离;Converting a phase difference between the calibrated left image data and the right image data of the at least one sub-region picture and the preset central region picture and the phase difference of the at least one sub-region picture and the preset central region picture Presetting a proportional relationship between the coefficients, acquiring a defocus distance of the at least one sub-area picture and the preset central area picture;

以预设的中心区域画面的散焦距离为基准,计算所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差;Calculating a defocus distance difference between the at least one sub-area picture and the preset central area picture based on a defocus distance of the preset central area picture;

根据所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个 相对距离信息。Obtaining at least one relative distance information between the at least one sub-area picture and the preset central area picture according to a defocus distance difference between the at least one sub-area picture and the preset central area picture.

在上述方案中,所述虚化处理模块,配置为:In the above solution, the imaginary processing module is configured to:

根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,确定所述至少一个待虚化处理的子区域画面的虚化级别;Determining, according to the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, a blur level of the at least one sub-area picture to be blurred;

根据所述至少一个待虚化处理的子区域画面的虚化级别,对所述至少一个待虚化处理的子区域画面进行虚化处理。Performing a blurring process on the at least one sub-area picture to be blurred according to the blur level of the at least one sub-area picture to be blurred.

第三方面,本发明实施例提供了一种背景虚化设备,所述设备包括:通信接口、存储器、处理器和总线;其中,In a third aspect, an embodiment of the present invention provides a background blurring device, where the device includes: a communication interface, a memory, a processor, and a bus;

所述总线用于连接所述通信接口、所述处理器和所述存储器以及这些器件之间的相互通信;The bus is configured to connect the communication interface, the processor and the memory, and mutual communication between the devices;

所述通信接口,配置为与外部网元进行数据传输;The communication interface is configured to perform data transmission with an external network element;

所述存储器,配置为存储指令和数据;The memory is configured to store instructions and data;

所述处理器,配置为执行所述指令以实现上述的背景虚化方法。The processor is configured to execute the instructions to implement the background blurring method described above.

第四方面,本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现上述的背景虚化方法。In a fourth aspect, an embodiment of the present invention provides a computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors, To achieve the above background blurring method.

第五方面,本发明实施例提供了一种终端,所述终端包括上述第二方面或第三方面任一所述的背景虚化设备。In a fifth aspect, the embodiment of the present invention provides a terminal, where the terminal includes the background blurring device of any of the second aspect or the third aspect.

应用本发明实施例提供的背景虚化方法、设备、终端及存储介质,利用智能手机、平板等移动终端内置的相位对焦技术,在对预览画面进行区域划分的基础上,能够根据各子区域画面所的相位对焦参数,获取各子区域画面与预设的中心区域画面之间的相对距离,并在确定至少一个待虚化处理的子区域画面之后,能够根据至少一个待虚化处理的子区域画面与中心区域画面之间的相对距离,对至少一个待虚化处理的子区域画面进行相 应的虚化处理。该方法使得智能手机、平板等移动终端仅使用一个摄像头模组即可拍摄出具有背景虚化效果的照片,相比于双摄像头模组的终端,该方法大大降低了整机成本。The background blurring method, device, terminal and storage medium provided by the embodiments of the present invention can use the phase focusing technology built in the mobile terminal such as a smart phone or a tablet to perform area division on the preview screen, and can be based on each sub-area screen. The phase focusing parameter obtains a relative distance between each sub-area picture and a preset central area picture, and after determining at least one sub-area picture to be blurred, can be based on at least one sub-area to be blurred The relative distance between the picture and the picture of the central area is subjected to corresponding blurring processing on at least one picture of the sub-area to be blurred. The method enables a mobile terminal such as a smart phone or a tablet to capture a photo with a background blur effect using only one camera module, and the method greatly reduces the overall machine cost compared to the terminal of the dual camera module.

附图说明DRAWINGS

图1为本发明实施例提供的一种背景虚化方法示意图;1 is a schematic diagram of a background blurring method according to an embodiment of the present invention;

图2为本发明实施例提供的一种预览画面的界面显示示意图;2 is a schematic diagram of an interface display of a preview screen according to an embodiment of the present invention;

图3为本发明实施例提供的一种预览画面的划分方法示意图;FIG. 3 is a schematic diagram of a method for dividing a preview picture according to an embodiment of the present disclosure;

图4为本发明实施例提供的一种获取相位对焦参数的方法示意图;4 is a schematic diagram of a method for acquiring a phase focus parameter according to an embodiment of the present invention;

图5为本发明实施例提供的一种遮蔽像素点的工作原理图;FIG. 5 is a schematic diagram of a working principle of shielding pixel points according to an embodiment of the present invention; FIG.

图6为本发明实施例提供的一种子区域画面与相位差转换系数的对应关系示意图;FIG. 6 is a schematic diagram of a correspondence relationship between a sub-area picture and a phase difference conversion coefficient according to an embodiment of the present invention;

图7为本发明实施例提供的一种校准前后的左图像数据和右图像数据的波形示意图;FIG. 7 is a schematic diagram of waveforms of left image data and right image data before and after calibration according to an embodiment of the present invention; FIG.

图8为本发明实施例提供的一种背景虚化模式下的终端界面图;FIG. 8 is a schematic diagram of a terminal interface in a background blur mode according to an embodiment of the present invention;

图9为本发明实施例提供的一种对至少一个待虚化处理的子区域画面进行虚化处理的方法示意图;FIG. 9 is a schematic diagram of a method for performing blur processing on at least one sub-area picture to be blurred according to an embodiment of the present disclosure;

图10本发明实施例提供的一种背景虚化方法的实施过程示意图;FIG. 10 is a schematic diagram of an implementation process of a background blurring method according to an embodiment of the present invention; FIG.

图11为本发明实施例提供的一种背景虚化设备的结构示意图;FIG. 11 is a schematic structural diagram of a background blurring device according to an embodiment of the present disclosure;

图12为本发明实施例提供的另一种背景虚化设备的结构示意图;FIG. 12 is a schematic structural diagram of another background blurring device according to an embodiment of the present disclosure;

图13为本发明实施例提供的又一种背景虚化设备的结构示意图;FIG. 13 is a schematic structural diagram of still another background blur device according to an embodiment of the present invention;

图14为本发明实施例提供的再一种背景虚化设备的结构示意图;FIG. 14 is a schematic structural diagram of still another background blur device according to an embodiment of the present disclosure;

图15为本发明实施例提供的一种背景虚化终端的结构示意图。FIG. 15 is a schematic structural diagram of a background blurring terminal according to an embodiment of the present invention.

具体实施方式detailed description

时至今日,智能手机、平板等移动终端的相机功能已得到了迅速发展, 尤其在智能手机上采用更大的相机传感器经过几次大的升级浪潮,已经很难再有较大的突破,因此,为智能手机等移动终端加入更先进的对焦技术成为了提升手机拍照性能的新方向。Today, the camera functions of mobile phones such as smartphones and tablets have been rapidly developed. Especially after using a larger camera sensor on a smartphone, after several large upgrades, it is difficult to make a big breakthrough. Adding more advanced focusing technology to mobile terminals such as smart phones has become a new direction to improve the camera performance of mobile phones.

目前,在智能手机等移动终端上采用的自动对焦技术主要包括反差对焦(CDAFA,Contrast Detection Auto Focus)、相位对焦(PDAF,Phase Detection Auto Focus)和激光对焦(LDAF,Laser Detection Auto Focus)技术。At present, the autofocus technology adopted on mobile terminals such as smart phones mainly includes CDAFA (Contrast Detection Auto Focus), Phase Focus (PDAF, Phase Detection Auto Focus) and Laser Focus Auto (LDAF) technology.

其中,反差对焦是目前普及率最高、使用最广泛、成本相对较低的自动对焦技术,它又被成为对比度对焦。其基本原理是:当我们对准被摄物体时,镜头模组内的马达便会驱动镜片从底部向顶部移动,在这个过程中,像素传感器将会对整个场景范围进行纵深方向上的全面检测,并持续记录对比度等反差数值。找出反差最大位置后,运动到顶部的镜片则会重新回到该位置,完成最终的对焦。所以反差对焦的一个主要缺点就是耗费的时间较长。Among them, contrast focusing is the most popular, most widely used, and relatively low cost autofocus technology, and it has become contrast focus. The basic principle is that when we aim at the subject, the motor in the lens module will drive the lens to move from the bottom to the top. In the process, the pixel sensor will comprehensively detect the entire scene range in the depth direction. And continue to record contrast values such as contrast. After finding the maximum contrast position, the lens that moves to the top will return to that position to complete the final focus. So one of the main drawbacks of contrast focusing is that it takes a long time.

相位对焦技术因其对焦速度快,从而克服了反差对焦所存在的上述缺陷。其基本原理是:从感光元件上拿出左右相对的成对像素点,分别对场景中的物体进行进光量等信息的检测,通过比对左右两侧的相关值情况,便会迅速找出准确的对焦点,之后镜间马达便会一次性将镜片推动到相应位置完成对焦。Phase focusing technology overcomes the above-mentioned drawbacks of contrast focusing because of its fast focusing speed. The basic principle is: take out the pair of opposite pixels from the photosensitive element, and respectively detect the amount of light entering the object in the scene, and compare the relative values of the left and right sides to quickly find out the accuracy. The focus point, after which the mirror motor will push the lens to the corresponding position to complete the focus.

基于此,本发明实施例将利用智能手机、平板等移动终端所具备的相位对焦技术,在移动终端内置单个摄像头模组的条件下,提供一种背景虚化方法、设备及终端。Based on this, the embodiment of the present invention provides a background blurring method, device and terminal under the condition that a mobile terminal has a single camera module built by using a phase focusing technology provided by a mobile terminal such as a smart phone or a tablet.

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present invention will be clearly and completely described in the following with reference to the accompanying drawings.

如图1所示,该图给出了本发明实施例提供的一种背景虚化方法,从 图中可以看出,该方法可以包括:As shown in FIG. 1, the figure shows a background blurring method provided by an embodiment of the present invention. As can be seen from the figure, the method may include:

S110、按照预设的划分策略将预览画面划分为至少一个子区域画面。S110. Divide the preview picture into at least one sub-area picture according to a preset division strategy.

S120、获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数。S120. Acquire the phase focus parameter of the at least one sub-area picture and the preset central area picture.

这里,需要说明的是,在执行步骤S120之前,可以根据终端触摸屏上接收的触控操作在所述预览画面中的位置,确定包含有拍摄主体的中心区域画面。可以理解地,通常情况下,用户在利用智能手机等移动终端进行拍照时,如图2所示,图2中编号1所示为预览画面,编号2所示为对焦框,编号3所示为提示信息,编号4所示拍照键;为了使拍摄主体更清晰,通常会通过触控操作点击预览画面中拍摄主体所在的位置,以此来实现拍摄主体的准确对焦,而此时终端可以根据图2所示的对焦框的位置确定包含有拍摄主体的中心区域画面。Here, it should be noted that, before the step S120 is performed, the central area screen including the shooting subject may be determined according to the position of the touch operation received on the touch screen of the terminal in the preview screen. Understandably, when a user takes a picture with a mobile terminal such as a smart phone, as shown in FIG. 2, the number 1 in FIG. 2 is a preview screen, the number 2 is a focus frame, and the number 3 is Prompt information, number 4 is the camera button; in order to make the subject clearer, the position of the subject in the preview screen is usually clicked by the touch operation, so as to achieve accurate focusing of the subject, and the terminal can be based on the figure. The position of the focus frame shown in 2 determines the center area screen of the subject.

S130、根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。S130. Acquire at least one relative distance information between the at least one sub-area picture and the preset central area picture according to the at least one sub-area picture and the phase focus parameter of the preset central area picture.

S140、从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面。S140. Determine, from the at least one sub-area picture, at least one sub-area picture to be blurred.

S150、根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化处理的子区域画面进行虚化处理。S150. The at least one sub-region to be blurred according to a preset blurring policy according to at least one relative distance information between the at least one sub-region image to be blurred and the preset central region image The screen is blurred.

示例性地,对于步骤S110,所述按照预设的划分策略将预览画面划分为至少一个子区域画面,如图3所示,可以包括如下:For example, in step S110, the preview picture is divided into at least one sub-area picture according to a preset division policy, as shown in FIG. 3, which may include the following:

S1101、根据所述预览画面信息分析所述预览画面的画面复杂度;S1101: analyzing, according to the preview screen information, a screen complexity of the preview screen;

S1102、根据所述预览画面的画面复杂度将所述预览画面划分为至少一个子区域画面。S1102: The preview picture is divided into at least one sub-area picture according to a picture complexity of the preview picture.

可以理解地,画面复杂度(IC,Image Complexity)是对图像内在的复杂程度的描述,因此,画面复杂度越高,对预览画面的区域划分越细致,得到的子区域画面的数目越多;反之,画面复杂度越低,对预览画面的区域划分越简单,得到的子区域画面的数目越少。这里,对于基于画面复杂度的图像分割方法,因为该方法属于图像处理领域中的现有技术,因此,此处不再赘述。It can be understood that the image complexity (IC) is a description of the inherent complexity of the image. Therefore, the higher the complexity of the image, the more detailed the region of the preview image is, and the more the number of sub-region images obtained; Conversely, the lower the complexity of the picture, the simpler the division of the area of the preview picture, and the smaller the number of sub-area pictures obtained. Here, for the image segmentation method based on the screen complexity, since the method belongs to the prior art in the field of image processing, it will not be described herein.

示例性地,对于步骤S120中所述的相位对焦参数,可以包括:所述至少一个子区域画面以及预设的中心区域画面的二维增益图数据(2DGMD,Two-dimension Gain Map Data)和相位差转换系数(PDCC,Phase Difference Conversion Coefficient);其中,所述二维增益图数据包括所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据。For example, the phase focus parameter described in step S120 may include: the at least one sub-area picture and the two-dimensional gain map data (2DGMD, Two-dimension Gain Map Data) and the phase of the preset central area picture. a difference difference conversion coefficient (PDCC), wherein the two-dimensional gain map data includes left image data and right image data of the at least one sub-area picture and a preset central area picture.

相应地,对于步骤S120,所述获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,如图4所示,可以包括如下:Correspondingly, for step S120, the acquiring the phase focus parameter of the at least one sub-area picture and the preset central area picture, as shown in FIG. 4, may include the following:

S1201、基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元件,通过所述感光元件中预设的像素对的左像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的左图像数据;S1201, based on the at least one sub-region picture and the photosensitive element corresponding to the preset central area picture, respectively acquiring the at least one sub-area picture and the preset by the left pixel point of the preset pixel pair in the photosensitive element Left image data of the center area screen;

S1202、基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元件,通过所述感光元件中预设的像素对的右像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的右图像数据;S1202, based on the at least one sub-region picture and the photosensitive element corresponding to the preset central area picture, respectively acquiring the at least one sub-area picture and the preset by the right pixel point of the preset pixel pair in the photosensitive element Right image data of the center area screen;

S1203、根据预设的相位差转换系数生成算法获取所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数。S1203. Acquire a phase difference conversion coefficient of the at least one sub-area picture and the preset central area picture according to a preset phase difference conversion coefficient generation algorithm.

这里,需要说明的是,传统的单反相机拥有对焦传感器,在反光板背面安装有副反光板,副反光板会把镜头入射的部分光线送到对焦传感器上,通过测距确定焦点,再由系统控制镜头的移动完成自动对焦。但是,由于手机、平板等终端受摄像头模组高度集成的要求,所以不能够直接内置独 立的对焦传感器。基于此,如图5所示,人们直接在图像传感器的感光元件上预留出一些成对儿的左右相对的遮蔽像素点来进行相位检测;成对的遮蔽像素点如图5(a)中阴影圆形部分所示,从图中可以看出,遮蔽像素点由左右两个像素点成对组成。因此,对焦系统可以通过左右像素点分别获得的图像数据之间的差异性(如像素之间的距离)来决定对焦的偏移值,从而实现准确对焦;其中,左右像素点分别获得的左图像数据和右图像数据的波形图如图5(b)所示。Here, it should be noted that the conventional SLR camera has a focus sensor, and a sub-reflector is mounted on the back of the reflector, and the sub-reflector sends a part of the light incident on the lens to the focus sensor, and the focus is determined by the distance measurement, and then the system Control the movement of the lens to complete autofocus. However, since terminals such as mobile phones and tablets are highly integrated by the camera module, it is not possible to directly integrate a separate focus sensor. Based on this, as shown in FIG. 5, people directly reserve some paired left and right opposite shielding pixels on the photosensitive element of the image sensor for phase detection; the paired shielding pixel points are as shown in FIG. 5(a). As shown by the shaded circle, it can be seen from the figure that the shadow pixel is composed of two left and right pixel points in pairs. Therefore, the focusing system can determine the offset value of the focus by the difference between the image data obtained by the left and right pixel points respectively (such as the distance between the pixels), thereby achieving accurate focusing; wherein the left image obtained by the left and right pixel points respectively The waveforms of the data and the right image data are shown in Fig. 5(b).

以预览画面被分割成一个子区域画面为例,通过摄像头模组生成所述至少一个子区域画面的二维增益图数据的方法,可以包括如下:For example, the method for generating the two-dimensional gain map data of the at least one sub-region image by the camera module may be as follows:

S1201a、设置测试场景,即拍摄目标采用一个黑白相间的竖条纹板卡,将镜头初始位置置于微距(macro)与无穷远(infinity)的中间位置,物距设为20cm,光源采用D65,亮度值的取值范围为(800,1000),数字增益和模拟增益均设为1X且无带状。S1201a, set the test scene, that is, the shooting target uses a black and white vertical stripe card, the initial position of the lens is placed in the middle of macro and infinity, the object distance is set to 20cm, and the light source adopts D65. The brightness value ranges from (800, 1000), and both the digital gain and the analog gain are set to 1X and no band.

S1202a、通过所述镜头获取所述拍摄目标的原始图像数据。S1202a. Acquire original image data of the shooting target through the lens.

这里,需要说明的是,所述镜头可以通过拍摄一次所述拍摄目标,获取一张原始图像数据,也可以通过拍摄多次所述拍摄目标,获取多张原始图像数据。但是,需要注意的是,当获取多张原始图像数据时,需要对获取的多张原始图像数据进行均值计算,并将均值计算后得到的平均图像数据输入到下述接口函数PDAF_Cal_GainMap(…)中。Here, it should be noted that the lens may acquire one piece of original image data by capturing the shooting target once, or may acquire a plurality of pieces of original image data by capturing the shooting target a plurality of times. However, it should be noted that when acquiring multiple pieces of original image data, it is necessary to perform mean calculation on the acquired plurality of original image data, and input the average image data obtained by the mean calculation into the following interface function PDAF_Cal_GainMap(...). .

S1203a、调用高通工具中的接口函数PDAF_Cal_GainMap(…),将所述拍摄目标的原始图像数据输入到所述接口函数PDAF_Cal_GainMap(…),在不设置参数Multipleregions的条件下,输出所述至少一个子区域画面的二维增益图数据;其中,所述二维增益图数据包括所述摄像头模组通过预设的像素对中的左像素点获取的左图像数据和所述像素对中的右像素点获取的右图像数据。S1203a, calling the interface function PDAF_Cal_GainMap (...) in the Qualcomm tool, inputting the original image data of the shooting target to the interface function PDAF_Cal_GainMap (...), and outputting the at least one sub-region without setting the parameter Multipleregions Two-dimensional gain map data of the screen; wherein the two-dimensional gain map data includes left image data acquired by the camera module through a left pixel point of a preset pixel pair and right pixel point acquisition in the pixel pair Right image data.

这里,需要说明的是,参数Multipleregions为一变量,用于表示将预览画面进行区域划分后得到的子区域画面的数目,例如,将预览画面划分为3×3的子区域画面,即将参数Multipleregions设置为3×3,则通过接口函数PDAF_Cal_GainMap(…)可以得到每个子区域画面的二维增益图数据;因此,在不设置参数Multipleregions的条件下,也就是说,在将参数Multipleregions的值设为1的条件下,所述预览画面被划分为一个子区域画面,相应地,通过接口函数PDAF_Cal_GainMap(…)可以得到该子区域画面(即整个预览画面)的相位差转换系数。Here, it should be noted that the parameter Multipleregions is a variable for indicating the number of sub-area pictures obtained by dividing the preview picture into regions, for example, dividing the preview picture into 3×3 sub-area pictures, that is, setting the parameter Multipleregions. For 3×3, the two-dimensional gain map data of each sub-area picture can be obtained through the interface function PDAF_Cal_GainMap(...); therefore, under the condition that the parameter Multipleregions is not set, that is, the value of the parameter Multipleregions is set to 1 The preview picture is divided into a sub-area picture, and correspondingly, the phase difference conversion coefficient of the sub-area picture (ie, the entire preview picture) can be obtained by the interface function PDAF_Cal_GainMap (...).

相应地,可以通过摄像头模组内置的相位差转换系数生成算法获取所述至少一个子区域画面的相位差转换系数,生成算法可以包括:Correspondingly, the phase difference conversion coefficient of the at least one sub-area picture may be acquired by a phase difference conversion coefficient generation algorithm built in the camera module, and the generating algorithm may include:

S1201b、设置测试场景,即拍摄目标采用一个黑板相间的竖条纹板卡,将镜头初始位置置于微距(macro)与无穷远(infinity)的中间位置,物距设为20cm,光源采用D65,亮度值的取值范围为(800,1000),数字增益和模拟增益均设为1X且无带状。S1201b, set the test scene, that is, the shooting target adopts a vertical stripe board with a blackboard, and the initial position of the lens is placed in the middle of macro and infinity, the object distance is set to 20cm, and the light source adopts D65. The brightness value ranges from (800, 1000), and both the digital gain and the analog gain are set to 1X and no band.

这里,需要说明的是,在一实施例中,亮度值设为880。Here, it should be noted that, in one embodiment, the luminance value is set to 880.

S1202b、控制马达将镜头从初始位置处向无穷远方向移动80%,待马达稳定后,拍摄第一原始图像,并记录镜头位置为LensPosition1。S1202b, the control motor moves the lens from the initial position to the infinity direction by 80%. After the motor is stabilized, the first original image is taken, and the lens position is recorded as LensPosition1.

S1203b、控制马达将镜头返回到初始位置。S1203b, control the motor to return the lens to the initial position.

S1204b、控制马达将镜头从初始位置处向微距方向移动80%,待马达稳定后,拍摄第二原始图像,并记录镜头位置为LensPosition2。S1204b, the control motor moves the lens from the initial position to the macro direction by 80%. After the motor is stabilized, the second original image is taken, and the lens position is recorded as LensPosition2.

S1205b、调用高通校准工具中的接口函数PDAF_Cal_PDConversionCoef(…),将第一原始图像数据、第二原始图像数据、LensPosition1、LensPosition2、二维增益图数据输入到接口函数PDAF_Cal_PDConversionCoef(…)中,在不设置参数Multipleregions的条件下,输出所述至少一个子区域画面的第一相位差转换系数K1。S1205b, calling the interface function PDAF_Cal_PDConversionCoef(...) in the Qualcomm calibration tool, inputting the first original image data, the second original image data, the LensPosition1, the LensPosition2, and the two-dimensional gain map data into the interface function PDAF_Cal_PDConversionCoef(...), without setting The first phase difference conversion coefficient K1 of the at least one sub-region picture is output under the condition of the parameter Multipleregions.

这里,需要说明的是,参数Multipleregions为一变量,用于表示将预览画面进行区域划分后得到的子区域画面的数目,例如,如图6(a)所示,将预览画面划分为3×3的子区域画面,即将参数Multipleregions设置为3×3,则通过接口函数PDAF_Cal_PDConversionCoef(…)可以得到每个子区域画面的相位差转换系数,参见图6(b)。因此,在不设置参数Multipleregions的条件下,也就是说,在将参数Multipleregions的值设为1的条件下,所述预览画面被划分为一个子区域画面,相应地,通过接口函数PDAF_Cal_PDConversionCoef(…)可以得到该子区域画面(即整个预览画面)的相位差转换系数。Here, it should be noted that the parameter Multipleregions is a variable for indicating the number of sub-area pictures obtained by dividing the preview picture into regions, for example, as shown in FIG. 6( a ), the preview picture is divided into 3×3. The sub-area picture, that is, the parameter Multipleregions is set to 3×3, the phase difference conversion coefficient of each sub-area picture can be obtained by the interface function PDAF_Cal_PDConversionCoef(...), see FIG. 6(b). Therefore, under the condition that the parameter Multipleregions is not set, that is, under the condition that the value of the parameter Multipleregions is set to 1, the preview picture is divided into a sub-area picture, and correspondingly, through the interface function PDAF_Cal_PDConversionCoef(...) A phase difference conversion coefficient of the sub-area picture (ie, the entire preview picture) can be obtained.

S1206b、控制马达将镜头从初始位置处分别向无穷远方向和微距方向移动60%,重复步骤S1302b至S1305b,输出所述至少一个子区域画面的第二相位差转换系数K2。S1206b, the control motor moves the lens from the initial position to the infinity direction and the macro direction by 60%, and repeats steps S1302b to S1305b to output the second phase difference conversion coefficient K2 of the at least one sub-region picture.

S1207b、将物距调整为50cm后,重复步骤S1302b至S1306b,分别输出所述至少一个子区域画面的第三相位差转换系数K3和第四相位差转换系数K4。S1207b. After adjusting the object distance to 50 cm, steps S1302b to S1306b are repeated, and the third phase difference conversion coefficient K3 and the fourth phase difference conversion coefficient K4 of the at least one sub-region picture are respectively output.

S1208b、根据如下公式(1)计算相位差转换系数K1、K2、K3和K4的平均值,得到所述至少一个子区域画面的相位差转换系数K。S1208b, calculating an average value of the phase difference conversion coefficients K1, K2, K3, and K4 according to the following formula (1) to obtain a phase difference conversion coefficient K of the at least one sub-region picture.

K=(K1+K2+K3+K4)/4  (1);K=(K1+K2+K3+K4)/4 (1);

这里,相位差转换系数K的表达式为K=ΔX/PD,其中,PD表示所述至少一个子区域画面的左图像数据和右图像数据之间的相位差(PD,Phase Difference);ΔX表示所述至少一个子区域画面的散焦距离(DD,Defocus Distance)。Here, the expression of the phase difference conversion coefficient K is K=ΔX/PD, where PD represents a phase difference (PD, Phase Difference) between left image data and right image data of the at least one sub-region picture; ΔX represents Defocus distance (DD, Defocus Distance) of the at least one sub-area picture.

需要说明的是,预设的中心区域画面的二维增益图数据和相位差转换系数的获取方法与所述至少一个子区域画面的二维增益图数据和相位差转换系数的获取方法相同,因此,此处不再赘述。It should be noted that the method for acquiring the two-dimensional gain map data and the phase difference conversion coefficient of the preset central region picture is the same as the method for acquiring the two-dimensional gain map data and the phase difference conversion coefficient of the at least one sub-region picture, , will not repeat them here.

相应地,对于步骤S130,所述根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息,可以包括:Correspondingly, for step S130, the acquiring at least one relative between the at least one sub-area picture and the preset central area picture according to the phase focus parameter of the at least one sub-area picture and the preset central area picture Distance information can include:

S1301、分别对所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据进行校准,使得所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据的波峰值相等。S1301, respectively, calibrating left image data and right image data of the at least one sub-area picture and the preset central area picture, so that the at least one sub-area picture and the left image data and the right of the preset central area picture are respectively The peak values of the image data are equal.

可以理解地,由上述图4可知,所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据是根据所述至少一个子区域画面以及预设的中心区域画面各自对应的感光元件中预设的像素对的左像素点和右像素点获取的,因此,所述左图像数据和右图像数据是感光元件输出的结果。当感光元件输出的是光线强度时,则所述左图像数据和右图像数据的波峰值即为光线强度的最大值;当感光元件输出的像素值时,则所述左图像数据和右图像数据的波峰值即为像素值的最大值。It can be understood that, as shown in FIG. 4 above, the left image data and the right image data of the at least one sub-area picture and the preset central area picture are respectively corresponding according to the at least one sub-area picture and the preset central area picture. The left pixel point and the right pixel point of the preset pixel pair in the photosensitive element are acquired, and therefore, the left image data and the right image data are the result of the output of the photosensitive element. When the photosensitive element outputs light intensity, the peak value of the left image data and the right image data is the maximum value of the light intensity; when the pixel value output by the photosensitive element, the left image data and the right image data The peak value of the wave is the maximum value of the pixel value.

S1302、分别计算所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差。S1302. Calculate a phase difference between the calibrated left image data and the right image data of the at least one sub-area picture and the preset central area picture, respectively.

从图5(b)中可以看出,左右像素点实际获得的左图像数据和右图像数据的波峰值并不在同一个水平面上。因此,在计算所述左图像数据和所述右图像数据之间的相位差之前,如图7所示,还需要对所述左图像数据和所述右图像数据(参见图7(a))进行校准,使得两者的波峰值在同一个水平面上,从而方便计算所述左图像数据和右图像数据之间的相位差,校准结果参见图7(b)。这里,可以理解地,所述左图像数据和右图像数据之间的相位差指的是所述左图像数据和右图像数据之间的相对位置差。如图7(b)所示,左图像数据的波峰值对应的位置为L1,右图像数据的波峰值对应的位置为L2,容易得到,左图像数据和右图像数据之间的相位差为|L1-L2|。As can be seen from FIG. 5(b), the peak values of the left image data and the right image data actually obtained by the left and right pixel points are not on the same horizontal plane. Therefore, before calculating the phase difference between the left image data and the right image data, as shown in FIG. 7, the left image data and the right image data are also required (see FIG. 7(a)). The calibration is performed such that the peak values of the two are on the same horizontal plane, thereby facilitating calculation of the phase difference between the left image data and the right image data, and the calibration result is shown in Fig. 7(b). Here, it is understood that the phase difference between the left image data and the right image data refers to a relative position difference between the left image data and the right image data. As shown in FIG. 7(b), the position corresponding to the peak value of the left image data is L1, and the position corresponding to the peak value of the right image data is L2, which is easily obtained, and the phase difference between the left image data and the right image data is | L1-L2|.

S1303、根据所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差与所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数之间预设的比例关系,获取所述至少一个子区域画面以及预设的中心区域画面的散焦距离。S1303. The phase difference between the calibrated left image data and the right image data according to the at least one sub-area picture and the preset central area picture and the phase of the at least one sub-area picture and the preset central area picture Presetting a proportional relationship between the difference conversion coefficients, and acquiring a defocus distance of the at least one sub-area picture and the preset central area picture.

这里,所述预设的比例关系可以是如下公式(2)所示,因此,可以根据如下公式(2)计算所述至少一个子区域画面以及预设的中心区域画面的散焦距离:Here, the preset proportional relationship may be as shown in the following formula (2), and therefore, the defocus distance of the at least one sub-area picture and the preset central area picture may be calculated according to the following formula (2):

ΔX i=K i×PD i  (2); ΔX i =K i ×PD i (2);

其中,i用于标识各区域画面,ΔX i表示区域画面i的散焦距离;K i表示区域画面i的相位差转换系数;PD i表示区域画面i的左图像数据和右图像数据之间的相位差; Where i is used to identify each area picture, ΔX i represents the defocus distance of the area picture i; K i represents the phase difference conversion coefficient of the area picture i; PD i represents between the left picture data and the right picture data of the area picture i Phase difference

可以理解地,所谓散焦距离,指的是实际焦点与准确焦点之间的差值,实际反映的是子区域画面i在实现准确对焦时,镜头实际应该移动的距离。It can be understood that the so-called defocus distance refers to the difference between the actual focus and the accurate focus, and actually reflects the distance that the sub-area picture i should actually move when achieving accurate focusing.

S1304、以预设的中心区域画面的散焦距离为基准,计算所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差。S1304: Calculate a defocus distance difference between the at least one sub-area picture and the preset central area picture based on a defocus distance of the preset central area picture.

S1305、根据所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。S1305: Acquire at least one relative distance information between the at least one sub-area picture and the preset central area picture according to a defocus distance difference between the at least one sub-area picture and the preset central area picture.

这里,可以理解地,所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差越大,表明该子区域画面与中心区域画面之间的相对距离越远;反之,所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差越小,表明该子区域画面与中心区域画面之间的相对距离越近。因此,为了降低实施方案的复杂度,这里,可以直接利用所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差值来反映所述至少一个子区域画面与预设的中心区域画面之间的相对距离的大小。Here, it can be understood that the greater the defocus distance difference between the at least one sub-area picture and the preset central area picture, the further the relative distance between the sub-area picture and the central area picture is displayed; The smaller the defocus distance difference between the at least one sub-area picture and the preset central area picture, the closer the relative distance between the sub-area picture and the central area picture is. Therefore, in order to reduce the complexity of the implementation, here, the defocus distance difference between the at least one sub-area picture and the preset central area picture may be directly used to reflect the at least one sub-area picture and the preset The relative distance between the central area screens.

示例性地,在执行步骤S140之前,图1所示的方法还包括,Exemplarily, before performing step S140, the method shown in FIG. 1 further includes

接收用于拍照的触控指令,将所述预览画面生成第一目标图像,并保存所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。Receiving a touch instruction for photographing, generating the first target image by the preview image, and saving at least one relative distance information between the at least one sub-region image and the preset central region image.

相应地,对于步骤S140,所述从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面,可以包括:Correspondingly, for the step S140, the determining, by the at least one sub-area picture, the at least one sub-area picture to be blurred, may include:

通过终端屏幕显示所述第一目标图像,并根据所述终端屏幕接收的触控操作在所述第一目标图像上的位置,从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面。Displaying, by the terminal screen, the first target image, and determining, according to the position of the touch operation received by the terminal screen on the first target image, at least one to be blurred from the at least one sub-region image Sub-area picture.

例如,用户在通过手机拍照结束后,如图8所示,编号5所示为提示信息,编号6所示为当前处理模式,编号7所示为选择图片处理模式,打开相机相册中欲处理的图片,并将图片处理模式选择为背景虚化模式,此时,用户可以根据终端屏幕上所显示的提示信息“请选择处理区域”,来选择需要进行虚化处理的子区域画面。For example, after the user finishes photographing through the mobile phone, as shown in FIG. 8, the number 5 indicates the prompt information, the number 6 indicates the current processing mode, and the number 7 indicates the selected image processing mode, and the camera album is opened for processing. The picture is selected and the picture processing mode is selected as the background blur mode. At this time, the user can select the sub-area picture that needs to be blurred according to the prompt information “Please select the processing area” displayed on the terminal screen.

相应地,对于步骤S150,所述根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化处理的子区域画面进行虚化处理,如图9所示,可以包括:Correspondingly, in step S150, the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture is compared to the at least one according to a preset blurring policy. The sub-area picture to be blurred is subjected to blurring processing, as shown in FIG. 9, and may include:

S1501、根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,确定所述至少一个待虚化处理的子区域画面的虚化级别;S1501: Determine, according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, a blur level of the at least one sub-area picture to be blurred;

S1502、根据所述至少一个待虚化处理的子区域画面的虚化级别,对所述至少一个待虚化处理的子区域画面进行虚化处理。S1502: Perform a blurring process on the at least one sub-area picture to be blurred according to the blur level of the at least one sub-area picture to be blurred.

这里,可以理解地,所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的相对距离越远,对所述至少一个待虚化处理的子区域 画面的虚化程度就越高,也就是说,虚化处理后的子区域画面越模糊;反之,所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的相对距离越近,对所述至少一个待虚化处理的子区域画面的虚化程度就越低。Here, it can be understood that the farther the relative distance between the at least one sub-area picture to be blurred and the preset central area picture is, the degree of blurring of the at least one sub-area picture to be blurred. The higher the value, that is, the more blurred the sub-area picture after the blurring process; on the contrary, the closer the relative distance between the at least one sub-area picture to be blurred and the preset central area picture, the closer The degree of blurring of at least one of the sub-area pictures to be blurred is lower.

应用本发明实施例提供的背景虚化方法,利用智能手机、平板等移动终端内置的相位对焦技术,在对预览画面进行区域划分的基础上,能够根据各个子区域画面所的相位对焦参数,实现各个子区域画面不同程度的虚化处理。该方法使得智能手机、平板等移动终端仅使用一个摄像头模组即可拍摄出具有背景虚化效果的照片,相比于双摄像头模组的终端,大大降低了整机成本。Applying the background blurring method provided by the embodiment of the present invention, using the phase focusing technology built in the mobile terminal such as a smart phone or a tablet, based on the region division of the preview image, the phase focusing parameter of each sub-region image can be realized. Each sub-area screen has different degrees of blurring processing. The method enables a mobile terminal such as a smart phone or a tablet to capture a photo with a background blur effect using only one camera module, which greatly reduces the overall cost compared to the terminal of the dual camera module.

为了方便对上述技术方案的理解,如图10所示,该图给出了本发明实施例提供的背景虚化方法的另一实施过程,从图中可以看出,该实施过程包括:In order to facilitate the understanding of the above technical solution, as shown in FIG. 10, the figure shows another implementation process of the background blurring method provided by the embodiment of the present invention. As can be seen from the figure, the implementation process includes:

S901、根据所述预览画面信息分析所述预览画面的画面复杂度。S901. Analyze a screen complexity of the preview screen according to the preview screen information.

S902、根据所述预览画面的画面复杂度将所述预览画面划分为至少一个子区域画面。S902. The preview picture is divided into at least one sub-area picture according to a picture complexity of the preview picture.

S903、从摄像头模组预先生成的参数中获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数;其中,所述相位对焦参数包括所述至少一个子区域画面以及预设的中心区域画面的二维增益图数据和相位差转换系数;所述二维增益图数据包括所述摄像头模组通过预设的像素对的左像素点获取的左图像数据和所述像素对的右像素点获取的右图像数据。S903: Acquire a phase focus parameter of the at least one sub-area picture and a preset central area picture from parameters pre-generated by the camera module, where the phase focus parameter includes the at least one sub-area picture and a preset Two-dimensional gain map data and phase difference conversion coefficient of the central region picture; the two-dimensional gain map data includes left image data acquired by the camera module through a left pixel point of a preset pixel pair and a right of the pixel pair The right image data acquired by the pixel.

S904、分别对所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据进行校准,使得所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据的波峰值相等。S904. Align the left image data and the right image data of the at least one sub-area picture and the preset central area picture, respectively, such that the at least one sub-area picture and the left image data and the right of the preset central area picture are respectively The peak values of the image data are equal.

S905、分别计算所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差。S905. Calculate a phase difference between the calibrated left image data and the right image data of the at least one sub-area picture and the preset central area picture, respectively.

S906、根据如下公式计算所述至少一个子区域画面以及预设的中心区域画面的散焦距离。S906. Calculate a defocus distance of the at least one sub-area picture and the preset central area picture according to the following formula.

ΔX i=K i×PD i  (3); ΔX i =K i ×PD i (3);

其中,i用于标识各区域画面,ΔX i表示区域画面i的散焦距离;K i表示区域画面i的相位差转换系数;PD i表示区域画面i的左图像数据和右图像数据之间的相位差。 Where i is used to identify each area picture, ΔX i represents the defocus distance of the area picture i; K i represents the phase difference conversion coefficient of the area picture i; PD i represents between the left picture data and the right picture data of the area picture i Phase difference.

S907、以预设的中心区域画面的散焦距离为基准,计算所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差。S907: Calculate a defocus distance difference between the at least one sub-area picture and the preset central area picture based on a defocus distance of the preset central area picture.

S908、根据所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。S908. Acquire at least one relative distance information between the at least one sub-area picture and the preset central area picture according to a defocus distance difference between the at least one sub-area picture and the preset central area picture.

S909、接收用于拍照的触控指令,将所述预览画面生成第一目标图像,并保存所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。S909. Receive a touch instruction for photographing, generate a first target image by using the preview image, and save at least one relative distance information between the at least one sub-region image and the preset central region image.

S910、通过终端屏幕显示所述第一目标图像,并根据所述终端屏幕接收的触控操作在所述第一目标图像上的位置,从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面。S910. Display the first target image by using a terminal screen, and determine at least one to be blurred from the at least one sub-area picture according to a position of the touch operation received by the terminal screen on the first target image. The processed sub-area screen.

S911、根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,确定所述至少一个待虚化处理的子区域画面的虚化级别。S911: Determine, according to the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, a blur level of the at least one sub-area picture to be blurred.

S912、根据所述至少一个待虚化处理的子区域画面的虚化级别,对所述至少一个待虚化处理的子区域画面进行虚化处理。S912: Perform a blurring process on the at least one sub-area picture to be blurred according to the blur level of the at least one sub-area picture to be blurred.

通过上述背景虚化方法的实施过程可以看出,该方法能够利用智能手 机、平板等移动终端内置的相位对焦技术,在对预览画面进行区域划分的基础上,能够根据各子区域画面以及中心区域画面的相位对焦参数,获取各子区域画面与中心区域画面之间的相对距离,并在用户通过终端拍照将预览画面生成第一目标图像后,能够根据用户选择的子区域画面,确定至少一个待虚化处理的子区域画面,并根据至少一个待虚化处理的子区域画面与中心区域画面之间的相对距离,对该至少一个待虚化处理的子区域画面进行相应的虚化处理。It can be seen from the implementation process of the background blurring method that the method can utilize the phase focusing technology built in the mobile terminal such as a smart phone or a tablet, and based on the region division of the preview image, according to each sub-region image and the central region. The phase focus parameter of the picture is obtained, and the relative distance between each sub-area picture and the central area picture is obtained, and after the user generates a first target image by taking a picture through the terminal, the at least one to be determined according to the sub-area picture selected by the user. And blurring the processed sub-area picture, and performing corresponding blurring processing on the at least one sub-area picture to be blurred according to the relative distance between the at least one sub-area picture to be blurred and the central area picture.

基于前述相同的技术构思,如图11所示,该图给出了本发明实施例提供的一种背景虚化设备100,从图中可以看出,该设备100主要包括:区域划分模块1010、相位对焦参数获取模块1020、相对距离获取模块1030、待虚化区域确定模块1040和虚化处理模块1050;其中,Based on the foregoing technical concept, as shown in FIG. 11, the figure shows a background blurring device 100 according to an embodiment of the present invention. As can be seen from the figure, the device 100 mainly includes: a region dividing module 1010, a phase focus parameter acquisition module 1020, a relative distance acquisition module 1030, a to be blurred area determination module 1040, and a blurring processing module 1050;

所述区域划分模块1010,配置为按照预设的划分策略将预览画面划分为至少一个子区域画面;The area dividing module 1010 is configured to divide the preview picture into at least one sub-area picture according to a preset dividing policy;

所述相位对焦参数获取模块1020,配置为获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数;The phase focus parameter acquisition module 1020 is configured to acquire the phase focus parameter of the at least one sub-area picture and the preset central area picture;

所述相对距离获取模块1030,配置为根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息;The relative distance obtaining module 1030 is configured to acquire at least one of the at least one sub-area picture and the preset central area picture according to the at least one sub-area picture and the phase focus parameter of the preset central area picture. Relative distance information;

所述待虚化区域确定模块1040,配置为从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面;The to-be-ambiguous area determining module 1040 is configured to determine, from the at least one sub-area picture, at least one sub-area picture to be blurred;

所述虚化处理模块1050,配置为根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化处理的子区域画面进行虚化处理。The imaginary processing module 1050 is configured to: according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, according to a preset ambiguity policy A sub-area picture to be blurred is subjected to blurring processing.

在一实施例中,所述区域划分模块1010,还配置为:In an embodiment, the area dividing module 1010 is further configured to:

根据所述预览画面信息分析所述预览画面的画面复杂度;And analyzing, according to the preview screen information, a screen complexity of the preview screen;

根据所述预览画面的画面复杂度将所述预览画面划分为至少一个子区域画面。The preview picture is divided into at least one sub-area picture according to the picture complexity of the preview picture.

在上述方案中,所述相位对焦参数,可以包括:所述至少一个子区域画面以及预设的中心区域画面的二维增益图数据和相位差转换系数;其中,所述二维增益图数据包括所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据。In the above solution, the phase focusing parameter may include: the at least one sub-region picture and the two-dimensional gain map data and the phase difference conversion coefficient of the preset central region picture; wherein the two-dimensional gain map data includes The at least one sub-area picture and the left image data and the right image data of the preset center area picture.

在一实施例中,所述相位对焦参数获取模块1020,配置为:In an embodiment, the phase focus parameter acquisition module 1020 is configured to:

基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元件,通过所述感光元件中预设的像素对的左像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的左图像数据;Obtaining the at least one sub-area picture and the preset central area respectively by the left pixel points of the preset pixel pair in the photosensitive element based on the at least one sub-area picture and the photosensitive element corresponding to the preset central area picture Left image data of the screen;

基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元件,通过所述感光元件中预设的像素对的右像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的右图像数据;Obtaining the at least one sub-area picture and the preset central area respectively by the right pixel point of the preset pixel pair in the photosensitive element based on the at least one sub-area picture and the photosensitive element corresponding to the preset central area picture Right image data of the screen;

根据预设的相位差转换系数生成算法获取所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数。Acquiring the phase difference conversion coefficients of the at least one sub-area picture and the preset central area picture according to a preset phase difference conversion coefficient generation algorithm.

在一实施例中,所述相对距离获取模块1030,配置为:In an embodiment, the relative distance obtaining module 1030 is configured to:

分别对所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据进行校准,使得所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据的波峰值相等;And calibrating left image data and right image data of the at least one sub-area picture and the preset central area picture, respectively, such that the at least one sub-area picture and the left image data and the right image data of the preset central area picture The peaks of the waves are equal;

分别计算所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差;Calculating, respectively, a phase difference between the calibrated left image data and the right image data of the at least one sub-area picture and the preset central area picture;

根据所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差与所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数之间预设的比例关系,获取所述至少一个子区域画面以及预设的中心区域画面的散焦距离;Converting a phase difference between the calibrated left image data and the right image data of the at least one sub-region picture and the preset central region picture and the phase difference of the at least one sub-region picture and the preset central region picture Presetting a proportional relationship between the coefficients, acquiring a defocus distance of the at least one sub-area picture and the preset central area picture;

以预设的中心区域画面的散焦距离为基准,计算所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差;Calculating a defocus distance difference between the at least one sub-area picture and the preset central area picture based on a defocus distance of the preset central area picture;

根据所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。Obtaining at least one relative distance information between the at least one sub-area picture and the preset central area picture according to a defocus distance difference between the at least one sub-area picture and the preset central area picture.

在一实施例中,如图12所示,所述背景虚化设备还包括目标图像生成模块1060和存储模块1070;其中,In an embodiment, as shown in FIG. 12, the background blurring device further includes a target image generating module 1060 and a storage module 1070;

所述目标图像生成模块1060,配置为接收用于拍照的触控指令,将所述预览画面生成第一目标图像;The target image generating module 1060 is configured to receive a touch instruction for photographing, and generate a first target image by using the preview image;

所述存储模块1070,配置为保存所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。The storage module 1070 is configured to save at least one relative distance information between the at least one sub-area picture and the preset central area picture.

在一实施例中,如图13所示,所述待虚化区域确定模块1040,包括显示子模块10401和待虚化区域确定子模块10402;其中,In an embodiment, as shown in FIG. 13, the to-be-ambiguous area determining module 1040 includes a display sub-module 10401 and a to-be-ambiguous area determining sub-module 10402.

所述显示子模块10401,配置为显示所述第一目标图像;The display submodule 10401 is configured to display the first target image;

所述待虚化区域确定子模块10402,配置为根据所述显示子模块接收的触控操作在所述第一目标图像上的位置,从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面。The to-be-ambiguous area determining sub-module 10402 is configured to determine at least one to be blurred from the at least one sub-area picture according to the position of the touch operation received by the display sub-module on the first target image. The processed sub-area screen.

在一实施例中,所述虚化处理模块1050,配置为:In an embodiment, the blurring processing module 1050 is configured to:

根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,确定所述至少一个待虚化处理的子区域画面的虚化级别;Determining, according to the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, a blur level of the at least one sub-area picture to be blurred;

根据所述至少一个待虚化处理的子区域画面的虚化级别,对所述至少一个待虚化处理的子区域画面进行虚化处理。Performing a blurring process on the at least one sub-area picture to be blurred according to the blur level of the at least one sub-area picture to be blurred.

另外,在本实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元 中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in this embodiment may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software function module.

所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的计算机可读存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit may be stored in a computer readable storage medium if it is implemented in the form of a software function module and is not sold or used as a stand-alone product. Based on such understanding, the technical solution of the embodiment is essentially Said that the part contributing to the prior art or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium, comprising a plurality of instructions for making a computer device (may It is a personal computer, a server, or a network device, etc. or a processor that performs all or part of the steps of the method described in this embodiment. The foregoing computer readable storage medium includes: a USB flash drive, a removable hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. Medium.

本实施例中的一种背景虚化方法对应的计算机程序指令可以被存储在光盘,硬盘,U盘等存储介质上,当存储介质中的与一种背景虚化方法对应的计算机程序指令被一电子设备读取或被执行时,实现如下:The computer program instructions corresponding to the background blurring method in this embodiment may be stored on a storage medium such as an optical disk, a hard disk, a U disk, or the like, and a computer program instruction corresponding to a background blurring method in the storage medium is When the electronic device is read or executed, the implementation is as follows:

按照预设的划分策略将预览画面划分为至少一个子区域画面;Dividing the preview picture into at least one sub-area picture according to a preset division strategy;

获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数;Acquiring the phase focus parameter of the at least one sub-area picture and the preset central area picture;

根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息;Acquiring at least one relative distance information between the at least one sub-area picture and the preset central area picture according to the at least one sub-area picture and the phase focus parameter of the preset central area picture;

从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面;Determining at least one sub-area picture to be blurred by the at least one sub-area picture;

根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化 处理的子区域画面进行虚化处理。Performing, according to a preset blurring policy, the at least one sub-area picture to be blurred according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture Blurring processing.

所述计算机程序,还配置为被处理器运行时执行:The computer program is further configured to be executed when the processor is running:

根据所述预览画面信息分析所述预览画面的画面复杂度;And analyzing, according to the preview screen information, a screen complexity of the preview screen;

根据所述预览画面的画面复杂度将所述预览画面划分为至少一个子区域画面。The preview picture is divided into at least one sub-area picture according to the picture complexity of the preview picture.

所述计算机程序,还配置为被处理器运行时执行:The computer program is further configured to be executed when the processor is running:

基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元件,通过所述感光元件中预设的像素对的左像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的左图像数据;Obtaining the at least one sub-area picture and the preset central area respectively by the left pixel points of the preset pixel pair in the photosensitive element based on the at least one sub-area picture and the photosensitive element corresponding to the preset central area picture Left image data of the screen;

基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元件,通过所述感光元件中预设的像素对的右像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的右图像数据;Obtaining the at least one sub-area picture and the preset central area respectively by the right pixel point of the preset pixel pair in the photosensitive element based on the at least one sub-area picture and the photosensitive element corresponding to the preset central area picture Right image data of the screen;

根据预设的相位差转换系数生成算法获取所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数。Acquiring the phase difference conversion coefficients of the at least one sub-area picture and the preset central area picture according to a preset phase difference conversion coefficient generation algorithm.

所述计算机程序,还配置为被处理器运行时执行:The computer program is further configured to be executed when the processor is running:

分别对所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据进行校准,使得所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据的波峰值相等;And calibrating left image data and right image data of the at least one sub-area picture and the preset central area picture, respectively, such that the at least one sub-area picture and the left image data and the right image data of the preset central area picture The peaks of the waves are equal;

分别计算所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差;Calculating, respectively, a phase difference between the calibrated left image data and the right image data of the at least one sub-area picture and the preset central area picture;

根据所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差与所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数之间预设的比例关系,获取所述至少一个子区域画面以及预设的中心区域画面的散焦距离;Converting a phase difference between the calibrated left image data and the right image data of the at least one sub-region picture and the preset central region picture and the phase difference of the at least one sub-region picture and the preset central region picture Presetting a proportional relationship between the coefficients, acquiring a defocus distance of the at least one sub-area picture and the preset central area picture;

以预设的中心区域画面的散焦距离为基准,计算所述至少一个子区域 画面与预设的中心区域画面之间的散焦距离差;Calculating a defocus distance difference between the at least one sub-area picture and the preset central area picture based on a defocus distance of the preset central area picture;

根据所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。Obtaining at least one relative distance information between the at least one sub-area picture and the preset central area picture according to a defocus distance difference between the at least one sub-area picture and the preset central area picture.

所述计算机程序,还配置为被处理器运行时执行:The computer program is further configured to be executed when the processor is running:

接收用于拍照的触控指令,将所述预览画面生成第一目标图像,并保存所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。Receiving a touch instruction for photographing, generating the first target image by the preview image, and saving at least one relative distance information between the at least one sub-region image and the preset central region image.

所述计算机程序,还配置为被处理器运行时执行:The computer program is further configured to be executed when the processor is running:

通过终端屏幕显示所述第一目标图像,并根据所述终端屏幕接收的触控操作在所述第一目标图像上的位置,从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面。Displaying, by the terminal screen, the first target image, and determining, according to the position of the touch operation received by the terminal screen on the first target image, at least one to be blurred from the at least one sub-region image Sub-area picture.

所述计算机程序,还配置为被处理器运行时执行:The computer program is further configured to be executed when the processor is running:

根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,确定所述至少一个待虚化处理的子区域画面的虚化级别;Determining, according to the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, a blur level of the at least one sub-area picture to be blurred;

根据所述至少一个待虚化处理的子区域画面的虚化级别,对所述至少一个待虚化处理的子区域画面进行虚化处理。Performing a blurring process on the at least one sub-area picture to be blurred according to the blur level of the at least one sub-area picture to be blurred.

基于前述实施例相同的技术构思,参见图14,其示出了本发明实施例提供的一种背景虚化设备100,可以包括:通信接口1401、存储器1402、处理器1403和总线1404;其中,Based on the same technical concept of the foregoing embodiment, referring to FIG. 14, a background blur device 100 according to an embodiment of the present invention may be provided, which may include: a communication interface 1401, a memory 1402, a processor 1403, and a bus 1404;

所述总线1404用于连接所述通信接口1401、所述处理器1403和所述存储器1402以及这些器件之间的相互通信;The bus 1404 is configured to connect the communication interface 1401, the processor 1403, and the memory 1402, and mutual communication between the devices;

所述通信接口1401,配置为与外部网元进行数据传输;The communication interface 1401 is configured to perform data transmission with an external network element;

所述存储器1402,配置为存储指令和数据;The memory 1402 is configured to store instructions and data;

所述处理器1403,配置为执行所述指令以实现:按照预设的划分策略将预览画面划分为至少一个子区域画面;The processor 1403 is configured to execute the instruction to: divide the preview picture into at least one sub-area picture according to a preset division policy;

以及,获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数;And acquiring a phase focus parameter of the at least one sub-area picture and the preset central area picture;

以及,根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息;And acquiring, according to the at least one sub-area picture and the phase focus parameter of the preset central area picture, at least one relative distance information between the at least one sub-area picture and the preset central area picture;

以及,从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面;And determining, from the at least one sub-area picture, at least one sub-area picture to be blurred;

以及,根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化处理的子区域画面进行虚化处理。And, according to the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, the at least one sub-area to be blurred according to a preset blurring policy The screen is blurred.

在实际应用中,上述存储器1402可以是易失性存储器(volatile memory),例如随机存取存储器(RAM,Random-Access Memory);或者非易失性存储器(non-volatile memory),例如只读存储器(ROM,Read-Only Memory),快闪存储器(flash memory),硬盘(HDD,Hard Disk Drive)或固态硬盘(SSD,Solid-State Drive);或者上述种类的存储器的组合,并向处理器1403提供指令和数据。In practical applications, the memory 1402 may be a volatile memory, such as a random access memory (RAM), or a non-volatile memory, such as a read only memory. (ROM, Read-Only Memory), flash memory, hard disk (HDD, Hard Disk Drive) or solid state drive (SSD, Solid-State Drive); or a combination of the above types of memory, and to the processor 1403 Provide instructions and data.

上述处理器1403可以为特定用途集成电路(ASIC,Application Specific Integrated Circuit)、数字信号处理器(DSP,Digital Signal Processor)、数字信号处理装置(DSPD,Digital Signal Processing Device)、可编程逻辑装置(PLD,Programmable Logic Device)、现场可编程门阵列(FPGA,Field Programmable Gate Array)、中央处理器(CPU,Central Processing Unit)、控制器、微控制器、微处理器中的至少一种。可以理解地,对于不同的设备,用于实现上述处理器功能的电子器件还可以为其它,本发明实施例不 作限定。The processor 1403 may be an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), or a Programmable Logic Device (PLD). At least one of a Programmable Logic Device, a Field Programmable Gate Array (FPGA), a Central Processing Unit (CPU), a controller, a microcontroller, and a microprocessor. It is to be understood that, for different devices, the electronic device for implementing the above-mentioned functions of the processor may be other, which is not limited in the embodiment of the present invention.

示例性地,所述处理器1403,可以配置为:Illustratively, the processor 1403 can be configured to:

根据所述预览画面信息分析所述预览画面的画面复杂度;And analyzing, according to the preview screen information, a screen complexity of the preview screen;

以及,根据所述预览画面的画面复杂度将所述预览画面划分为至少一个子区域画面。And dividing the preview picture into at least one sub-area picture according to a picture complexity of the preview picture.

示例性地,所述处理器1403中所处理的所述相位对焦参数,可以包括:Illustratively, the phase focus parameter processed in the processor 1403 may include:

所述至少一个子区域画面以及预设的中心区域画面的二维增益图数据和相位差转换系数;其中,所述二维增益图数据包括所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据。The at least one sub-area picture and the two-dimensional gain map data and the phase difference conversion coefficient of the preset central area picture; wherein the two-dimensional gain map data includes the at least one sub-area picture and a preset central area picture Left image data and right image data.

示例性地,所述处理器1403,可以配置为:Illustratively, the processor 1403 can be configured to:

基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元件,通过所述感光元件中预设的像素对的左像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的左图像数据;Obtaining the at least one sub-area picture and the preset central area respectively by the left pixel points of the preset pixel pair in the photosensitive element based on the at least one sub-area picture and the photosensitive element corresponding to the preset central area picture Left image data of the screen;

基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元件,通过所述感光元件中预设的像素对的右像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的右图像数据;Obtaining the at least one sub-area picture and the preset central area respectively by the right pixel point of the preset pixel pair in the photosensitive element based on the at least one sub-area picture and the photosensitive element corresponding to the preset central area picture Right image data of the screen;

根据预设的相位差转换系数生成算法获取所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数。Acquiring the phase difference conversion coefficients of the at least one sub-area picture and the preset central area picture according to a preset phase difference conversion coefficient generation algorithm.

示例性地,所述处理器1403,可以配置为:Illustratively, the processor 1403 can be configured to:

分别对所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据进行校准,使得所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据的波峰值相等;And calibrating left image data and right image data of the at least one sub-area picture and the preset central area picture, respectively, such that the at least one sub-area picture and the left image data and the right image data of the preset central area picture The peaks of the waves are equal;

以及,分别计算所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差;And calculating, respectively, a phase difference between the calibrated left image data and the right image data of the at least one sub-area picture and the preset central area picture;

以及,根据所述至少一个子区域画面以及预设的中心区域画面的校准 后的左图像数据和右图像数据之间的相位差与所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数之间预设的比例关系,获取所述至少一个子区域画面以及预设的中心区域画面的散焦距离;And a phase difference between the calibrated left image data and the right image data of the at least one sub-region picture and the preset central region picture and the phase of the at least one sub-region picture and the preset central region picture Presetting a proportional relationship between the difference conversion coefficients, and acquiring a defocus distance of the at least one sub-area picture and the preset central area picture;

以及,以预设的中心区域画面的散焦距离为基准,计算所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差;And calculating, according to a defocus distance of the preset central area picture, a defocus distance difference between the at least one sub-area picture and the preset central area picture;

以及,根据所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。And acquiring, according to the defocus distance difference between the at least one sub-area picture and the preset central area picture, acquiring at least one relative distance information between the at least one sub-area picture and the preset central area picture.

示例性地,所述处理器1403,还可以配置为:Illustratively, the processor 1403 can also be configured to:

接收用于拍照的触控指令,将所述预览画面生成目标图像,并保存所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。Receiving a touch instruction for photographing, generating a target image by the preview image, and saving at least one relative distance information between the at least one sub-region image and the preset central region image.

示例性地,所述处理器1403,可以配置为:Illustratively, the processor 1403 can be configured to:

通过终端屏幕显示所述第一目标图像,并根据所述终端屏幕接收的触控操作在所述第一目标图像上的位置,从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面。Displaying, by the terminal screen, the first target image, and determining, according to the position of the touch operation received by the terminal screen on the first target image, at least one to be blurred from the at least one sub-region image Sub-area picture.

示例性地,所述处理器1403,可以配置为:Illustratively, the processor 1403 can be configured to:

根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,确定所述至少一个待虚化处理的子区域画面的虚化级别;Determining, according to the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, a blur level of the at least one sub-area picture to be blurred;

以及,根据所述至少一个待虚化处理的子区域画面的虚化级别,对所述至少一个待虚化处理的子区域画面进行虚化处理。And performing a blurring process on the at least one sub-area picture to be blurred according to the blur level of the at least one sub-area picture to be blurred.

基于前述相同的技术构思,如图15所示,该图给出了本发明实施例提供的一种背景虚化终端15,从图中可以看出,所述终端15包括前述实施例中任一所述的背景虚化设备100,所述背景虚化设备100配置为:Based on the foregoing technical concept, as shown in FIG. 15, the figure shows a background blurring terminal 15 provided by an embodiment of the present invention. As can be seen from the figure, the terminal 15 includes any of the foregoing embodiments. The background blur device 100 is configured to:

按照预设的划分策略将预览画面划分为至少一个子区域画面;Dividing the preview picture into at least one sub-area picture according to a preset division strategy;

以及,获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数;And acquiring a phase focus parameter of the at least one sub-area picture and the preset central area picture;

以及,根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息;And acquiring, according to the at least one sub-area picture and the phase focus parameter of the preset central area picture, at least one relative distance information between the at least one sub-area picture and the preset central area picture;

以及,从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面;And determining, from the at least one sub-area picture, at least one sub-area picture to be blurred;

以及,根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化处理的子区域画面进行虚化处理。And, according to the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, the at least one sub-area to be blurred according to a preset blurring policy The screen is blurred.

本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.

本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理 设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above is only the preferred embodiment of the present invention and is not intended to limit the scope of the present invention.

Claims (15)

一种背景虚化方法,应用于单个摄像头模组,所述方法包括:A background blurring method is applied to a single camera module, the method comprising: 按照预设的划分策略将预览画面划分为至少一个子区域画面;Dividing the preview picture into at least one sub-area picture according to a preset division strategy; 获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数;Acquiring the phase focus parameter of the at least one sub-area picture and the preset central area picture; 根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息;Acquiring at least one relative distance information between the at least one sub-area picture and the preset central area picture according to the at least one sub-area picture and the phase focus parameter of the preset central area picture; 从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面;Determining at least one sub-area picture to be blurred by the at least one sub-area picture; 根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化处理的子区域画面进行虚化处理。Performing, according to a preset blurring policy, the at least one sub-area picture to be blurred according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture Blurring processing. 根据权利要求1所述的方法,其中,所述按照预设的划分策略将预览画面划分为至少一个子区域画面,包括:The method according to claim 1, wherein the dividing the preview picture into at least one sub-area picture according to a preset division policy comprises: 根据所述预览画面信息分析所述预览画面的画面复杂度;And analyzing, according to the preview screen information, a screen complexity of the preview screen; 根据所述预览画面的画面复杂度将所述预览画面划分为至少一个子区域画面。The preview picture is divided into at least one sub-area picture according to the picture complexity of the preview picture. 根据权利要求1所述的方法,其中,所述相位对焦参数,包括:所述至少一个子区域画面以及预设的中心区域画面的二维增益图数据和相位差转换系数;其中,所述二维增益图数据包括所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据。The method according to claim 1, wherein the phase in-focus parameter comprises: the at least one sub-region picture and the two-dimensional gain map data and the phase difference conversion coefficient of the preset central region picture; wherein the two The dimensional gain map data includes left image data and right image data of the at least one sub-region picture and a preset central area picture. 根据权利要求3所述的方法,其中,所述获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,包括:The method according to claim 3, wherein the acquiring the phase focus parameter of the at least one sub-area picture and the preset central area picture comprises: 基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元 件,通过所述感光元件中预设的像素对的左像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的左图像数据;Obtaining the at least one sub-area picture and the preset central area respectively by the left pixel points of the preset pixel pair in the photosensitive element based on the at least one sub-area picture and the photosensitive element corresponding to the preset central area picture Left image data of the screen; 基于所述至少一个子区域画面以及预设的中心区域画面对应的感光元件,通过所述感光元件中预设的像素对的右像素点分别获取所述至少一个子区域画面以及预设的中心区域画面的右图像数据;Obtaining the at least one sub-area picture and the preset central area respectively by the right pixel point of the preset pixel pair in the photosensitive element based on the at least one sub-area picture and the photosensitive element corresponding to the preset central area picture Right image data of the screen; 根据预设的相位差转换系数生成算法获取所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数。Acquiring the phase difference conversion coefficients of the at least one sub-area picture and the preset central area picture according to a preset phase difference conversion coefficient generation algorithm. 根据权利要求4所述的方法,其中,所述根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息,包括:The method according to claim 4, wherein the acquiring the at least one sub-area picture and the preset central area picture according to the phase focus parameter of the at least one sub-area picture and the preset central area picture At least one relative distance information, including: 分别对所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据进行校准,使得所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据的波峰值相等;And calibrating left image data and right image data of the at least one sub-area picture and the preset central area picture, respectively, such that the at least one sub-area picture and the left image data and the right image data of the preset central area picture The peaks of the waves are equal; 分别计算所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差;Calculating, respectively, a phase difference between the calibrated left image data and the right image data of the at least one sub-area picture and the preset central area picture; 根据所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差与所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数之间预设的比例关系,获取所述至少一个子区域画面以及预设的中心区域画面的散焦距离;Converting a phase difference between the calibrated left image data and the right image data of the at least one sub-region picture and the preset central region picture and the phase difference of the at least one sub-region picture and the preset central region picture Presetting a proportional relationship between the coefficients, acquiring a defocus distance of the at least one sub-area picture and the preset central area picture; 以预设的中心区域画面的散焦距离为基准,计算所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差;Calculating a defocus distance difference between the at least one sub-area picture and the preset central area picture based on a defocus distance of the preset central area picture; 根据所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。Obtaining at least one relative distance information between the at least one sub-area picture and the preset central area picture according to a defocus distance difference between the at least one sub-area picture and the preset central area picture. 根据权利要求1所述的方法,其中,在从所述至少一个子区域画面 中确定至少一个待虚化处理的子区域画面之前,所述方法还包括:The method according to claim 1, wherein before determining at least one sub-area picture to be blurred by the at least one sub-area picture, the method further comprises: 接收用于拍照的触控指令,将所述预览画面生成第一目标图像,并保存所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。Receiving a touch instruction for photographing, generating the first target image by the preview image, and saving at least one relative distance information between the at least one sub-region image and the preset central region image. 根据权利要求6所述的方法,其中,所述从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面,包括:The method according to claim 6, wherein the determining the at least one sub-area picture to be blurred by the at least one sub-area picture comprises: 通过终端屏幕显示所述第一目标图像,并根据所述终端屏幕接收的触控操作在所述第一目标图像上的位置,从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面。Displaying, by the terminal screen, the first target image, and determining, according to the position of the touch operation received by the terminal screen on the first target image, at least one to be blurred from the at least one sub-region image Sub-area picture. 根据权利要求7所述的方法,其中,所述根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化处理的子区域画面进行虚化处理,包括:The method according to claim 7, wherein the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture is according to a preset blurring strategy pair Performing a blurring process on the at least one sub-area picture to be blurred, including: 根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,确定所述至少一个待虚化处理的子区域画面的虚化级别;Determining, according to the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, a blur level of the at least one sub-area picture to be blurred; 根据所述至少一个待虚化处理的子区域画面的虚化级别,对所述至少一个待虚化处理的子区域画面进行虚化处理。Performing a blurring process on the at least one sub-area picture to be blurred according to the blur level of the at least one sub-area picture to be blurred. 一种背景虚化设备,所述设备包括:区域划分模块、相位对焦参数获取模块、相对距离获取模块、待虚化区域确定模块和虚化处理模块;其中,A background blurring device, the device comprising: a region dividing module, a phase focusing parameter acquiring module, a relative distance acquiring module, a to-be-demagnetized region determining module, and a blurring processing module; wherein 所述区域划分模块,配置为按照预设的划分策略将预览画面划分为至少一个子区域画面;The area dividing module is configured to divide the preview picture into at least one sub-area picture according to a preset dividing policy; 所述相位对焦参数获取模块,配置为获取所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数;The phase focus parameter acquisition module is configured to acquire the phase focus parameter of the at least one sub-area picture and the preset central area picture; 所述相对距离获取模块,配置为根据所述至少一个子区域画面以及预设的中心区域画面的相位对焦参数,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息;The relative distance acquisition module is configured to acquire at least one relative between the at least one sub-area picture and the preset central area picture according to the at least one sub-area picture and the phase focus parameter of the preset central area picture Distance information; 所述待虚化区域确定模块,配置为从所述至少一个子区域画面中确定至少一个待虚化处理的子区域画面;The to-be-ambiguous area determining module is configured to determine, from the at least one sub-area picture, at least one sub-area picture to be blurred; 所述虚化处理模块,配置为根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,按照预设的虚化策略对所述至少一个待虚化处理的子区域画面进行虚化处理。The imaginary processing module is configured to: according to at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, the at least one according to a preset blurring policy The sub-area picture to be blurred is subjected to blurring processing. 根据权利要求9所述的设备,其中,所述相对距离获取模块,配置为:The device according to claim 9, wherein the relative distance obtaining module is configured to: 分别对所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据进行校准,使得所述至少一个子区域画面以及预设的中心区域画面的左图像数据和右图像数据的波峰值相等;And calibrating left image data and right image data of the at least one sub-area picture and the preset central area picture, respectively, such that the at least one sub-area picture and the left image data and the right image data of the preset central area picture The peaks of the waves are equal; 分别计算所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差;Calculating, respectively, a phase difference between the calibrated left image data and the right image data of the at least one sub-area picture and the preset central area picture; 根据所述至少一个子区域画面以及预设的中心区域画面的校准后的左图像数据和右图像数据之间的相位差与所述至少一个子区域画面以及预设的中心区域画面的相位差转换系数之间预设的比例关系,获取所述至少一个子区域画面以及预设的中心区域画面的散焦距离;Converting a phase difference between the calibrated left image data and the right image data of the at least one sub-region picture and the preset central region picture and the phase difference of the at least one sub-region picture and the preset central region picture Presetting a proportional relationship between the coefficients, acquiring a defocus distance of the at least one sub-area picture and the preset central area picture; 以预设的中心区域画面的散焦距离为基准,计算所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差;Calculating a defocus distance difference between the at least one sub-area picture and the preset central area picture based on a defocus distance of the preset central area picture; 根据所述至少一个子区域画面与预设的中心区域画面之间的散焦距离差,获取所述至少一个子区域画面与预设的中心区域画面之间的至少一个相对距离信息。Obtaining at least one relative distance information between the at least one sub-area picture and the preset central area picture according to a defocus distance difference between the at least one sub-area picture and the preset central area picture. 根据权利要求9所述的设备,其中,所述虚化处理模块,配置为:The device according to claim 9, wherein the blurring processing module is configured to: 根据所述至少一个待虚化处理的子区域画面与预设的中心区域画面之间的至少一个相对距离信息,确定所述至少一个待虚化处理的子区域画面的虚化级别;Determining, according to the at least one relative distance information between the at least one sub-area picture to be blurred and the preset central area picture, a blur level of the at least one sub-area picture to be blurred; 根据所述至少一个待虚化处理的子区域画面的虚化级别,对所述至少一个待虚化处理的子区域画面进行虚化处理。Performing a blurring process on the at least one sub-area picture to be blurred according to the blur level of the at least one sub-area picture to be blurred. 一种背景虚化设备,所述设备包括:通信接口、存储器、处理器和总线;其中,A background blurring device, the device comprising: a communication interface, a memory, a processor, and a bus; wherein 所述总线用于连接所述通信接口、所述处理器和所述存储器以及这些器件之间的相互通信;The bus is configured to connect the communication interface, the processor and the memory, and mutual communication between the devices; 所述通信接口,配置为与外部网元进行数据传输;The communication interface is configured to perform data transmission with an external network element; 所述存储器,配置为存储指令和数据;The memory is configured to store instructions and data; 所述处理器,配置为执行所述指令以实现如权利要求1至8任一项所述的背景虚化方法。The processor is configured to execute the instructions to implement the background blurring method of any one of claims 1-8. 一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如权利要求1至8任一项所述的背景虚化方法。A computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement any of claims 1-8 The background blurring method described in the item. 一种终端,所述终端包括权利要求9至11任一项所述的背景虚化设备。A terminal comprising the background blurring device of any one of claims 9 to 11. 一种终端,所述终端包括权利要求12所述的背景虚化设备。A terminal comprising the background blurring device of claim 12.
PCT/CN2017/119578 2017-05-24 2017-12-28 Background blurring method and device, terminal, and storage medium Ceased WO2018214502A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710374328.3 2017-05-24
CN201710374328.3A CN108933890A (en) 2017-05-24 2017-05-24 A kind of background-blurring method, equipment and terminal

Publications (1)

Publication Number Publication Date
WO2018214502A1 true WO2018214502A1 (en) 2018-11-29

Family

ID=64395185

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/119578 Ceased WO2018214502A1 (en) 2017-05-24 2017-12-28 Background blurring method and device, terminal, and storage medium

Country Status (2)

Country Link
CN (1) CN108933890A (en)
WO (1) WO2018214502A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113938578A (en) * 2020-07-13 2022-01-14 武汉Tcl集团工业研究院有限公司 Image blurring method, storage medium and terminal device
CN114359077A (en) * 2021-12-22 2022-04-15 北京旷视科技有限公司 Image processing method, computer program product and electronic device

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110286463A (en) * 2019-06-03 2019-09-27 武汉精立电子技术有限公司 One kind being based on camera lens automatic focusing method and device
CN110971827B (en) * 2019-12-09 2022-02-18 Oppo广东移动通信有限公司 Portrait mode shooting method and device, terminal equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2768213A1 (en) * 2013-02-19 2014-08-20 BlackBerry Limited Method and system for generating shallow depth of field effect
CN105141858A (en) * 2015-08-13 2015-12-09 上海斐讯数据通信技术有限公司 Photo background blurring system and photo background blurring method
CN105933589A (en) * 2016-06-28 2016-09-07 广东欧珀移动通信有限公司 Image processing method and terminal
CN106657782A (en) * 2016-12-21 2017-05-10 努比亚技术有限公司 Picture processing method and terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003098422A (en) * 2001-09-20 2003-04-03 Matsushita Electric Ind Co Ltd Autofocusing device
JP2013097154A (en) * 2011-10-31 2013-05-20 Olympus Corp Distance measurement device, imaging apparatus, and distance measurement method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2768213A1 (en) * 2013-02-19 2014-08-20 BlackBerry Limited Method and system for generating shallow depth of field effect
CN105141858A (en) * 2015-08-13 2015-12-09 上海斐讯数据通信技术有限公司 Photo background blurring system and photo background blurring method
CN105933589A (en) * 2016-06-28 2016-09-07 广东欧珀移动通信有限公司 Image processing method and terminal
CN106657782A (en) * 2016-12-21 2017-05-10 努比亚技术有限公司 Picture processing method and terminal

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113938578A (en) * 2020-07-13 2022-01-14 武汉Tcl集团工业研究院有限公司 Image blurring method, storage medium and terminal device
CN114359077A (en) * 2021-12-22 2022-04-15 北京旷视科技有限公司 Image processing method, computer program product and electronic device

Also Published As

Publication number Publication date
CN108933890A (en) 2018-12-04

Similar Documents

Publication Publication Date Title
US10645368B1 (en) Method and apparatus for estimating depth of field information
Wang et al. Selective light field refocusing for camera arrays using bokeh rendering and superresolution
US11210799B2 (en) Estimating depth using a single camera
US9900510B1 (en) Motion blur for light-field images
US10805508B2 (en) Image processing method, and device
Liang et al. Programmable aperture photography: multiplexed light field acquisition
US9154697B2 (en) Camera selection based on occlusion of field of view
TWI474096B (en) Enhanced image processing with lens motion
US9918065B2 (en) Depth-assisted focus in multi-camera systems
JP6263623B2 (en) Image generation method and dual lens apparatus
US9544574B2 (en) Selecting camera pairs for stereoscopic imaging
TWI538512B (en) Method and electronic device for adjusting focus position
US20230033956A1 (en) Estimating depth based on iris size
EP3067746A1 (en) Photographing method for dual-camera device and dual-camera device
CN105227838B (en) A kind of image processing method and mobile terminal
WO2019056527A1 (en) Capturing method and device
CN104253939A (en) Method for adjusting focusing position and electronic device
CN110650288B (en) Focus control method and apparatus, electronic device, computer-readable storage medium
WO2018214502A1 (en) Background blurring method and device, terminal, and storage medium
US10356381B2 (en) Image output apparatus, control method, image pickup apparatus, and storage medium
CN110276831A (en) Method and device for constructing three-dimensional model, equipment and computer-readable storage medium
US20160292842A1 (en) Method and Apparatus for Enhanced Digital Imaging
CN107454328B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
CN110689007B (en) Subject recognition method and device, electronic equipment and computer-readable storage medium
CN110392211B (en) Image processing method and apparatus, electronic device, computer-readable storage medium

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: 17911137

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: 17911137

Country of ref document: EP

Kind code of ref document: A1