WO2018176929A1 - Image background blurring method and apparatus - Google Patents

Image background blurring method and apparatus Download PDF

Info

Publication number
WO2018176929A1
WO2018176929A1 PCT/CN2017/117180 CN2017117180W WO2018176929A1 WO 2018176929 A1 WO2018176929 A1 WO 2018176929A1 CN 2017117180 W CN2017117180 W CN 2017117180W WO 2018176929 A1 WO2018176929 A1 WO 2018176929A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
depth
pixel
reference image
pyramid
Prior art date
Application number
PCT/CN2017/117180
Other languages
French (fr)
Chinese (zh)
Inventor
宋明黎
李欣
黄一宁
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2018176929A1 publication Critical patent/WO2018176929A1/en

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/62Control of parameters via user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/55Depth or shape recovery from multiple images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • 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
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • H04N5/2621Cameras specially adapted for the electronic generation of special effects during image pickup, e.g. digital cameras, camcorders, video cameras having integrated special effects capability

Definitions

  • the embodiments of the present application relate to the field of image processing technologies, and in particular, to an image background blurring method and apparatus.
  • the background blur of an image refers to the way in which focus is focused on a theme in an image, and the non-theme elements are blurred.
  • the mountain we want to use the mountain as the theme of the whole image, we can focus the camera on the mountain, and the image of the mountain will become clear, and the water will become blurred;
  • an embodiment of the present application provides an image background blurring method and device, so that the mobile terminal can capture an image with a clear foreground and a blurred background.
  • the embodiment of the present application is implemented as follows:
  • an embodiment of the present application provides an image background blurring method, the method comprising: extracting a reference image and m non-reference images in a target video according to an image extraction rule; Constructing a first image pyramid using the reference image, constructing m second image pyramids using m non-reference images; determining a scene depth map of the reference image using the first image pyramid and the m second image pyramids; using the scene depth map to reference the image
  • the pixel points are divided into n depth layers; the target position is determined in the reference image; the target depth layer where the pixel point corresponding to the target position is located is determined from the n depth layers; and the pixel to be processed is subjected to blur processing.
  • the target video is a video captured by the mobile terminal according to a predetermined trajectory
  • the predetermined trajectory may be preset
  • the predetermined trajectory is a moving trajectory on the same plane.
  • the predetermined trajectory may be a left-to-right moving trajectory on the same plane, and the predetermined trajectory may also be a right-to-left moving trajectory on the same plane, and the predetermined trajectory may also be top-to-bottom in the same plane.
  • the moving track, the predetermined track may also be a moving track from bottom to top on the same plane.
  • the image extraction rule is a preset rule, and the image extraction rule may be: selecting a reference image and m non-reference images in the target video according to the playing duration of the target video, where m is a positive integer greater than or equal to 1.
  • the reference image and the non-reference image are images extracted from different moments in the target video, and the reference image is the same as the shooting scene of the non-reference image, but the angle of view of the reference image is different from the position of the non-reference image. of.
  • the mobile terminal uses the reference image as the bottom image of the first image pyramid. Then, the resolution of the underlying image of the first image pyramid is reduced to half as the upper layer image of the underlying image of the first image pyramid, and this step is continuously repeated to continuously obtain the upper layer image of the first image pyramid. Finally, the first image pyramid of a reference image having a different resolution can be obtained by repeating several times.
  • the scene depth map of the reference image represents the relative distance between any pixel point in the reference image and the mobile terminal, and the pixel value of the pixel point in the scene depth map represents the relative distance between the actual location where the pixel point is located and the mobile terminal.
  • the mobile terminal can acquire the preset n and the manner of dividing the depth layer, so that the number of depth layers and the depth range of each depth layer can be known.
  • the target position is determined in the reference image according to the control command.
  • the control instruction may be an instruction input by the user on the touch screen of the mobile terminal by using a finger.
  • the specific position in the reference image is determined as the target position.
  • the specific position in the reference image is a previously specified position.
  • the face image in the reference image is identified, and the position of the face image in the reference image is determined as the target position.
  • the pixel to be processed is a pixel point included in a depth layer other than the target depth layer among the n depth layers.
  • the embodiment of the present application divides each pixel of the reference image into n depth layers by using the obtained scene depth map, and determines the target position in the n depth layers by using the determined target position of the reference image.
  • determining the scene depth map of the reference image by using the first image pyramid and the m second image pyramids comprises: determining a reference according to the top image of the first image pyramid and the top image of the m second image pyramids a preliminary depth map of the image, the first image pyramid and the m second image pyramids each including a top image and a lower image; determining a reference according to the preliminary depth map, the lower image of the first image pyramid, and the lower image of the m second image pyramids The depth map of the scene of the image.
  • the reference image at different resolutions is deeply sampled in the first image pyramid and the m second image pyramids, and the high-resolution scene depth map is derived by using the low-resolution preliminary depth map, thereby speeding up the depth recovery
  • the speed of the reference image depth can be generated more quickly by the embodiment of the present application.
  • determining a preliminary depth map of the reference image according to the top image of the first image pyramid and the top image of the m second image pyramids comprises: a top image according to the first image pyramid and m second images The top image of the pyramid is used to calculate the first matching loss body; the Markov random field model is constructed according to the first matching loss body to optimize the global matching loss, and the preliminary depth map of the reference image is obtained.
  • the first matching loss body may be first calculated according to the top image of the first image pyramid and the top image of the m second image pyramids; then, the MRF model is constructed according to the first matching loss body to perform global matching loss optimization, thereby A preliminary depth map of the reference image with a smooth detail.
  • calculating, according to the top image of the first image pyramid and the top image of the m second image pyramids, calculating the first matching loss body includes: obtaining the reference image and the view angle of the m non-reference images a camera external parameter and a camera internal parameter of the mobile terminal; determining a feature point in the reference image according to the feature point extraction rule; acquiring a three-dimensional coordinate of the feature point of the reference image; determining a minimum of the reference image in the scene according to the three-dimensional coordinate of the feature point of the reference image a depth value and a maximum depth value; determining a plurality of depth planes between the minimum depth value and the maximum depth value; using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm to calculate a plurality of depth planes from a plane in which the reference image is located to m a first homography matrix of a plane map in which the non-reference image is located; using a plane scan algorithm and a first homography matrix, each pixel point of
  • the re-projection is used to calculate the matching loss, so that the depth of the camera can be better adapted to the camera pose changes of the reference image and the m non-reference images in the depth recovery, and the reliability of the depth recovery method is improved.
  • determining the plurality of depth planes between the minimum depth value and the maximum depth value comprises: calculating a first depth plane where the minimum depth value is located by using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm The second homography matrix of the reference image plane to m non-reference image plane mappings; using the camera internal parameter, the camera external parameter and the direct linear transformation algorithm, the second depth plane where the maximum depth value is calculated is from the reference image plane to m non- a third homography matrix of the reference image plane mapping; projecting a pixel point in the reference image according to the second homography matrix onto a plane where the m non-reference images are located, to obtain a first projection point; A pixel is projected onto a plane on which the m non-reference images are located according to the third homography matrix to obtain a second projection point; and a plurality of samples are uniformly sampled on a line formed between the first projection point and the second projection point. Point; backprojecting a plurality of sampling points
  • the pixel when calculating the matching loss of the pixel of the reference image according to a depth plane, the pixel needs to be re-projected onto the m non-reference image planes, and after the multiple depth planes are re-projected, in the m non-reference images.
  • the positions of the present application are helpful for the subsequent steps to more efficiently extract the pixel matching information between the reference image and the m non-reference images, thereby improving the accuracy of the scene depth map.
  • determining a scene depth map of the reference image according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids includes: determining a top image of the first image pyramid Pixels corresponding to the pixels of the lower image of the first image pyramid; determining pixel points of the lower image of the m second image pyramids corresponding to the pixels of the top image of the m second image pyramids; determining according to the preliminary depth map An estimated depth value of a pixel point of a lower layer image of the first image pyramid; a minimum depth value and a maximum depth value of a pixel point of the lower layer image of the first image pyramid are determined according to the estimated depth value; determining between the minimum depth value and the maximum depth value a plurality of depth planes of the lower layer image of the first image pyramid; calculating a second matching loss body corresponding to the lower layer image of the first image pyramid and the lower layer image of the m second image pyramids by using the plane scanning algorithm and the plurality of depth
  • the preliminary depth map is used to estimate the minimum depth value and the maximum depth value of the pixel points of the lower layer image of the first image pyramid, thereby determining a relatively small depth search interval, thereby reducing the calculation amount and improving the depth recovery method for image noise.
  • the robustness of the interference is used to estimate the minimum depth value and the maximum depth value of the pixel points of the lower layer image of the first image pyramid, thereby determining a relatively small depth search interval, thereby reducing the calculation amount and improving the depth recovery method for image noise.
  • determining, from the n depth layers, a target depth layer where a pixel point corresponding to the target position is located includes: acquiring a specified pixel point of a target position of the reference image; determining and specifying the pixel in the scene depth map The corresponding pixel value of the point; determining the target depth layer where the specified pixel point is located in the n depth layers according to the pixel value corresponding to the specified pixel point.
  • the mobile terminal After the mobile terminal determines the target location in the reference image, it can directly go to the specified pixel point of the target location, and then determine the pixel value corresponding to the specified pixel point in the scene depth map, and then the pixel value can be known to correspond to the pixel value.
  • the target depth layer in this case, the target depth layer where the pixel point corresponding to the target position is located can be determined in the n depth layers.
  • performing blur processing on the pixel to be processed includes: determining L depth layers where the pixel to be processed is located, L is greater than or equal to 2 and less than n; calculating depths of the L depth layers and the target depth layer Poor; the pixel points of each of the L depth layers are subjected to a predetermined ratio of blur processing according to the depth difference, and the degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference.
  • the depth difference between the L depth layers and the target depth layer can be calculated, and then the mobile terminal can each of the L depth layers according to the depth difference.
  • the pixel points of the depth layer are subjected to a preset ratio blurring process.
  • the degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference, and if the depth difference between the depth layer and the target depth layer in the L depth layers is larger, then the pixel points in the depth layer The greater the degree of blurring; if the depth difference between the depth layer and the target depth layer in the L depth layers is smaller, the degree of blurring of the pixel points in the depth layer is smaller, thereby reflecting the level of different distances in the reference image sense.
  • an embodiment of the present application provides an image background blurring apparatus, where the apparatus includes: an extracting module, configured to extract a reference image and m non-reference images in a target video according to an image extraction rule, and the target video is utilized.
  • the video captured by the mobile terminal according to a predetermined trajectory, m is greater than or equal to 9;
  • a building module configured to construct a first image pyramid by using a reference image, and construct m second image pyramids by using m non-reference images;
  • a first determining module configured to determine a scene depth map of the reference image by using the first image pyramid and the m second image pyramids, where the scene depth map of the reference image represents a relative distance between any pixel point in the reference image and the mobile terminal;
  • a dividing module configured to divide a pixel point of the reference image into n depth layers by using a scene depth map, wherein a depth of the object corresponding to the pixel point in the different depth layer to the mobile terminal is different, where n is greater than or equal to 2;
  • a second determining module configured to determine a target location in the reference image
  • a third determining module configured to determine, from the n depth layers, a target depth layer where the pixel corresponding to the target location is located;
  • a fuzzy processing module configured to perform blur processing on the pixel to be processed, where the pixel to be processed is a pixel point included in a depth layer other than the target depth layer among the n depth layers.
  • the embodiment of the present application divides each pixel of the reference image into n depth layers by using the obtained scene depth map, and determines the target position in the n depth layers by using the determined target position of the reference image.
  • the first determining module is specifically configured to determine a preliminary depth map of the reference image according to the top image of the first image pyramid and the top image of the m second image pyramids, the first image pyramid and the m
  • the second image pyramids each include a top layer image and a lower layer image; and determine a scene depth map of the reference image according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids.
  • the reference image at different resolutions is deeply sampled in the first image pyramid and the m second image pyramids, and the high-resolution scene depth map is derived by using the low-resolution preliminary depth map, thereby speeding up the depth recovery
  • the speed of the reference image depth can be generated more quickly by the embodiment of the present application.
  • the first determining module is configured to calculate a first matching loss body according to the top image of the first image pyramid and the top image of the m second image pyramids; and construct the first matching loss body according to the first matching loss body
  • the Markov random field model performs global matching loss optimization to obtain a preliminary depth map of the reference image.
  • the first matching loss body may be first calculated according to the top image of the first image pyramid and the top image of the m second image pyramids; then, the MRF model is constructed according to the first matching loss body to perform global matching loss optimization, thereby A preliminary depth map of the reference image with a smooth detail.
  • the first determining module is specifically configured to acquire a camera external parameter and a camera internal parameter of the mobile terminal at a viewing angle where the reference image and the m non-reference images are located; and determine the reference image according to the feature point extraction rule.
  • a feature point obtaining a three-dimensional coordinate of the feature point of the reference image; determining a minimum depth value and a maximum depth value in the scene in which the reference image is located according to the three-dimensional coordinate of the feature point of the reference image; determining between the minimum depth value and the maximum depth value a depth plane; using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm to calculate a first homography matrix of a plurality of depth planes from a plane in which the reference image is located to a plane mapping of m non-reference images; using a plane scanning algorithm And the first homography matrix, each pixel of the top image of the first image pyramid is projected in a plurality of depth planes onto a plane on which the top image of the m second image pyramids is located, to obtain a projection of each pixel point Parameter value; parameter value of each pixel point and projection of each pixel point according to the top image of the first image pyramid Parameter values, is determined for each pixel in the mismatching loss on the depth value;
  • the re-projection is used to calculate the matching loss, so that the depth of the camera can be better adapted to the camera pose changes of the reference image and the m non-reference images in the depth recovery, and the reliability of the depth recovery method is improved.
  • the first determining module is specifically configured to calculate, by using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm, the first depth plane where the minimum depth value is located, from the reference image plane to the m non-reference images.
  • the second homography matrix of the plane mapping; using the camera internal parameter, the camera external parameter and the direct linear transformation algorithm, the third homography of the second depth plane where the maximum depth value is located is mapped from the reference image plane to the m non-reference image planes.
  • a matrix of pixels in the reference image is projected onto the plane of the m non-reference images according to the second homography matrix to obtain a first projection point; and one pixel point in the reference image is according to the third homography
  • the matrix is projected onto a plane where m non-reference images are located to obtain a second projection point; uniformly sampling a line between the first projection point and the second projection point to obtain a plurality of sampling points; and reversing the plurality of sampling points Projecting into the three-dimensional space of the viewing angle of the reference image, a plurality of depth planes corresponding to the depth values of the plurality of sampling points are obtained.
  • the pixel when calculating the matching loss of the pixel of the reference image according to a depth plane, the pixel needs to be re-projected onto the m non-reference image planes, and after the multiple depth planes are re-projected, in the m non-reference images.
  • the positions of the present application are helpful for the subsequent steps to more efficiently extract the pixel matching information between the reference image and the m non-reference images, thereby improving the accuracy of the scene depth map.
  • the first determining module is specifically configured to determine a pixel point of the lower layer image of the first image pyramid corresponding to the pixel point of the top image of the first image pyramid; and determine the m second image pyramids a pixel of the lower image of the m second image pyramid corresponding to the pixel of the top image; determining an estimated depth value of the pixel of the lower image of the first image pyramid according to the preliminary depth map; determining the first image pyramid according to the estimated depth value a minimum depth value and a maximum depth value of a pixel of the lower layer image; determining a plurality of depth planes of the lower layer image of the first image pyramid between the minimum depth value and the maximum depth value; calculating using a plane scanning algorithm and a plurality of depth planes a second matching loss body corresponding to the lower layer image of the first image pyramid and the lower layer image of the m second image pyramids; the lower layer image of the first image pyramid is used as the guiding image, and the second matching loss body is locally optimized by using the guiding
  • the preliminary depth map is used to estimate the minimum depth value and the maximum depth value of the pixel points of the lower layer image of the first image pyramid, thereby determining a relatively small depth search interval, thereby reducing the calculation amount and improving the depth recovery method for image noise.
  • the robustness of the interference is used to estimate the minimum depth value and the maximum depth value of the pixel points of the lower layer image of the first image pyramid, thereby determining a relatively small depth search interval, thereby reducing the calculation amount and improving the depth recovery method for image noise.
  • the third determining module is specifically configured to acquire a specified pixel point of the target position of the reference image; determine a pixel value corresponding to the specified pixel point in the scene depth map; and correspond to the pixel corresponding to the specified pixel point The value determines the target depth layer at which the specified pixel point is located in the n depth layers.
  • the mobile terminal After the mobile terminal determines the target location in the reference image, it can directly go to the specified pixel point of the target location, and then determine the pixel value corresponding to the specified pixel point in the scene depth map, and then the pixel value can be known to correspond to the pixel value.
  • the target depth layer in this case, the target depth layer where the pixel point corresponding to the target position is located can be determined in the n depth layers.
  • the fuzzy processing module is specifically configured to determine L depth layers where the pixel to be processed is located, L is greater than or equal to 2 and less than n; and calculating a depth difference between the L depth layers and the target depth layer; The depth difference performs a predetermined ratio of blurring on the pixel points of each of the L depth layers, and the degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference.
  • the depth difference between the L depth layers and the target depth layer can be calculated, and then the mobile terminal can each of the L depth layers according to the depth difference.
  • the pixel points of the depth layer are subjected to a preset ratio blurring process.
  • the degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference, and if the depth difference between the depth layer and the target depth layer in the L depth layers is larger, then the pixel points in the depth layer The greater the degree of blurring; if the depth difference between the depth layer and the target depth layer in the L depth layers is smaller, the degree of blurring of the pixel points in the depth layer is smaller, thereby reflecting the level of different distances in the reference image sense.
  • an embodiment of the present application provides an image background blurring apparatus, where the apparatus includes: a processor and a memory, wherein the memory stores an operation instruction executable by the processor, and the processor reads the operation instruction in the memory.
  • extracting a reference image and m non-reference images in the target video according to an image extraction rule the target video is a video captured by the mobile terminal according to a predetermined trajectory, m is greater than or equal to 1; constructing the first image by using the reference image Pyramid, constructing m second image pyramids using m non-reference images; determining a scene depth map of the reference image using the first image pyramid and the m second image pyramids, the scene depth map of the reference image representing any pixel point in the reference image
  • the relative distance from the mobile terminal; the pixel depth of the reference image is divided into n depth layers by using the scene depth map, wherein the depth of the object corresponding to the pixel point in the different depth layer is different to the mobile terminal, where n is greater than or
  • the embodiment of the present application divides each pixel of the reference image into n depth layers by using the obtained scene depth map, and determines the target position in the n depth layers by using the determined target position of the reference image.
  • FIG. 1 is a flowchart of an image background blurring method provided by an embodiment of the present application
  • FIG. 2 is a flowchart of another image background blurring method provided by an embodiment of the present application.
  • FIG. 3 is a flowchart of still another image background blurring method provided by an embodiment of the present application.
  • FIG. 4 is a flowchart of still another image background blurring method provided by an embodiment of the present application.
  • FIG. 5 is a flowchart of still another image background blurring method provided by an embodiment of the present application.
  • FIG. 6 is a flowchart of still another image background blurring method provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of an image background blurring apparatus provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of still another image background blurring device provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram showing a design structure of an image background blurring device provided by an embodiment of the present application.
  • FIG. 1 is a flowchart of an image background blurring method provided by an embodiment of the present application.
  • the image background blurring method shown in FIG. 1 can cause the mobile terminal to capture an image with a clear foreground and a blurred background.
  • the method includes the following steps.
  • Step S11 Extracting a reference image and m non-reference images in the target video according to an image extraction rule, where the target video is a video captured by the mobile terminal according to a predetermined trajectory, where m is greater than or equal to 1.
  • the method provided by the embodiment of the present application can be applied to a mobile terminal, and the mobile terminal can be a device such as a smart phone.
  • the target video is a video captured by the mobile terminal according to a predetermined trajectory
  • the predetermined trajectory may be preset
  • the predetermined trajectory is a moving trajectory on the same plane.
  • the predetermined trajectory may be a left-to-right moving trajectory on the same plane, and the predetermined trajectory may also be a right-to-left moving trajectory on the same plane, and the predetermined trajectory may also be up to the same plane.
  • the lower moving track, the predetermined track may also be a moving track from bottom to top on the same plane.
  • the camera of the mobile terminal needs to always be aligned with the position that needs to be taken.
  • the mobile terminal When the target video is captured by the mobile terminal, the user needs to move the mobile terminal in a single direction, slowly and smoothly, and the moving distance can be 20 cm-30 cm. During the movement of the user holding the mobile terminal, the mobile terminal can judge the moving distance according to the gyroscope and select an appropriate reference image and a non-reference image in the target video.
  • the image extraction rule is a preset rule, and the image extraction rule may be: selecting a reference image and m non-reference images in the target video according to the playing duration of the target video, where m is a positive integer greater than or equal to 1. For example, if the length of the target video is 20 seconds, the image extraction rule may be to select 1 reference image and 4 non-reference images in the target video, and determine the image of the 10th second in the target video as the reference image, which will be 1st. Seconds, 3rd, 18th, and 20th seconds are used as non-reference images.
  • the embodiment of the present application does not limit the number of non-reference images.
  • the number of non-reference images may be three, the number of non-reference images may be four, and the number of non-reference images may be five.
  • the reference image and the non-reference image are images extracted from different moments in the target video, and the reference image is the same as the shooting scene of the non-reference image, but the angle of view of the reference image is different from the position of the non-reference image.
  • the user captures a 10-second target video by using the mobile terminal, and the shooting scene of the target video is Plant A and Plant B, for setting the image extraction rule in advance to extract the image of the 5th second in the target video as a reference image.
  • Step S12 constructing a first image pyramid by using a reference image, and constructing m second image pyramids by using m non-reference images.
  • a first image pyramid can be constructed by using one reference image, and m second image pyramids are constructed by using m non-reference images.
  • the "first" and “second” in the first image pyramid and the second image pyramid are only used to distinguish image pyramids constructed from different images, the first image pyramid represents only the image pyramid constructed by the reference image, and the second image pyramid Represents only image pyramids constructed from non-reference images.
  • the mobile terminal uses the reference image as the bottom image of the first image pyramid. Then, the resolution of the underlying image of the first image pyramid is reduced to half as the upper layer image of the underlying image of the first image pyramid, and this step is continuously repeated to continuously obtain the upper layer image of the first image pyramid. Finally, the first image pyramid with a reference image of different resolution can be obtained by repeating several times.
  • the mobile terminal uses the reference image as the third layer image of the first image pyramid, then the first image pyramid
  • the resolution of the third layer image is 1000 ⁇ 1000; then, the resolution of the third layer image of the first image pyramid is reduced to half as the second layer image of the first image pyramid, then the second image pyramid is second
  • the resolution of the layer image is 500 ⁇ 500; finally, the resolution of the second layer image of the first image pyramid is further reduced to half as the third layer image of the first image pyramid, then the third layer image of the first image pyramid
  • the resolution is 250 ⁇ 250.
  • the first image pyramid includes three layers of images, which are reference images with different resolutions, the first layer image is a reference image with a resolution of 250 ⁇ 250, and the second layer image has a resolution of 500 ⁇ 500.
  • the reference image, the third layer image is a reference image with a resolution of 1000 ⁇ 1000.
  • the construction process of the second image pyramid is the same as the construction process of the first image pyramid, and the number of layers of the second image pyramid and the first image pyramid is also the same, and the first image pyramid and the second image may be defined according to actual conditions. The number of layers in the pyramid.
  • Step S13 Determine a scene depth map of the reference image by using the first image pyramid and the m second image pyramids.
  • the scene depth map of the reference image may be determined by using the first image pyramid and the m second image pyramids.
  • the scene depth map of the reference image represents the relative distance between any pixel point in the reference image and the mobile terminal
  • the pixel value of the pixel point in the scene depth map represents the relative distance between the actual location where the pixel point is located and the mobile terminal.
  • the following is a brief description of the example. For example, assuming that the resolution of the reference image is 100 ⁇ 100, the reference image has 10,000 pixels, and after determining the scene depth map of the reference image by using the first image pyramid and the m second image pyramids, the scene depth map The pixel value of 10000 pixels in the middle represents the relative distance between the actual position where 10000 pixels are located and the mobile terminal.
  • Step S14 dividing the pixel points of the reference image into n depth layers by using the scene depth map.
  • the depth of the object corresponding to the pixel in the different depth layer to the mobile terminal is different, where n is greater than or equal to 2, and each depth layer has a depth range.
  • the depth of a certain depth layer may range from 10 meters to 20 degrees. Meter.
  • the n depth layers constitute the scene depth of the reference image, and the scene depth is the distance between the mobile terminal and the position of the farthest pixel point in the reference image.
  • the scene depth may be 0 to 30 meters.
  • the mobile terminal can acquire the preset n and the manner of dividing the depth layer, so that the number of depth layers and the depth range of each depth layer can be known. After the scene depth map of the reference image is obtained, the pixel values of the pixel points in the scene depth map can be determined. Since the pixel value of the pixel point in the scene depth map indicates the relative distance between the actual position where the pixel point is located and the mobile terminal, the mobile terminal may divide each pixel point of the reference image into n according to the pixel value of the pixel point of the scene depth map. In the depth layer.
  • the mobile terminal divides the depth of the reference image into three depth layers according to a preset rule, and the depth of the first depth layer ranges from 0 meters to 10 meters.
  • the second depth layer has a depth ranging from 10 meters to 20 meters
  • the third depth layer has a depth ranging from 20 meters to 30 meters.
  • the pixel A in the reference image is 15 meters relative to the mobile terminal
  • the pixel A is divided into the second depth layer
  • the actual position of the pixel B in the reference image is The relative distance of the mobile terminal is 25 meters
  • the pixel point B is divided into the third depth layer
  • the actual position of the pixel point C in the reference image is 5 meters relative to the mobile terminal, then the pixel point C It will be divided into the first depth layer.
  • Step S15 determining a target position in the reference image.
  • the target position is determined in the reference image according to the control command.
  • the control instruction may be an instruction input by the user on the touch screen of the mobile terminal by using a finger. For example, the user clicks a certain position in the reference image displayed on the touch screen of the mobile terminal by using the finger, and the mobile terminal determines the location clicked by the user as the target position.
  • the specific position in the reference image is determined as the target position.
  • the specific position in the reference image is a previously specified position. For example, by determining the center point of the reference image as a specific position in advance, the mobile terminal can determine the center point of the reference image as the target position. For another example, the location closest to the mobile terminal in the reference image is determined as a specific location in advance, and then the mobile terminal can determine the location closest to the mobile terminal in the reference image as the target location.
  • the face image in the reference image is identified, and the position of the face image in the reference image is determined as the target position. Since the face image in the reference image does not necessarily be in the position of the reference image, the mobile terminal needs to first recognize the face image in the reference image. After the face image in the reference image is recognized, the position where the face image is located is determined, and the position where the face image is located is determined as the target position.
  • Step S16 Determine, from the n depth layers, a target depth layer where the pixel point corresponding to the target position is located.
  • determining, from the n depth layers, the target depth layer where the pixel corresponding to the target location is located may include the following steps: first, acquiring a specified pixel point of the target position of the reference image; and second step, at the scene depth The pixel value corresponding to the specified pixel point is determined in the figure; in the third step, the target depth layer where the specified pixel point is located is determined in the n depth layers according to the pixel value corresponding to the specified pixel point.
  • the mobile terminal After the mobile terminal determines the target location in the reference image, it can directly go to the specified pixel point of the target location, and then determine the pixel value corresponding to the specified pixel point in the scene depth map, and then the pixel value can be known to correspond to the pixel value.
  • the target depth layer in this case, the target depth layer where the pixel point corresponding to the target position is located can be determined in the n depth layers.
  • the mobile terminal divides the depth of the reference image into three depth layers according to a preset rule, and the depth of the first depth layer is 0 meters. Up to 10 meters, the depth of the second depth layer ranges from 10 meters to 20 meters, and the depth of the third depth layer ranges from 20 meters to 30 meters.
  • the target depth layer corresponding to the pixel value of 15 meters is the first The two depth layers, because the pixel value of 15 meters falls within the depth range of the second depth layer by 10 meters to 20 meters, so the target depth layer where the pixel point A is located is the second depth layer.
  • the pixel corresponding to the target depth layer may be a pixel of one object, and the pixel corresponding to the target depth layer may also be a pixel of multiple objects.
  • the object formed by the pixel points corresponding to the target depth layer is only one flower.
  • the object formed by the pixel corresponding to the target depth layer includes a flower and a tree.
  • the object formed by the pixel corresponding to the target depth layer is a part of a tree.
  • the object formed by the pixel corresponding to the target depth layer includes a part of a flower and a part of a tree.
  • Step S17 Perform blur processing on the pixel to be processed.
  • the pixel to be processed is a pixel point included in a depth layer other than the target depth layer among the n depth layers.
  • the mobile terminal determines the target depth layer where the pixel corresponding to the target position is located from the n depth layers, it can be known that the pixel points in the target depth layer need to be kept clear, and the n depth layers except the target depth layer
  • the pixels included in the depth layer need to be blurred, and the pixel to be processed is the pixel that needs to be blurred, so the pixel to be processed is blurred.
  • the reference image becomes an image in which the pixel points of the target depth layer are clear and the pixels to be processed are blurred.
  • the pixel to be processed can be blurred by a Gaussian blur algorithm.
  • fuzzy algorithms can also be used for processing.
  • the mobile terminal divides the depth of the reference image into three depth layers according to a preset rule, and the depth of the first depth layer is 0 meters. Up to 10 meters, the depth of the second depth layer ranges from 10 meters to 20 meters, and the depth of the third depth layer ranges from 20 meters to 30 meters.
  • the target depth layer corresponding to the pixel value of 15 meters is the first Two depth layers, so the pixels to be processed contained in the first depth layer and the third depth layer need to be blurred, and the pixels in the second depth layer need to be kept clear.
  • the reference image becomes the pixel of the second depth layer, and the first depth layer and the third layer An image of a depth layer of pixels to be processed that is blurred.
  • step S17 in order to make the pixels to be processed have different degrees of blurring, thereby embodying the layering of the distance in the reference image, the following manner may be implemented. Therefore, the step S17 may further include the following steps: first, determining L depth layers where the pixel to be processed is located, L is greater than or equal to 2 and less than n; and in the second step, calculating a depth difference between the L depth layers and the target depth layer; In the third step, the pixel points of each of the L depth layers are subjected to a predetermined ratio of blur processing according to the depth difference, and the degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference .
  • the pixels to be processed are distributed in different depth layers, it is necessary to determine the L depth layers where the pixel points to be processed are located, and then calculate the depth difference between the L depth layers and the target depth layer.
  • the depth difference is the distance between two depth layers, for example, the depth of the first depth layer ranges from 0 meters to 10 meters, and the depth of the second depth layer ranges from 10 meters to 20 meters, and the third depth layer
  • the depth range is 20 meters to 30 meters, then the depth difference between the first depth layer and the second depth layer is 10 meters, and the depth difference between the first depth layer and the third depth layer is 20 meters.
  • the pixel points of each of the L depth layers may be subjected to a predetermined ratio of blur processing according to the depth difference. For example, suppose the first depth layer is the target depth layer, the second depth layer and the third depth layer are the two depth layers where the pixel to be processed is located, and the depth of the first depth layer and the second depth layer The difference is 10 meters, and the difference between the depth of the first depth layer and the third depth layer is 20 meters, then the pixel of the second depth layer is blurred by 25%, and the pixel of the third depth layer is used. The point is blurred by 50%.
  • the depth difference between the L depth layers and the target depth layer can be calculated, and then the mobile terminal can each depth in the L depth layers according to the depth difference.
  • the pixels of the layer are subjected to a preset ratio of blurring.
  • the degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference, and if the depth difference between the depth layer and the target depth layer in the L depth layers is larger, then the pixel points in the depth layer The greater the degree of blurring; if the depth difference between the depth layer and the target depth layer in the L depth layers is smaller, the degree of blurring of the pixel points in the depth layer is smaller, thereby reflecting the level of different distances in the reference image sense.
  • the embodiment of the present application divides each pixel of the reference image into n depth layers by using the obtained scene depth map, and then uses the determined target image position of the reference image at n depths.
  • the target depth layer in which the pixel of the target location is located is determined. Therefore, in the embodiment of the present application, the pixel to be processed included in the depth layer other than the target depth layer in the n depth layers may be subjected to blur processing to obtain the target depth.
  • An image in which the pixels of the layer are clear and the pixels to be processed are blurred. Therefore, the embodiment of the present application can cause the mobile terminal to capture an image with a clear foreground and a blurred background.
  • FIG. 2 is a flowchart of another image background blurring method provided by an embodiment of the present application.
  • the embodiment shown in FIG. 2 is an embodiment based on the refinement of step S12 in FIG. 1, so that the same contents as in FIG. 1 can be referred to the embodiment shown in FIG. 1.
  • the method shown in Figure 2 includes the following steps.
  • Step S21 Determine a preliminary depth map of the reference image according to the top image of the first image pyramid and the top image of the m second image pyramids, the first image pyramid and the m second image pyramids each including a top image and a lower layer image.
  • the first layer image of the first image pyramid is referred to as a top layer image
  • the second layer image to the last layer image of the first image pyramid is collectively referred to as a lower layer image
  • the last image of the first image pyramid is The layer image is called the underlying image.
  • the first layer image of the second image pyramid is referred to as the top layer image
  • the second layer image of the second image pyramid is collectively referred to as the lower layer image
  • the last layer image of the second image pyramid is referred to as the bottom layer image.
  • Step S22 Determine a scene depth map of the reference image according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids.
  • the reference images at different resolutions are depth-sampled in the first image pyramid and the m second image pyramids, and the high-resolution scene is derived using the low-resolution preliminary depth map.
  • the depth map thereby speeding up the depth recovery, so the embodiment of the present application can use the image pyramid to generate the scene depth map of the reference image more quickly.
  • FIG. 3 is a flowchart of still another image background blurring method provided by an embodiment of the present application.
  • the embodiment shown in FIG. 3 is based on the refined embodiment of step S21 in FIG. 2, so the same content as FIG. 2 can be seen in the embodiment shown in FIG. 2.
  • the method shown in Figure 3 includes the following steps.
  • Step S31 Calculate a first matching loss body according to the top image of the first image pyramid and the top image of the m second image pyramids.
  • Step S32 constructing a MRF (Markov Random Field) model according to the first matching loss body to perform global matching loss optimization, and obtain a preliminary depth map of the reference image.
  • MRF Markov Random Field
  • the first matching loss body may be first calculated according to the top image of the first image pyramid and the top image of the m second image pyramids; and then the MRF model is constructed according to the first matching loss body.
  • the global matching loss is optimized so that a preliminary depth map of the reference image with a smooth detail can be obtained.
  • FIG. 4 is a flowchart of still another image background blurring method provided by an embodiment of the present application.
  • the embodiment shown in FIG. 4 is based on the refined embodiment of step S31 in FIG. 3, so the same content as FIG. 3 can be seen in the embodiment shown in FIG.
  • the method shown in Figure 4 includes the following steps.
  • Step S41 Acquire a camera external parameter and a camera internal parameter of the mobile terminal in the perspective of the reference image and the m non-reference images.
  • the mobile terminal can refer to the coordinates of the feature points of the image and the non-reference image, the correspondence relationship of the feature points, and the SFM (Structure from Motion) algorithm to calculate the reference image and the non-reference image.
  • the camera external reference of the corresponding mobile terminal in the perspective the camera external reference of the mobile terminal includes the camera optical center coordinates and the camera optical axis orientation.
  • the camera internal parameters are obtained by pre-calibrating the camera. For example, the mobile terminal can determine the camera internal reference using the camera calibration toolbox through the checkerboard feature.
  • Step S42 Determine feature points in the reference image according to the feature point extraction rule.
  • Step S43 Obtain three-dimensional coordinates of feature points of the reference image.
  • the mobile terminal can perform feature point tracking on the target video by using KLT (Kanade Lucas Tomasi Feature Tracker) algorithm to obtain three-dimensional coordinates of several feature points and several feature points of the reference image.
  • KLT Kanade Lucas Tomasi Feature Tracker
  • Step S44 Determine a minimum depth value and a maximum depth value in the scene where the reference image is located according to the three-dimensional coordinates of the feature points of the reference image.
  • the minimum depth value and the maximum depth value of the feature points in the reference image may be first determined according to the three-dimensional coordinates; then, the depth range formed by the minimum depth value and the maximum depth value of the feature point is expanded by a preset value to obtain a reference.
  • the preset value can be a predetermined empirical value.
  • Step S45 Collect a plurality of depth planes between the minimum depth value and the maximum depth value.
  • the number of depth planes to be collected and the manner in which the depth planes are collected may be preset. For example, 11 depth planes are uniformly collected between the minimum depth value and the maximum depth value.
  • Step S46 Calculate, by using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm, a first homography matrix of a plurality of depth planes from a plane where the reference image is located to a plane where the m non-reference images are located.
  • the number of the first homography matrix is related to the calculation, so a plurality of first homography matrices are obtained here.
  • Step S47 using a Ps (Plane sweep) algorithm and a first homography matrix, projecting each pixel of the top image of the first image pyramid to a top image of the m second image pyramids by using multiple depth planes. On the plane where you are, get the parameter values after each pixel point is projected.
  • Ps Plane sweep
  • the parameter value can be the color and texture of each pixel.
  • Step S48 Determine a matching loss of each pixel point on the depth value according to a parameter value of each pixel point of the top image of the first image pyramid and a parameter value after each pixel point projection.
  • the matching loss can be defined as the absolute difference of the parameter values before and after the re-projection, and the parameter value can be a pixel color gradient.
  • Step S49 determining a matching loss of each pixel point of the top image of the first image pyramid in the plurality of depth planes as the first matching loss body.
  • the conventional method is not used to correct the image before calculating the matching loss, but multiple depth planes are obtained, and the matching loss is calculated by using the re-projection, so that the reference image and m non-can be better adapted in the depth recovery.
  • the reference image changes the camera pose corresponding to the angle of view, improving the reliability of the depth recovery method.
  • FIG. 5 is a flowchart of still another image background blurring method provided by an embodiment of the present application.
  • the embodiment shown in FIG. 5 is based on the refined embodiment of step S45 in FIG. 4, so the same content as FIG. 4 can be seen in the embodiment shown in FIG.
  • the method shown in Figure 5 includes the following steps.
  • Step S51 using a camera internal parameter, a camera external parameter, and a DLT (Direct Linear Transform) algorithm to calculate a second homography of the first depth plane where the minimum depth value is mapped from the reference image plane to the m non-reference image planes.
  • DLT Direct Linear Transform
  • Step S52 Calculate, by using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm, a third homography matrix of the second depth plane where the maximum depth value is located, from the reference image plane to the m non-reference image planes.
  • the number of the second homography matrix is related to the calculation, so a plurality of second homography matrices are obtained here.
  • Step S53 Projecting a pixel point in the reference image onto the plane where the m non-reference images are located according to the second homography matrix, to obtain a first projection point.
  • Step S54 Projecting one pixel point in the reference image onto the plane where the m non-reference images are located according to the third homography matrix, to obtain a second projection point.
  • Step S55 uniformly sampling a line formed between the first projection point and the second projection point to obtain a plurality of sampling points.
  • Step S56 Backprojecting a plurality of sampling points into a three-dimensional space of a viewing angle of the reference image to obtain a plurality of depth planes corresponding to depth values of the plurality of sampling points.
  • the pixel when calculating the matching loss of the pixels of the reference image according to a depth plane, the pixel needs to be re-projected onto the m non-reference image planes, after the multiple depth planes are re-projected.
  • the positions in the m non-reference images are equally spaced, so the embodiment of the present application helps the subsequent steps to extract the pixel matching information between the reference image and the m non-reference images more efficiently, thereby improving the depth map of the scene. Precision.
  • FIG. 6 is a flowchart of still another image background blurring method provided by an embodiment of the present application.
  • the embodiment shown in FIG. 6 is based on the refined embodiment of step S22 in FIG. 2, so the same content as FIG. 2 can be seen in the embodiment shown in FIG. 2.
  • the method shown in Figure 6 includes the following steps.
  • Step S61 Determine pixel points of the lower layer image of the first image pyramid corresponding to the pixel points of the top image of the first image pyramid.
  • Step S62 Determine pixel points of the lower layer images of the m second image pyramids corresponding to the pixel points of the top image of the m second image pyramids.
  • Step S63 Determine an estimated depth value of a pixel point of the lower layer image of the first image pyramid according to the preliminary depth map.
  • Step S64 Determine a minimum depth value and a maximum depth value of the pixel points of the lower layer image of the first image pyramid according to the estimated depth value.
  • Step S65 Determine a plurality of depth planes of the lower layer image of the first image pyramid between the minimum depth value and the maximum depth value.
  • Step S66 Calculate a second matching loss body corresponding to the lower layer image of the first image pyramid and the lower layer image of the m second image pyramids by using the plane scanning algorithm and the plurality of depth planes.
  • Step S67 Using the lower layer image of the first image pyramid as the guide image, locally optimizing the second matching loss body by using a bootstrap filtering algorithm to obtain a third matching loss body.
  • Step S68 Select a depth value with a minimum matching loss in the second matching loss body for each pixel of the lower layer image of the first image pyramid according to the third matching loss body, to obtain a scene depth map of the reference image.
  • the preliminary depth map is used to estimate the minimum depth value and the maximum depth value of the pixel points of the lower layer image of the first image pyramid, thereby determining a relatively small depth search interval, thereby reducing the amount of calculation and The robustness of the depth recovery method to interference such as image noise is improved.
  • FIG. 7 is a schematic diagram of an image background blurring apparatus provided by an embodiment of the present application.
  • FIG. 7 is an embodiment of the apparatus corresponding to FIG. 1.
  • the terminal device includes the following modules:
  • the extraction module 11 is configured to extract a reference image and m non-reference images in the target video according to an image extraction rule, where the target video is a video captured by the mobile terminal according to a predetermined trajectory, m is greater than or equal to 9;
  • a building module 12 configured to construct a first image pyramid by using a reference image, and construct m second image pyramids by using m non-reference images;
  • a first determining module 13 configured to determine a scene depth map of the reference image by using the first image pyramid and the m second image pyramids, where the scene depth map of the reference image represents a relative distance between any pixel point and the mobile terminal in the reference image ;
  • the dividing module 14 is configured to divide the pixel points of the reference image into the n depth layers by using the scene depth map, wherein the objects corresponding to the pixel points in the different depth layers are different in depth to the mobile terminal, where n is greater than or equal to 2;
  • a second determining module 15 configured to determine a target location in the reference image
  • the third determining module 16 is configured to determine, from the n depth layers, a target depth layer where the pixel point corresponding to the target location is located;
  • the fuzzy processing module 17 is configured to perform blur processing on the pixel to be processed, where the pixel to be processed is a pixel point included in a depth layer other than the target depth layer among the n depth layers.
  • the first determining module 13 is configured to determine, according to the top image of the first image pyramid and the top image of the m second image pyramids, a preliminary depth map of the reference image, the first image pyramid and the m second image pyramids.
  • Each includes a top layer image and a bottom layer image; and a scene depth map of the reference image is determined according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids.
  • the first determining module 13 is configured to calculate a first matching loss body according to the top image of the first image pyramid and the top image of the m second image pyramids; and construct a Markov according to the first matching loss body
  • the airport model performs global matching loss optimization to obtain a preliminary depth map of the reference image.
  • the first determining module 13 is configured to acquire a camera external parameter and a camera internal parameter of the mobile terminal at a viewing angle where the reference image and the m non-reference images are located; and determine a feature point in the reference image according to the feature point extraction rule; Obtaining a three-dimensional coordinate of the feature point of the reference image; determining a minimum depth value and a maximum depth value in the scene where the reference image is located according to the three-dimensional coordinates of the feature point of the reference image; determining a plurality of depth planes between the minimum depth value and the maximum depth value; Using a camera internal parameter, a camera external parameter and a direct linear transformation algorithm, calculating a first homography matrix of a plurality of depth planes from a plane in which the reference image is located to a plane in which the m non-reference images are located; using the plane scanning algorithm and the first single a pixel matrix, each pixel of the top image of the first image pyramid is projected in a plurality of depth planes onto a plane on which
  • the first determining module 13 is configured to calculate, by using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm, a first depth plane where the minimum depth value is located, and a mapping from the reference image plane to the m non-reference image planes.
  • a second homography matrix using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm to calculate a third homography matrix in which the second depth plane where the maximum depth value is located is mapped from the reference image plane to m non-reference image planes; A pixel in the reference image is projected onto the plane of the m non-reference images according to the second homography matrix to obtain a first projection point; and one pixel point in the reference image is projected to the third homography matrix to m a second projection point is obtained on a plane where the non-reference image is located; a plurality of sampling points are uniformly sampled on a line formed between the first projection point and the second projection point; and the plurality of sampling points are back-projected to the reference image In the three-dimensional space of the viewing angle, a plurality of depth planes corresponding to the depth values of the plurality of sampling points are obtained.
  • the first determining module 13 is specifically configured to determine a pixel point of the lower layer image of the first image pyramid corresponding to the pixel point of the top image of the first image pyramid; and determine the top image of the m second image pyramid a pixel point of the lower layer image of the m second image pyramids corresponding to the pixel; determining an estimated depth value of the pixel point of the lower layer image of the first image pyramid according to the preliminary depth map; determining the lower layer image of the first image pyramid according to the estimated depth value a minimum depth value and a maximum depth value of the pixel; determining a plurality of depth planes of the lower layer image of the first image pyramid between the minimum depth value and the maximum depth value; calculating the first image pyramid using the plane scanning algorithm and the plurality of depth planes
  • the second matching loss body corresponding to the lower layer image of the m second image pyramids; the lower layer image of the first image pyramid is used as the guiding image, and the second matching loss body is locally optimized by the guiding filtering algorithm to obtain the third matching Loss
  • the third determining module 16 is specifically configured to acquire a specified pixel point of the target position of the reference image; determine a pixel value corresponding to the specified pixel point in the scene depth map; and obtain n pixel values according to the specified pixel point Determine the target depth layer where the specified pixel is located in the depth layer.
  • the blur processing module 17 is specifically configured to determine L depth layers where the pixel to be processed is located, L is greater than or equal to 2 and less than n; and calculating a depth difference between the L depth layers and the target depth layer; The pixel points of each depth layer in the depth layer are subjected to a preset ratio of blurring processing, and the degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference.
  • FIG. 8 is a schematic diagram of still another image background blurring device provided by an embodiment of the present application.
  • the apparatus includes: a processor 21 and a memory 22, wherein the memory 22 stores operation instructions executable by the processor 21, and the processor 21 reads operation instructions in the memory 22 for implementing the above method embodiments. The method in .
  • FIG. 9 is a schematic diagram showing a design structure of an image background blurring device provided by an embodiment of the present application.
  • the image background blurring device includes a transmitter 1101, a receiver 1102, a controller/processor 1103, a memory 1104, and a modem processor 1105.
  • Transmitter 1101 conditions (e.g., analog transforms, filters, amplifies, and upconverts, etc.) the output samples and generates an uplink signal that is transmitted to the base station via the antenna.
  • the antenna receives the downlink signal transmitted by the base station.
  • Receiver 1102 conditions (eg, filters, amplifies, downconverts, digitizes, etc.) the signals received from the antenna and provides input samples.
  • encoder 1106 receives the traffic data and signaling messages to be transmitted on the uplink and processes (e.g., formats, codes, and interleaves) the traffic data and signaling messages.
  • Modulator 1107 further processes (e.g., symbol maps and modulates) the encoded traffic data and signaling messages and provides output samples.
  • Demodulator 1109 processes (e.g., demodulates) the input samples and provides symbol estimates.
  • the decoder 1108 processes (e.g., deinterleaves and decodes) the symbol estimate and provides decoded data and signaling messages that are sent to the terminal.
  • Encoder 1106, modulator 1107, demodulator 1109, and decoder 1108 may be implemented by a composite modem processor 1105. These units are processed according to the radio access technology employed by the radio access network (e.g., access technologies of LTE and other evolved systems).
  • the controller/processor 1103 is configured to extract a reference image and m non-reference images in the target video according to an image extraction rule, where the target video is a video captured by the mobile terminal according to a predetermined trajectory, m is greater than or equal to 1; constructing with the reference image a first image pyramid, m first image pyramids are constructed using m non-reference images; a scene depth map of the reference image is determined using the first image pyramid and the m second image pyramids, and the scene depth map of the reference image represents the reference image
  • the relative distance between the arbitrary pixel and the mobile terminal; the pixel of the reference image is divided into n depth layers by using the scene depth map, wherein the depth of the object corresponding to the pixel in the different depth layer is different to the mobile terminal, where n
  • the target position is determined in the reference image; the target depth layer where the pixel corresponding to the target position is located is determined from the n depth layers; the pixel to be processed is blurred, and the pixel to be processed is n
  • the disclosed systems, devices, and methods may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of cells is only a logical function division.
  • multiple units or components may be combined or integrated. Go to another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present application 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.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Human Computer Interaction (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

Embodiments of the present application disclose an image background blurring method and apparatus. The method comprises: extracting a reference image and m non-reference images from a target video according to an image extraction rule; constructing a first image pyramid by using the reference image, and constructing m second image pyramids by using the m non-reference images; determining a scene depth map of the reference image by using the first image pyramid and the m second image pyramids; dividing pixel points of the reference image into n depth layers by using the scene depth map; determining target positions in the reference image; determining, from the n depth layers, a target depth layer at which pixel points corresponding to the target positions are located; and blurring pixels to be processed. In the embodiments of the present application, pixels to be processed comprised in a depth layer of n depth layers other than a target depth layer can be blurred, so as to obtain an image in which pixels of the target depth layer are clear and the pixels to be processed are blurred.

Description

一种图像背景虚化方法及装置Image background blurring method and device 技术领域Technical field
本申请实施例涉及图像处理技术领域,更具体的说,涉及图像背景虚化方法及装置。The embodiments of the present application relate to the field of image processing technologies, and in particular, to an image background blurring method and apparatus.
背景技术Background technique
图像的背景虚化,是指在一个图像中让焦点聚集在主题上,并且模糊非主题元素的拍摄手段。例如,我们拍摄一张山水照时,我们要将山体作为整个图像的主题,就可以将相机的焦点对准山体,此时山体的成像就会变得清晰,而水面就会变得模糊;如果我们要将水面作为整个图像的主题,就需要将相机的焦点对准水面,此时水面的成像就会变得清晰,而山体就会变得模糊。The background blur of an image refers to the way in which focus is focused on a theme in an image, and the non-theme elements are blurred. For example, when we take a picture of a landscape, we want to use the mountain as the theme of the whole image, we can focus the camera on the mountain, and the image of the mountain will become clear, and the water will become blurred; We want to use the water surface as the theme of the whole image, we need to focus the camera on the water surface, the image of the water surface will become clear, and the mountain will become blurred.
目前,拍摄背景虚化效果的照片通常需要使用具备大光圈的单反相机,而目前被广泛使用的智能手机由于受到体积、成本和使用环境等限制,其搭配的镜头基本属于光圈小的类型,所以具备数码拍照功能的智能手机由于硬件限制无法使图像达到背景虚化的效果。At present, photographs with background blurring effects usually require a SLR camera with a large aperture. However, the currently widely used smartphones are limited in size, cost, and use environment, and the lenses they match are basically of a small aperture type. Smartphones with digital camera functions cannot achieve image blurring due to hardware limitations.
因此,如何利用利用智能手机拍摄出一张前景清晰且背景模糊的表达视觉美感的图像,成为目前亟需解决的技术问题。Therefore, how to use a smart phone to capture a visually beautiful image with a clear foreground and a blurred background has become a technical problem that needs to be solved.
发明内容Summary of the invention
本申请实施例提供一种图像背景虚化方法及装置,以使移动终端可以拍摄出前景清晰且背景模糊的图像。本申请实施例是这样实现的:第一方面,本申请实施例提供了一种图像背景虚化方法,该方法包括:按照图像提取规则在目标视频中提取一个参考图像和m个非参考图像;利用参考图像构建第一图像金字塔,利用m个非参考图像构建m个第二图像金字塔;利用第一图像金字塔和m个第二图像金字塔确定参考图像的场景深度图;利用场景深度图将参考图像的像素点划分到n个深度层;在参考图像中确定目标位置;从n个深度层中确定出目标位置对应的像素点所在的目标深度层;将待处理像素点进行模糊处理。The embodiment of the present application provides an image background blurring method and device, so that the mobile terminal can capture an image with a clear foreground and a blurred background. The embodiment of the present application is implemented as follows: In a first aspect, an embodiment of the present application provides an image background blurring method, the method comprising: extracting a reference image and m non-reference images in a target video according to an image extraction rule; Constructing a first image pyramid using the reference image, constructing m second image pyramids using m non-reference images; determining a scene depth map of the reference image using the first image pyramid and the m second image pyramids; using the scene depth map to reference the image The pixel points are divided into n depth layers; the target position is determined in the reference image; the target depth layer where the pixel point corresponding to the target position is located is determined from the n depth layers; and the pixel to be processed is subjected to blur processing.
其中,目标视频为利用移动终端按照预定轨迹拍摄的视频,预定轨迹可以被预先设定,预定轨迹为在同一个平面上的移动轨迹。预定轨迹可以为在同一个平面上由左到右的移动轨迹,预定轨迹也可以为在同一个平面上由右到左的移动轨迹,预定轨迹还可以为在同一个平面上由上到下的移动轨迹,预定轨迹还可以为在同一个平面上由下到上的移动轨迹。The target video is a video captured by the mobile terminal according to a predetermined trajectory, and the predetermined trajectory may be preset, and the predetermined trajectory is a moving trajectory on the same plane. The predetermined trajectory may be a left-to-right moving trajectory on the same plane, and the predetermined trajectory may also be a right-to-left moving trajectory on the same plane, and the predetermined trajectory may also be top-to-bottom in the same plane. The moving track, the predetermined track may also be a moving track from bottom to top on the same plane.
图像提取规则为预先设定好的规则,图像提取规则可以为根据目标视频的播放时长在目标视频中选择一个参考图像和m个非参考图像,m为大于等于1的正整数。The image extraction rule is a preset rule, and the image extraction rule may be: selecting a reference image and m non-reference images in the target video according to the playing duration of the target video, where m is a positive integer greater than or equal to 1.
参考图像和非参考图像均为在目标视频中从不同时刻提取出来的图像,而且参考图像与非参考图像的拍摄场景是相同的,但是,拍摄参考图像的视角与拍摄非参考图像的位置是不同的。The reference image and the non-reference image are images extracted from different moments in the target video, and the reference image is the same as the shooting scene of the non-reference image, but the angle of view of the reference image is different from the position of the non-reference image. of.
移动终端在利用参考图像构建第一图像金字塔的过程中,移动终端会以参考图像作为第一图像金字塔的底层图像。然后,将第一图像金字塔的底层图像的分辨率缩小至一半作为第一图像金字塔的底层图像的上一层图像,并不断的重复此步骤,不断的获得第一图像金字塔的上一层图像。最后,重复若干次便可得到一个具有不同分辨率的参考图像的第一 图像金字塔。In the process of constructing the first image pyramid by using the reference image, the mobile terminal uses the reference image as the bottom image of the first image pyramid. Then, the resolution of the underlying image of the first image pyramid is reduced to half as the upper layer image of the underlying image of the first image pyramid, and this step is continuously repeated to continuously obtain the upper layer image of the first image pyramid. Finally, the first image pyramid of a reference image having a different resolution can be obtained by repeating several times.
参考图像的场景深度图表示参考图像中的任意像素点与移动终端之间的相对距离,场景深度图中的像素点的像素值表示像素点所在的实际位置与移动终端的相对距离。The scene depth map of the reference image represents the relative distance between any pixel point in the reference image and the mobile terminal, and the pixel value of the pixel point in the scene depth map represents the relative distance between the actual location where the pixel point is located and the mobile terminal.
移动终端可以获取到预先设定好的n和划分深度层的方式,从而可以得知深度层的数量以及每个深度层的深度范围。The mobile terminal can acquire the preset n and the manner of dividing the depth layer, so that the number of depth layers and the depth range of each depth layer can be known.
在参考图像中确定目标位置的方式有很多种,下面简要来介绍这几种方式。There are many ways to determine the target position in the reference image. These are briefly introduced below.
第一种方式,根据控制指令在参考图像中确定目标位置。其中,控制指令可以为用户利用手指在移动终端的触摸屏幕上输入的指令。In the first way, the target position is determined in the reference image according to the control command. Wherein, the control instruction may be an instruction input by the user on the touch screen of the mobile terminal by using a finger.
第二种方式,将参看图像中的特定位置确定为目标位置。其中,参看图像中的特定位置为预先被指定的位置。In the second way, the specific position in the reference image is determined as the target position. Wherein, the specific position in the reference image is a previously specified position.
第三种方式,识别参考图像中的人脸图像,将参考图像中的人脸图像所在的位置确定为目标位置。In the third method, the face image in the reference image is identified, and the position of the face image in the reference image is determined as the target position.
其中,n大于等于2,待处理像素点为n个深度层中除目标深度层以外的深度层中所包含的像素点。Where n is greater than or equal to 2, the pixel to be processed is a pixel point included in a depth layer other than the target depth layer among the n depth layers.
在第一方面中,本申请实施例利用得到的场景深度图将参考图像的每个像素点划分到n个深度层,再利用确定出的参考图像的目标位置,在n个深度层中确定该目标位置的像素点所在的目标深度层,因此,本申请实施例可以将n个深度层中除目标深度层以外的深度层中所包含的待处理像素点进行模糊处理,以得到目标深度层的像素点清晰且待处理像素点模糊的图像。In the first aspect, the embodiment of the present application divides each pixel of the reference image into n depth layers by using the obtained scene depth map, and determines the target position in the n depth layers by using the determined target position of the reference image. The target depth layer in which the pixel of the target position is located. Therefore, in the embodiment of the present application, the pixel to be processed included in the depth layer other than the target depth layer in the n depth layers may be blurred to obtain the target depth layer. An image with clear pixels and blurred pixels to be processed.
在一种可能的实现方式中,利用第一图像金字塔和m个第二图像金字塔确定参考图像的场景深度图包括:根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像确定参考图像的初步深度图,第一图像金字塔和m个第二图像金字塔均包括顶层图像和下层图像;根据初步深度图、第一图像金字塔的下层图像和m个第二图像金字塔的下层图像,确定参考图像的场景深度图。In a possible implementation, determining the scene depth map of the reference image by using the first image pyramid and the m second image pyramids comprises: determining a reference according to the top image of the first image pyramid and the top image of the m second image pyramids a preliminary depth map of the image, the first image pyramid and the m second image pyramids each including a top image and a lower image; determining a reference according to the preliminary depth map, the lower image of the first image pyramid, and the lower image of the m second image pyramids The depth map of the scene of the image.
其中,在第一图像金字塔和m个第二图像金字塔中对不同分辨率下的参考图像进行深度采样,利用低分辨率的初步深度图推导出高分辨率的场景深度图,从而加快了深度恢复的速度,所以本申请实施例可以利用图像金字塔更加快速的生成参考图像的场景深度图。Wherein, the reference image at different resolutions is deeply sampled in the first image pyramid and the m second image pyramids, and the high-resolution scene depth map is derived by using the low-resolution preliminary depth map, thereby speeding up the depth recovery The speed of the reference image depth can be generated more quickly by the embodiment of the present application.
在一种可能的实现方式中,根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像确定参考图像的初步深度图包括:根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像,计算第一匹配损失体;根据第一匹配损失体构建马尔科夫随机场模型进行全局匹配损失优化,得到参考图像的初步深度图。In a possible implementation, determining a preliminary depth map of the reference image according to the top image of the first image pyramid and the top image of the m second image pyramids comprises: a top image according to the first image pyramid and m second images The top image of the pyramid is used to calculate the first matching loss body; the Markov random field model is constructed according to the first matching loss body to optimize the global matching loss, and the preliminary depth map of the reference image is obtained.
其中,可以先根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像,计算第一匹配损失体;然后,再根据第一匹配损失体构建MRF模型进行全局匹配损失优化,从而可以得到细节平滑的参考图像的初步深度图。The first matching loss body may be first calculated according to the top image of the first image pyramid and the top image of the m second image pyramids; then, the MRF model is constructed according to the first matching loss body to perform global matching loss optimization, thereby A preliminary depth map of the reference image with a smooth detail.
在一种可能的实现方式中,根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像,计算第一匹配损失体包括:获取参考图像和m个非参考图像所在的视角下的移动终端的相机外参和相机内参;根据特征点提取规则确定参考图像中的特征点;获取参考图像的特征点的三维坐标;根据参考图像的特征点的三维坐标确定参考图像所在场景内的最小深度值和最大深度值;在最小深度值和最大深度值之间确定多个深度平面;利用相机 内参、相机外参和直接线性变换算法,计算多个深度平面由参考图像所在的平面到m个非参考图像所在的平面映射的第一单应性矩阵;利用平面扫描算法和第一单应性矩阵,将第一图像金字塔的顶层图像的每个像素点以多个深度平面投影到m个第二图像金字塔的顶层图像所在的平面上,得到每个像素点投影后的参数值;根据第一图像金字塔的顶层图像的每个像素点的参数值和每个像素点投影后的参数值,确定每个像素点在深度值上的匹配损失;将第一图像金字塔的顶层图像的每个像素点在多个深度平面的匹配损失确定为第一匹配损失体。In a possible implementation manner, calculating, according to the top image of the first image pyramid and the top image of the m second image pyramids, calculating the first matching loss body includes: obtaining the reference image and the view angle of the m non-reference images a camera external parameter and a camera internal parameter of the mobile terminal; determining a feature point in the reference image according to the feature point extraction rule; acquiring a three-dimensional coordinate of the feature point of the reference image; determining a minimum of the reference image in the scene according to the three-dimensional coordinate of the feature point of the reference image a depth value and a maximum depth value; determining a plurality of depth planes between the minimum depth value and the maximum depth value; using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm to calculate a plurality of depth planes from a plane in which the reference image is located to m a first homography matrix of a plane map in which the non-reference image is located; using a plane scan algorithm and a first homography matrix, each pixel point of the top image of the first image pyramid is projected to m pieces by multiple depth planes The plane value of each pixel point is obtained on the plane where the top image of the image pyramid is located; a parameter value of each pixel of the top image of the first image pyramid and a parameter value after each pixel point projection, determining a matching loss of each pixel point on the depth value; each of the top image of the first image pyramid The matching loss of the pixel points in the plurality of depth planes is determined as the first matching loss body.
其中,通过获得多个深度平面,再利用重投影计算匹配损失,这样在深度恢复时能更好的适应参考图像和m个非参考图像对应视角的相机位姿变化,提高深度恢复方法的可靠性。In addition, by obtaining multiple depth planes, the re-projection is used to calculate the matching loss, so that the depth of the camera can be better adapted to the camera pose changes of the reference image and the m non-reference images in the depth recovery, and the reliability of the depth recovery method is improved. .
在一种可能的实现方式中,在最小深度值和最大深度值之间确定多个深度平面包括:利用相机内参、相机外参和直接线性变换算法,计算最小深度值所在的第一深度平面由参考图像平面到m个非参考图像平面映射的第二单应性矩阵;利用相机内参、相机外参和直接线性变换算法,计算最大深度值所在的第二深度平面由参考图像平面到m个非参考图像平面映射的第三单应性矩阵;将参考图像中的一个像素点按照第二单应性矩阵投影到m个非参考图像所在的平面上,得到第一投影点;将参考图像中的一个像素点按照第三单应性矩阵投影到m个非参考图像所在的平面上,得到第二投影点;在第一投影点与第二投影点之间构成的直线上均匀取样得到多个采样点;将多个采样点反向投影到参考图像所在视角的三维空间中,得到与多个采样点的深度值对应的多个深度平面。In a possible implementation manner, determining the plurality of depth planes between the minimum depth value and the maximum depth value comprises: calculating a first depth plane where the minimum depth value is located by using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm The second homography matrix of the reference image plane to m non-reference image plane mappings; using the camera internal parameter, the camera external parameter and the direct linear transformation algorithm, the second depth plane where the maximum depth value is calculated is from the reference image plane to m non- a third homography matrix of the reference image plane mapping; projecting a pixel point in the reference image according to the second homography matrix onto a plane where the m non-reference images are located, to obtain a first projection point; A pixel is projected onto a plane on which the m non-reference images are located according to the third homography matrix to obtain a second projection point; and a plurality of samples are uniformly sampled on a line formed between the first projection point and the second projection point. Point; backprojecting a plurality of sampling points into a three-dimensional space of a viewing angle of the reference image to obtain a plurality of depths corresponding to depth values of the plurality of sampling points flat.
其中,在计算参考图像的像素按照一个深度平面的匹配损失时,需要将该像素重投影到m个非参考图像平面上,在采集到多个深度平面重投影后,在m个非参考图像中的位置是等间距的,所以本申请实施例有助于后续步骤更高效地提取参考图像与m个非参考图像之间的像素匹配信息,进而提升了场景深度图的精度。Wherein, when calculating the matching loss of the pixel of the reference image according to a depth plane, the pixel needs to be re-projected onto the m non-reference image planes, and after the multiple depth planes are re-projected, in the m non-reference images. The positions of the present application are helpful for the subsequent steps to more efficiently extract the pixel matching information between the reference image and the m non-reference images, thereby improving the accuracy of the scene depth map.
在一种可能的实现方式中,根据初步深度图、第一图像金字塔的下层图像和m个第二图像金字塔的下层图像,确定参考图像的场景深度图包括:确定与第一图像金字塔的顶层图像的像素点对应的第一图像金字塔的下层图像的像素点;确定与m个第二图像金字塔的顶层图像的像素点对应的m个第二图像金字塔的下层图像的像素点;根据初步深度图确定第一图像金字塔的下层图像的像素点的估计深度值;根据估计深度值确定第一图像金字塔的下层图像的像素点的最小深度值和最大深度值;在最小深度值和最大深度值之间确定第一图像金字塔的下层图像的多个深度平面;利用平面扫描算法和多个深度平面,计算第一图像金字塔的下层图像和m个第二图像金字塔的下层图像对应的第二匹配损失体;以第一图像金字塔的下层图像作为引导图像,利用引导滤波算法对第二匹配损失体进行局部优化得到第三匹配损失体;根据第三匹配损失体,为第一图像金字塔的下层图像的每个像素点选取第二匹配损失体中匹配损失最小的深度值,得到参考图像的场景深度图。In a possible implementation manner, determining a scene depth map of the reference image according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids includes: determining a top image of the first image pyramid Pixels corresponding to the pixels of the lower image of the first image pyramid; determining pixel points of the lower image of the m second image pyramids corresponding to the pixels of the top image of the m second image pyramids; determining according to the preliminary depth map An estimated depth value of a pixel point of a lower layer image of the first image pyramid; a minimum depth value and a maximum depth value of a pixel point of the lower layer image of the first image pyramid are determined according to the estimated depth value; determining between the minimum depth value and the maximum depth value a plurality of depth planes of the lower layer image of the first image pyramid; calculating a second matching loss body corresponding to the lower layer image of the first image pyramid and the lower layer image of the m second image pyramids by using the plane scanning algorithm and the plurality of depth planes; The lower layer image of the first image pyramid is used as the guide image, using a guided filtering algorithm The second matching loss body is locally optimized to obtain a third matching loss body; according to the third matching loss body, the depth value of the matching loss in the second matching loss body is selected for each pixel of the lower layer image of the first image pyramid, The depth map of the scene of the reference image.
其中,利用初步深度图估计第一图像金字塔的下层图像的像素点的最小深度值和最大深度值,进而确定一个比较小的深度搜索区间,从而降低了计算量并提高了深度恢复方法对图像噪声等干扰的鲁棒性。Wherein, the preliminary depth map is used to estimate the minimum depth value and the maximum depth value of the pixel points of the lower layer image of the first image pyramid, thereby determining a relatively small depth search interval, thereby reducing the calculation amount and improving the depth recovery method for image noise. The robustness of the interference.
在一种可能的实现方式中,从n个深度层中确定出目标位置对应的像素点所在的目标深度层包括:获取参考图像的目标位置的指定像素点;在场景深度图中确定与指定像素点 对应的像素值;根据指定像素点对应的像素值在n个深度层中确定指定像素点所在的目标深度层。In a possible implementation manner, determining, from the n depth layers, a target depth layer where a pixel point corresponding to the target position is located includes: acquiring a specified pixel point of a target position of the reference image; determining and specifying the pixel in the scene depth map The corresponding pixel value of the point; determining the target depth layer where the specified pixel point is located in the n depth layers according to the pixel value corresponding to the specified pixel point.
其中,移动终端在参考图像中确定目标位置以后,便可以直接过去到目标位置的指定像素点,然后,在场景深度图中确定与指定像素点对应的像素值,便可以得知该像素值对应的目标深度层,此时,便可以在n个深度层中确定出目标位置对应的像素点所在的目标深度层。After the mobile terminal determines the target location in the reference image, it can directly go to the specified pixel point of the target location, and then determine the pixel value corresponding to the specified pixel point in the scene depth map, and then the pixel value can be known to correspond to the pixel value. The target depth layer, in this case, the target depth layer where the pixel point corresponding to the target position is located can be determined in the n depth layers.
在一种可能的实现方式中,将待处理像素点进行模糊处理包括:确定待处理像素点所在的L个深度层,L大于等于2且小于n;计算L个深度层与目标深度层的深度差;根据深度差将L个深度层中的每个深度层的像素点进行预设比例的模糊处理,L个深度层中的每个深度层的像素点的模糊程度与深度差成正比。In a possible implementation manner, performing blur processing on the pixel to be processed includes: determining L depth layers where the pixel to be processed is located, L is greater than or equal to 2 and less than n; calculating depths of the L depth layers and the target depth layer Poor; the pixel points of each of the L depth layers are subjected to a predetermined ratio of blur processing according to the depth difference, and the degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference.
其中,由于目标深度层和L个深度层都是可以得到的,所以便可以计算L个深度层与目标深度层的深度差,然后,移动终端便可根据深度差将L个深度层中的每个深度层的像素点进行预设比例的模糊处理。L个深度层中的每个深度层的像素点的模糊程度与深度差成正比,如果L个深度层中的深度层与目标深度层的深度差越大,那么该深度层中的像素点的模糊程度越大;如果L个深度层中的深度层与目标深度层的深度差越小,那么该深度层中的像素点的模糊程度越小,从而可以体现出参考图像中的不同距离的层次感。Wherein, since both the target depth layer and the L depth layers are available, the depth difference between the L depth layers and the target depth layer can be calculated, and then the mobile terminal can each of the L depth layers according to the depth difference. The pixel points of the depth layer are subjected to a preset ratio blurring process. The degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference, and if the depth difference between the depth layer and the target depth layer in the L depth layers is larger, then the pixel points in the depth layer The greater the degree of blurring; if the depth difference between the depth layer and the target depth layer in the L depth layers is smaller, the degree of blurring of the pixel points in the depth layer is smaller, thereby reflecting the level of different distances in the reference image sense.
第二方面,本申请实施例提供了一种图像背景虚化装置,该装置包括:提取模块,用于按照图像提取规则在目标视频中提取一个参考图像和m个非参考图像,目标视频为利用移动终端按照预定轨迹拍摄的视频,m大于等于9;In a second aspect, an embodiment of the present application provides an image background blurring apparatus, where the apparatus includes: an extracting module, configured to extract a reference image and m non-reference images in a target video according to an image extraction rule, and the target video is utilized. The video captured by the mobile terminal according to a predetermined trajectory, m is greater than or equal to 9;
构建模块,用于利用参考图像构建第一图像金字塔,利用m个非参考图像构建m个第二图像金字塔;a building module, configured to construct a first image pyramid by using a reference image, and construct m second image pyramids by using m non-reference images;
第一确定模块,用于利用第一图像金字塔和m个第二图像金字塔确定参考图像的场景深度图,参考图像的场景深度图表示参考图像中的任意像素点与移动终端之间的相对距离;a first determining module, configured to determine a scene depth map of the reference image by using the first image pyramid and the m second image pyramids, where the scene depth map of the reference image represents a relative distance between any pixel point in the reference image and the mobile terminal;
划分模块,用于利用场景深度图将参考图像的像素点划分到n个深度层,其中,不同深度层中的像素点对应的物体到移动终端的深度不同,其中n大于等于2;a dividing module, configured to divide a pixel point of the reference image into n depth layers by using a scene depth map, wherein a depth of the object corresponding to the pixel point in the different depth layer to the mobile terminal is different, where n is greater than or equal to 2;
第二确定模块,用于在参考图像中确定目标位置;a second determining module, configured to determine a target location in the reference image;
第三确定模块,用于从n个深度层中确定出目标位置对应的像素点所在的目标深度层;a third determining module, configured to determine, from the n depth layers, a target depth layer where the pixel corresponding to the target location is located;
模糊处理模块,用于将待处理像素点进行模糊处理,待处理像素点为n个深度层中除目标深度层以外的深度层中所包含的像素点。And a fuzzy processing module, configured to perform blur processing on the pixel to be processed, where the pixel to be processed is a pixel point included in a depth layer other than the target depth layer among the n depth layers.
在第二方面中,本申请实施例利用得到的场景深度图将参考图像的每个像素点划分到n个深度层,再利用确定出的参考图像的目标位置,在n个深度层中确定该目标位置的像素点所在的目标深度层,因此,本申请实施例可以将n个深度层中除目标深度层以外的深度层中所包含的待处理像素点进行模糊处理,以得到目标深度层的像素点清晰且待处理像素点模糊的图像。In the second aspect, the embodiment of the present application divides each pixel of the reference image into n depth layers by using the obtained scene depth map, and determines the target position in the n depth layers by using the determined target position of the reference image. The target depth layer in which the pixel of the target position is located. Therefore, in the embodiment of the present application, the pixel to be processed included in the depth layer other than the target depth layer in the n depth layers may be blurred to obtain the target depth layer. An image with clear pixels and blurred pixels to be processed.
在一种可能的实现方式中,第一确定模块,具体用于根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像确定参考图像的初步深度图,第一图像金字塔和m个第二图像金字塔均包括顶层图像和下层图像;根据初步深度图、第一图像金字塔的下层图像和m个第二图像金字塔的下层图像,确定参考图像的场景深度图。In a possible implementation, the first determining module is specifically configured to determine a preliminary depth map of the reference image according to the top image of the first image pyramid and the top image of the m second image pyramids, the first image pyramid and the m The second image pyramids each include a top layer image and a lower layer image; and determine a scene depth map of the reference image according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids.
其中,在第一图像金字塔和m个第二图像金字塔中对不同分辨率下的参考图像进行深 度采样,利用低分辨率的初步深度图推导出高分辨率的场景深度图,从而加快了深度恢复的速度,所以本申请实施例可以利用图像金字塔更加快速的生成参考图像的场景深度图。Wherein, the reference image at different resolutions is deeply sampled in the first image pyramid and the m second image pyramids, and the high-resolution scene depth map is derived by using the low-resolution preliminary depth map, thereby speeding up the depth recovery The speed of the reference image depth can be generated more quickly by the embodiment of the present application.
在一种可能的实现方式中,第一确定模块,具体用于根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像,计算第一匹配损失体;根据第一匹配损失体构建马尔科夫随机场模型进行全局匹配损失优化,得到参考图像的初步深度图。In a possible implementation, the first determining module is configured to calculate a first matching loss body according to the top image of the first image pyramid and the top image of the m second image pyramids; and construct the first matching loss body according to the first matching loss body The Markov random field model performs global matching loss optimization to obtain a preliminary depth map of the reference image.
其中,可以先根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像,计算第一匹配损失体;然后,再根据第一匹配损失体构建MRF模型进行全局匹配损失优化,从而可以得到细节平滑的参考图像的初步深度图。The first matching loss body may be first calculated according to the top image of the first image pyramid and the top image of the m second image pyramids; then, the MRF model is constructed according to the first matching loss body to perform global matching loss optimization, thereby A preliminary depth map of the reference image with a smooth detail.
在一种可能的实现方式中,第一确定模块,具体用于获取参考图像和m个非参考图像所在的视角下的移动终端的相机外参和相机内参;根据特征点提取规则确定参考图像中的特征点;获取参考图像的特征点的三维坐标;根据参考图像的特征点的三维坐标确定参考图像所在场景内的最小深度值和最大深度值;在最小深度值和最大深度值之间确定多个深度平面;利用相机内参、相机外参和直接线性变换算法,计算多个深度平面由参考图像所在的平面到m个非参考图像所在的平面映射的第一单应性矩阵;利用平面扫描算法和第一单应性矩阵,将第一图像金字塔的顶层图像的每个像素点以多个深度平面投影到m个第二图像金字塔的顶层图像所在的平面上,得到每个像素点投影后的参数值;根据第一图像金字塔的顶层图像的每个像素点的参数值和每个像素点投影后的参数值,确定每个像素点在深度值上的匹配损失;将第一图像金字塔的顶层图像的每个像素点在多个深度平面的匹配损失确定为第一匹配损失体。In a possible implementation manner, the first determining module is specifically configured to acquire a camera external parameter and a camera internal parameter of the mobile terminal at a viewing angle where the reference image and the m non-reference images are located; and determine the reference image according to the feature point extraction rule. a feature point; obtaining a three-dimensional coordinate of the feature point of the reference image; determining a minimum depth value and a maximum depth value in the scene in which the reference image is located according to the three-dimensional coordinate of the feature point of the reference image; determining between the minimum depth value and the maximum depth value a depth plane; using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm to calculate a first homography matrix of a plurality of depth planes from a plane in which the reference image is located to a plane mapping of m non-reference images; using a plane scanning algorithm And the first homography matrix, each pixel of the top image of the first image pyramid is projected in a plurality of depth planes onto a plane on which the top image of the m second image pyramids is located, to obtain a projection of each pixel point Parameter value; parameter value of each pixel point and projection of each pixel point according to the top image of the first image pyramid Parameter values, is determined for each pixel in the mismatching loss on the depth value; the top image of each pixel of the pyramid image of the first match loss is determined as a first member in a plurality of matching loss of depth plane.
其中,通过获得多个深度平面,再利用重投影计算匹配损失,这样在深度恢复时能更好的适应参考图像和m个非参考图像对应视角的相机位姿变化,提高深度恢复方法的可靠性。In addition, by obtaining multiple depth planes, the re-projection is used to calculate the matching loss, so that the depth of the camera can be better adapted to the camera pose changes of the reference image and the m non-reference images in the depth recovery, and the reliability of the depth recovery method is improved. .
在一种可能的实现方式中,第一确定模块,具体用于利用相机内参、相机外参和直接线性变换算法,计算最小深度值所在的第一深度平面由参考图像平面到m个非参考图像平面映射的第二单应性矩阵;利用相机内参、相机外参和直接线性变换算法,计算最大深度值所在的第二深度平面由参考图像平面到m个非参考图像平面映射的第三单应性矩阵;将参考图像中的一个像素点按照第二单应性矩阵投影到m个非参考图像所在的平面上,得到第一投影点;将参考图像中的一个像素点按照第三单应性矩阵投影到m个非参考图像所在的平面上,得到第二投影点;在第一投影点与第二投影点之间构成的直线上均匀取样得到多个采样点;将多个采样点反向投影到参考图像所在视角的三维空间中,得到与多个采样点的深度值对应的多个深度平面。In a possible implementation manner, the first determining module is specifically configured to calculate, by using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm, the first depth plane where the minimum depth value is located, from the reference image plane to the m non-reference images. The second homography matrix of the plane mapping; using the camera internal parameter, the camera external parameter and the direct linear transformation algorithm, the third homography of the second depth plane where the maximum depth value is located is mapped from the reference image plane to the m non-reference image planes. a matrix of pixels in the reference image is projected onto the plane of the m non-reference images according to the second homography matrix to obtain a first projection point; and one pixel point in the reference image is according to the third homography The matrix is projected onto a plane where m non-reference images are located to obtain a second projection point; uniformly sampling a line between the first projection point and the second projection point to obtain a plurality of sampling points; and reversing the plurality of sampling points Projecting into the three-dimensional space of the viewing angle of the reference image, a plurality of depth planes corresponding to the depth values of the plurality of sampling points are obtained.
其中,在计算参考图像的像素按照一个深度平面的匹配损失时,需要将该像素重投影到m个非参考图像平面上,在采集到多个深度平面重投影后,在m个非参考图像中的位置是等间距的,所以本申请实施例有助于后续步骤更高效地提取参考图像与m个非参考图像之间的像素匹配信息,进而提升了场景深度图的精度。Wherein, when calculating the matching loss of the pixel of the reference image according to a depth plane, the pixel needs to be re-projected onto the m non-reference image planes, and after the multiple depth planes are re-projected, in the m non-reference images. The positions of the present application are helpful for the subsequent steps to more efficiently extract the pixel matching information between the reference image and the m non-reference images, thereby improving the accuracy of the scene depth map.
在一种可能的实现方式中,第一确定模块,具体用于确定与第一图像金字塔的顶层图像的像素点对应的第一图像金字塔的下层图像的像素点;确定与m个第二图像金字塔的顶层图像的像素点对应的m个第二图像金字塔的下层图像的像素点;根据初步深度图确定第一图像金字塔的下层图像的像素点的估计深度值;根据估计深度值确定第一图像金字塔的 下层图像的像素点的最小深度值和最大深度值;在最小深度值和最大深度值之间确定第一图像金字塔的下层图像的多个深度平面;利用平面扫描算法和多个深度平面,计算第一图像金字塔的下层图像和m个第二图像金字塔的下层图像对应的第二匹配损失体;以第一图像金字塔的下层图像作为引导图像,利用引导滤波算法对第二匹配损失体进行局部优化得到第三匹配损失体;根据第三匹配损失体,为第一图像金字塔的下层图像的每个像素点选取第二匹配损失体中匹配损失最小的深度值,得到参考图像的场景深度图。In a possible implementation manner, the first determining module is specifically configured to determine a pixel point of the lower layer image of the first image pyramid corresponding to the pixel point of the top image of the first image pyramid; and determine the m second image pyramids a pixel of the lower image of the m second image pyramid corresponding to the pixel of the top image; determining an estimated depth value of the pixel of the lower image of the first image pyramid according to the preliminary depth map; determining the first image pyramid according to the estimated depth value a minimum depth value and a maximum depth value of a pixel of the lower layer image; determining a plurality of depth planes of the lower layer image of the first image pyramid between the minimum depth value and the maximum depth value; calculating using a plane scanning algorithm and a plurality of depth planes a second matching loss body corresponding to the lower layer image of the first image pyramid and the lower layer image of the m second image pyramids; the lower layer image of the first image pyramid is used as the guiding image, and the second matching loss body is locally optimized by using the guiding filtering algorithm Obtaining a third matching loss body; according to the third matching loss body, being the first image gold Each pixel of the lower layer image of the word tower selects a depth value with the smallest matching loss in the second matching loss body to obtain a scene depth map of the reference image.
其中,利用初步深度图估计第一图像金字塔的下层图像的像素点的最小深度值和最大深度值,进而确定一个比较小的深度搜索区间,从而降低了计算量并提高了深度恢复方法对图像噪声等干扰的鲁棒性。Wherein, the preliminary depth map is used to estimate the minimum depth value and the maximum depth value of the pixel points of the lower layer image of the first image pyramid, thereby determining a relatively small depth search interval, thereby reducing the calculation amount and improving the depth recovery method for image noise. The robustness of the interference.
在一种可能的实现方式中,第三确定模块,具体用于获取参考图像的目标位置的指定像素点;在场景深度图中确定与指定像素点对应的像素值;根据指定像素点对应的像素值在n个深度层中确定指定像素点所在的目标深度层。In a possible implementation manner, the third determining module is specifically configured to acquire a specified pixel point of the target position of the reference image; determine a pixel value corresponding to the specified pixel point in the scene depth map; and correspond to the pixel corresponding to the specified pixel point The value determines the target depth layer at which the specified pixel point is located in the n depth layers.
其中,移动终端在参考图像中确定目标位置以后,便可以直接过去到目标位置的指定像素点,然后,在场景深度图中确定与指定像素点对应的像素值,便可以得知该像素值对应的目标深度层,此时,便可以在n个深度层中确定出目标位置对应的像素点所在的目标深度层。After the mobile terminal determines the target location in the reference image, it can directly go to the specified pixel point of the target location, and then determine the pixel value corresponding to the specified pixel point in the scene depth map, and then the pixel value can be known to correspond to the pixel value. The target depth layer, in this case, the target depth layer where the pixel point corresponding to the target position is located can be determined in the n depth layers.
在一种可能的实现方式中,模糊处理模块,具体用于确定待处理像素点所在的L个深度层,L大于等于2且小于n;计算L个深度层与目标深度层的深度差;根据深度差将L个深度层中的每个深度层的像素点进行预设比例的模糊处理,L个深度层中的每个深度层的像素点的模糊程度与深度差成正比。In a possible implementation, the fuzzy processing module is specifically configured to determine L depth layers where the pixel to be processed is located, L is greater than or equal to 2 and less than n; and calculating a depth difference between the L depth layers and the target depth layer; The depth difference performs a predetermined ratio of blurring on the pixel points of each of the L depth layers, and the degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference.
其中,由于目标深度层和L个深度层都是可以得到的,所以便可以计算L个深度层与目标深度层的深度差,然后,移动终端便可根据深度差将L个深度层中的每个深度层的像素点进行预设比例的模糊处理。L个深度层中的每个深度层的像素点的模糊程度与深度差成正比,如果L个深度层中的深度层与目标深度层的深度差越大,那么该深度层中的像素点的模糊程度越大;如果L个深度层中的深度层与目标深度层的深度差越小,那么该深度层中的像素点的模糊程度越小,从而可以体现出参考图像中的不同距离的层次感。Wherein, since both the target depth layer and the L depth layers are available, the depth difference between the L depth layers and the target depth layer can be calculated, and then the mobile terminal can each of the L depth layers according to the depth difference. The pixel points of the depth layer are subjected to a preset ratio blurring process. The degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference, and if the depth difference between the depth layer and the target depth layer in the L depth layers is larger, then the pixel points in the depth layer The greater the degree of blurring; if the depth difference between the depth layer and the target depth layer in the L depth layers is smaller, the degree of blurring of the pixel points in the depth layer is smaller, thereby reflecting the level of different distances in the reference image sense.
第三方面,本申请实施例提供了一种图像背景虚化装置,该装置包括:处理器和存储器,其中,存储器内存储有处理器能够执行的操作指令,处理器读取存储器内的操作指令用于实现以下方法:按照图像提取规则在目标视频中提取一个参考图像和m个非参考图像,目标视频为利用移动终端按照预定轨迹拍摄的视频,m大于等于1;利用参考图像构建第一图像金字塔,利用m个非参考图像构建m个第二图像金字塔;利用第一图像金字塔和m个第二图像金字塔确定参考图像的场景深度图,参考图像的场景深度图表示参考图像中的任意像素点与移动终端之间的相对距离;利用场景深度图将参考图像的像素点划分到n个深度层,其中,不同深度层中的像素点对应的物体到移动终端的深度不同,其中n大于等于2;在参考图像中确定目标位置;从n个深度层中确定出目标位置对应的像素点所在的目标深度层;将待处理像素点进行模糊处理,待处理像素点为n个深度层中除目标深度层以外的深度层中所包含的像素点。In a third aspect, an embodiment of the present application provides an image background blurring apparatus, where the apparatus includes: a processor and a memory, wherein the memory stores an operation instruction executable by the processor, and the processor reads the operation instruction in the memory. For implementing the following method: extracting a reference image and m non-reference images in the target video according to an image extraction rule, the target video is a video captured by the mobile terminal according to a predetermined trajectory, m is greater than or equal to 1; constructing the first image by using the reference image Pyramid, constructing m second image pyramids using m non-reference images; determining a scene depth map of the reference image using the first image pyramid and the m second image pyramids, the scene depth map of the reference image representing any pixel point in the reference image The relative distance from the mobile terminal; the pixel depth of the reference image is divided into n depth layers by using the scene depth map, wherein the depth of the object corresponding to the pixel point in the different depth layer is different to the mobile terminal, where n is greater than or equal to 2 Determining the target position in the reference image; determining the target position from the n depth layers The target depth layer where the corresponding pixel is located; the pixel to be processed is blurred, and the pixel to be processed is a pixel included in the depth layer other than the target depth layer among the n depth layers.
在第三方面中,本申请实施例利用得到的场景深度图将参考图像的每个像素点划分到n个深度层,再利用确定出的参考图像的目标位置,在n个深度层中确定该目标位置的像 素点所在的目标深度层,因此,本申请实施例可以将n个深度层中除目标深度层以外的深度层中所包含的待处理像素点进行模糊处理,以得到目标深度层的像素点清晰且待处理像素点模糊的图像。In a third aspect, the embodiment of the present application divides each pixel of the reference image into n depth layers by using the obtained scene depth map, and determines the target position in the n depth layers by using the determined target position of the reference image. The target depth layer in which the pixel of the target position is located. Therefore, in the embodiment of the present application, the pixel to be processed included in the depth layer other than the target depth layer in the n depth layers may be blurred to obtain the target depth layer. An image with clear pixels and blurred pixels to be processed.
附图说明DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings to be used in the embodiments will be briefly described below. Obviously, the drawings in the following description are only some embodiments of the present application, Those skilled in the art can also obtain other drawings based on these drawings without paying any creative work.
图1所示的为本申请实施例提供的一种图像背景虚化方法的流程图;FIG. 1 is a flowchart of an image background blurring method provided by an embodiment of the present application;
图2所示的为本申请实施例提供的另一种图像背景虚化方法的流程图;FIG. 2 is a flowchart of another image background blurring method provided by an embodiment of the present application;
图3所示的为本申请实施例提供的又一种图像背景虚化方法的流程图;FIG. 3 is a flowchart of still another image background blurring method provided by an embodiment of the present application;
图4所示的为本申请实施例提供的又一种图像背景虚化方法的流程图;FIG. 4 is a flowchart of still another image background blurring method provided by an embodiment of the present application;
图5所示的为本申请实施例提供的又一种图像背景虚化方法的流程图;FIG. 5 is a flowchart of still another image background blurring method provided by an embodiment of the present application;
图6所示的为本申请实施例提供的又一种图像背景虚化方法的流程图;FIG. 6 is a flowchart of still another image background blurring method provided by an embodiment of the present application;
图7所示的为本申请实施例提供的一种图像背景虚化装置的示意图;FIG. 7 is a schematic diagram of an image background blurring apparatus provided by an embodiment of the present application;
图8所示的为本申请实施例提供的又一种图像背景虚化装置的示意图;FIG. 8 is a schematic diagram of still another image background blurring device provided by an embodiment of the present application;
图9所示的为本申请实施例提供的一种图像背景虚化装置的设计结构的示意图。FIG. 9 is a schematic diagram showing a design structure of an image background blurring device provided by an embodiment of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
图1所示的为本申请实施例提供的一种图像背景虚化方法的流程图。图1所示的图像背景虚化方法可以使移动终端拍摄出前景清晰且背景模糊的图像。该方法包括以下步骤。FIG. 1 is a flowchart of an image background blurring method provided by an embodiment of the present application. The image background blurring method shown in FIG. 1 can cause the mobile terminal to capture an image with a clear foreground and a blurred background. The method includes the following steps.
步骤S11、按照图像提取规则在目标视频中提取一个参考图像和m个非参考图像,目标视频为利用移动终端按照预定轨迹拍摄的视频,m大于等于1。Step S11: Extracting a reference image and m non-reference images in the target video according to an image extraction rule, where the target video is a video captured by the mobile terminal according to a predetermined trajectory, where m is greater than or equal to 1.
其中,本申请实施例提供的方法可以应用于移动终端内,移动终端可以为智能手机等设备。The method provided by the embodiment of the present application can be applied to a mobile terminal, and the mobile terminal can be a device such as a smart phone.
目标视频为利用移动终端按照预定轨迹拍摄的视频,预定轨迹可以被预先设定,预定轨迹为在同一个平面上的移动轨迹。例如,预定轨迹可以为在同一个平面上由左到右的移动轨迹,预定轨迹也可以为在同一个平面上由右到左的移动轨迹,预定轨迹还可以为在同一个平面上由上到下的移动轨迹,预定轨迹还可以为在同一个平面上由下到上的移动轨迹。当然,无论按照哪种预定轨迹拍摄视频,移动终端的摄像头均需要始终对准需要拍摄的位置。The target video is a video captured by the mobile terminal according to a predetermined trajectory, and the predetermined trajectory may be preset, and the predetermined trajectory is a moving trajectory on the same plane. For example, the predetermined trajectory may be a left-to-right moving trajectory on the same plane, and the predetermined trajectory may also be a right-to-left moving trajectory on the same plane, and the predetermined trajectory may also be up to the same plane. The lower moving track, the predetermined track may also be a moving track from bottom to top on the same plane. Of course, regardless of which predetermined trajectory is used to capture the video, the camera of the mobile terminal needs to always be aligned with the position that needs to be taken.
在利用移动终端拍摄目标视频时,用户需要拿着移动终端单方向、缓慢且平稳的移动,移动距离可以在20cm-30cm。用户在拿着移动终端移动的过程中,移动终端可以根据陀螺仪来判断移动的距离,并在目标视频中选择合适的参考图像和非参考图像。When the target video is captured by the mobile terminal, the user needs to move the mobile terminal in a single direction, slowly and smoothly, and the moving distance can be 20 cm-30 cm. During the movement of the user holding the mobile terminal, the mobile terminal can judge the moving distance according to the gyroscope and select an appropriate reference image and a non-reference image in the target video.
图像提取规则为预先设定好的规则,图像提取规则可以为根据目标视频的播放时长在目标视频中选择一个参考图像和m个非参考图像,m为大于等于1的正整数。例如,假设目标视频的长度为20秒,图像提取规则可以为在目标视频中选择1个参考图像和4个非参考图像,且将目标视频中第10秒的图像确定为参考图像,将第1秒、第3秒、第18秒和第20秒作为非参考图像。The image extraction rule is a preset rule, and the image extraction rule may be: selecting a reference image and m non-reference images in the target video according to the playing duration of the target video, where m is a positive integer greater than or equal to 1. For example, if the length of the target video is 20 seconds, the image extraction rule may be to select 1 reference image and 4 non-reference images in the target video, and determine the image of the 10th second in the target video as the reference image, which will be 1st. Seconds, 3rd, 18th, and 20th seconds are used as non-reference images.
当然,本申请实施例并不限制非参考图像的数量,例如,非参考图像的数量可以为3个,非参考图像的数量也可以为4个,非参考图像的数量可以为5个。Certainly, the embodiment of the present application does not limit the number of non-reference images. For example, the number of non-reference images may be three, the number of non-reference images may be four, and the number of non-reference images may be five.
参考图像和非参考图像均为在目标视频中从不同时刻提取出来的图像,而且参考图像与非参考图像的拍摄场景是相同的,但是,拍摄参考图像的视角与拍摄非参考图像的位置是不同的。例如,用户利用移动终端拍摄了一段10秒的目标视频,目标视频的拍摄场景是植物A和植物B,用于预先将图像提取规则设定为在目标视频中提取第5秒的图像作为参考图像,在目标视频中提取第1秒、第3秒、第8秒和第10秒的4个图像作为非参考图像,参考图像和非参考图像的拍摄场景都是植物A和植物B,但是,拍摄参考图像和非参考图像的位置是不同的。The reference image and the non-reference image are images extracted from different moments in the target video, and the reference image is the same as the shooting scene of the non-reference image, but the angle of view of the reference image is different from the position of the non-reference image. of. For example, the user captures a 10-second target video by using the mobile terminal, and the shooting scene of the target video is Plant A and Plant B, for setting the image extraction rule in advance to extract the image of the 5th second in the target video as a reference image. Four images of the 1st, 3rd, 8th, and 10th seconds are extracted as non-reference images in the target video, and the shooting scenes of the reference image and the non-reference image are both Plant A and Plant B, but, shooting The positions of the reference image and the non-reference image are different.
步骤S12、利用参考图像构建第一图像金字塔,利用m个非参考图像构建m个第二图像金字塔。Step S12, constructing a first image pyramid by using a reference image, and constructing m second image pyramids by using m non-reference images.
其中,移动终端在目标视频中提取参考图像和非参考图像以后,便可以利用一个参考图像构建一个第一图像金字塔,利用m个非参考图像构建m个第二图像金字塔。第一图像金字塔和第二图像金字塔中的“第一”和“第二”仅用于区别由不同图像构建的图像金字塔,第一图像金字塔仅代表由参考图像构建的图像金字塔,第二图像金字塔仅代表由非参考图像构建的图像金字塔。After the mobile terminal extracts the reference image and the non-reference image in the target video, a first image pyramid can be constructed by using one reference image, and m second image pyramids are constructed by using m non-reference images. The "first" and "second" in the first image pyramid and the second image pyramid are only used to distinguish image pyramids constructed from different images, the first image pyramid represents only the image pyramid constructed by the reference image, and the second image pyramid Represents only image pyramids constructed from non-reference images.
移动终端在利用参考图像构建第一图像金字塔的过程中,移动终端会以参考图像作为第一图像金字塔的底层图像。然后,将第一图像金字塔的底层图像的分辨率缩小至一半作为第一图像金字塔的底层图像的上一层图像,并不断的重复此步骤,不断的获得第一图像金字塔的上一层图像。最后,重复若干次便可得到一个具有不同分辨率的参考图像的第一图像金字塔。In the process of constructing the first image pyramid by using the reference image, the mobile terminal uses the reference image as the bottom image of the first image pyramid. Then, the resolution of the underlying image of the first image pyramid is reduced to half as the upper layer image of the underlying image of the first image pyramid, and this step is continuously repeated to continuously obtain the upper layer image of the first image pyramid. Finally, the first image pyramid with a reference image of different resolution can be obtained by repeating several times.
下面通过例子来简要介绍第一图像金字塔的构建过程。例如,预先将第一图像金字塔的层数限制为三层,且参考图像的分辨率为1000×1000,那么移动终端会以参考图像作为第一图像金字塔的第三层图像,那么第一图像金字塔的第三层图像的分辨率为1000×1000;然后,将第一图像金字塔的第三层图像的分辨率缩小至一半作为第一图像金字塔的第二层图像,那么第一图像金字塔的第二层图像的分辨率为500×500;最后,将第一图像金字塔的第二层图像的分辨率再缩小至一半作为第一图像金字塔的第三层图像,那么第一图像金字塔的第三层图像的分辨率为250×250。此时,第一图像金字塔包括三层图像,这三层图像为分辨率不同的参考图像,第一层图像是分辨率为250×250的参考图像,第二层图像是分辨率为500×500的参考图像,第三层图像是分辨率为1000×1000的参考图像。The following is an example to briefly introduce the construction process of the first image pyramid. For example, if the number of layers of the first image pyramid is limited to three layers in advance, and the resolution of the reference image is 1000×1000, then the mobile terminal uses the reference image as the third layer image of the first image pyramid, then the first image pyramid The resolution of the third layer image is 1000×1000; then, the resolution of the third layer image of the first image pyramid is reduced to half as the second layer image of the first image pyramid, then the second image pyramid is second The resolution of the layer image is 500×500; finally, the resolution of the second layer image of the first image pyramid is further reduced to half as the third layer image of the first image pyramid, then the third layer image of the first image pyramid The resolution is 250×250. At this time, the first image pyramid includes three layers of images, which are reference images with different resolutions, the first layer image is a reference image with a resolution of 250×250, and the second layer image has a resolution of 500×500. The reference image, the third layer image is a reference image with a resolution of 1000×1000.
当然,第二图像金字塔的构建过程与第一图像金字塔的构建过程相同,而且第二图像金字塔与第一图像金字塔的层数也是相同的,可以根据实际情况来限定第一图像金字塔和第二图像金字塔的层数。Of course, the construction process of the second image pyramid is the same as the construction process of the first image pyramid, and the number of layers of the second image pyramid and the first image pyramid is also the same, and the first image pyramid and the second image may be defined according to actual conditions. The number of layers in the pyramid.
步骤S13、利用第一图像金字塔和m个第二图像金字塔确定参考图像的场景深度图。Step S13: Determine a scene depth map of the reference image by using the first image pyramid and the m second image pyramids.
其中,在一个第一图像金字塔和m个第二图像金字塔被构建好以后,便可以利用第一图像金字塔和m个第二图像金字塔确定参考图像的场景深度图。Wherein, after a first image pyramid and m second image pyramids are constructed, the scene depth map of the reference image may be determined by using the first image pyramid and the m second image pyramids.
参考图像的场景深度图表示参考图像中的任意像素点与移动终端之间的相对距离,场景深度图中的像素点的像素值表示像素点所在的实际位置与移动终端的相对距离。为了更好的阐述场景深度图,下面通过例子简要说明。例如,假设参考图像的分辨率为100×100, 那么参考图像拥有的像素点为10000个,在利用第一图像金字塔和m个第二图像金字塔确定出参考图像的场景深度图以后,场景深度图中的10000个像素点的像素值表示10000个像素点所在的实际位置与移动终端的相对距离。The scene depth map of the reference image represents the relative distance between any pixel point in the reference image and the mobile terminal, and the pixel value of the pixel point in the scene depth map represents the relative distance between the actual location where the pixel point is located and the mobile terminal. In order to better illustrate the scene depth map, the following is a brief description of the example. For example, assuming that the resolution of the reference image is 100×100, the reference image has 10,000 pixels, and after determining the scene depth map of the reference image by using the first image pyramid and the m second image pyramids, the scene depth map The pixel value of 10000 pixels in the middle represents the relative distance between the actual position where 10000 pixels are located and the mobile terminal.
步骤S14、利用场景深度图将参考图像的像素点划分到n个深度层。Step S14, dividing the pixel points of the reference image into n depth layers by using the scene depth map.
其中,不同深度层中的像素点对应的物体到移动终端的深度不同,其中n大于等于2,每个深度层均具有一个深度范围,例如,某个深度层的深度范围可以为10米至20米。n个深度层组成参考图像的场景深度,场景深度为移动终端与参考图像中最远的像素点所在位置之间的距离,例如,场景深度可以为0米至30米。The depth of the object corresponding to the pixel in the different depth layer to the mobile terminal is different, where n is greater than or equal to 2, and each depth layer has a depth range. For example, the depth of a certain depth layer may range from 10 meters to 20 degrees. Meter. The n depth layers constitute the scene depth of the reference image, and the scene depth is the distance between the mobile terminal and the position of the farthest pixel point in the reference image. For example, the scene depth may be 0 to 30 meters.
移动终端可以获取到预先设定好的n和划分深度层的方式,从而可以得知深度层的数量以及每个深度层的深度范围。在得到参考图像的场景深度图以后,场景深度图中的像素点的像素值便可以确定。由于场景深度图中的像素点的像素值表示像素点所在的实际位置与移动终端的相对距离,所以移动终端可以按照场景深度图的像素点的像素值将参考图像的每个像素点划分到n个深度层中。The mobile terminal can acquire the preset n and the manner of dividing the depth layer, so that the number of depth layers and the depth range of each depth layer can be known. After the scene depth map of the reference image is obtained, the pixel values of the pixel points in the scene depth map can be determined. Since the pixel value of the pixel point in the scene depth map indicates the relative distance between the actual position where the pixel point is located and the mobile terminal, the mobile terminal may divide each pixel point of the reference image into n according to the pixel value of the pixel point of the scene depth map. In the depth layer.
例如,假设参考图像的分辨率为100×100,那么参考图像拥有的像素点为10000个,场景深度图中的10000个像素点的像素值表示10000个像素点所在的实际位置与移动终端的相对距离。假设参考图像的场景深度为0米至30米,移动终端按照预先设定好的规则将参考图像的场景深度平均的划分3个深度层,那么第一个深度层的深度范围为0米至10米,第二个深度层的深度范围为10米至20米,第三个深度层的深度范围为20米至30米。假设参考图像中的像素点A所在的实际位置与移动终端的相对距离为15米,那么像素点A就会被划分到第二个深度层;假设参考图像中的像素点B所在的实际位置与移动终端的相对距离为25米,那么像素点B就会被划分到第三个深度层;假设参考图像中的像素点C所在的实际位置与移动终端的相对距离为5米,那么像素点C就会被划分到第一个深度层。For example, if the resolution of the reference image is 100×100, then the reference image has 10,000 pixels, and the pixel value of 10000 pixels in the scene depth map indicates the actual position of 10000 pixels and the relative position of the mobile terminal. distance. Assuming that the depth of the reference image is 0 to 30 meters, the mobile terminal divides the depth of the reference image into three depth layers according to a preset rule, and the depth of the first depth layer ranges from 0 meters to 10 meters. The second depth layer has a depth ranging from 10 meters to 20 meters, and the third depth layer has a depth ranging from 20 meters to 30 meters. Assuming that the actual position of the pixel A in the reference image is 15 meters relative to the mobile terminal, then the pixel A is divided into the second depth layer; assuming that the actual position of the pixel B in the reference image is The relative distance of the mobile terminal is 25 meters, then the pixel point B is divided into the third depth layer; if the actual position of the pixel point C in the reference image is 5 meters relative to the mobile terminal, then the pixel point C It will be divided into the first depth layer.
步骤S15、在参考图像中确定目标位置。Step S15, determining a target position in the reference image.
其中,在参考图像中确定目标位置的方式有很多种,下面简要来介绍这几种方式。Among them, there are many ways to determine the target position in the reference image. The following briefly introduces these methods.
第一种方式,根据控制指令在参考图像中确定目标位置。其中,控制指令可以为用户利用手指在移动终端的触摸屏幕上输入的指令。例如,用户利用手指在移动终端的触摸屏幕上显示的参考图像中点击某一个位置,移动终端便将用户点击的位置确定为目标位置。In the first way, the target position is determined in the reference image according to the control command. Wherein, the control instruction may be an instruction input by the user on the touch screen of the mobile terminal by using a finger. For example, the user clicks a certain position in the reference image displayed on the touch screen of the mobile terminal by using the finger, and the mobile terminal determines the location clicked by the user as the target position.
第二种方式,将参看图像中的特定位置确定为目标位置。其中,参看图像中的特定位置为预先被指定的位置。例如,预先将参考图像的中心点确定为特定位置,那么移动终端便可以将参考图像的中心点确定为目标位置。又如,预先将参考图像中距离移动终端最近的位置确定为特定位置,那么移动终端便可以将参考图像中距离移动终端最近的位置确定为目标位置。In the second way, the specific position in the reference image is determined as the target position. Wherein, the specific position in the reference image is a previously specified position. For example, by determining the center point of the reference image as a specific position in advance, the mobile terminal can determine the center point of the reference image as the target position. For another example, the location closest to the mobile terminal in the reference image is determined as a specific location in advance, and then the mobile terminal can determine the location closest to the mobile terminal in the reference image as the target location.
第三种方式,识别参考图像中的人脸图像,将参考图像中的人脸图像所在的位置确定为目标位置。由于参考图像中的人脸图像不一定会在参考图像的哪个位置,所以移动终端需要先识别出参考图像中的人脸图像。在识别出参考图像中的人脸图像以后,便确定人脸图像所在的位置,再将人脸图像所在的位置确定为目标位置。In the third method, the face image in the reference image is identified, and the position of the face image in the reference image is determined as the target position. Since the face image in the reference image does not necessarily be in the position of the reference image, the mobile terminal needs to first recognize the face image in the reference image. After the face image in the reference image is recognized, the position where the face image is located is determined, and the position where the face image is located is determined as the target position.
当然,本申请实施例并不局限于以上几种方式,还可以采用其他的方式在参考图像中确定目标位置。Of course, the embodiments of the present application are not limited to the above manners, and other methods may be used to determine the target location in the reference image.
步骤S16、从n个深度层中确定出目标位置对应的像素点所在的目标深度层。Step S16: Determine, from the n depth layers, a target depth layer where the pixel point corresponding to the target position is located.
其中,由于从n个深度层中确定出目标位置对应的像素点所在的目标深度层的方式有很多种,下面简要介绍一种方式。Among them, since there are many ways to determine the target depth layer where the pixel points corresponding to the target position are located from the n depth layers, a mode will be briefly described below.
可选的,从n个深度层中确定出目标位置对应的像素点所在的目标深度层可以包括以下步骤:第一步,获取参考图像的目标位置的指定像素点;第二步,在场景深度图中确定与指定像素点对应的像素值;第三步,根据指定像素点对应的像素值在n个深度层中确定指定像素点所在的目标深度层。Optionally, determining, from the n depth layers, the target depth layer where the pixel corresponding to the target location is located may include the following steps: first, acquiring a specified pixel point of the target position of the reference image; and second step, at the scene depth The pixel value corresponding to the specified pixel point is determined in the figure; in the third step, the target depth layer where the specified pixel point is located is determined in the n depth layers according to the pixel value corresponding to the specified pixel point.
其中,移动终端在参考图像中确定目标位置以后,便可以直接过去到目标位置的指定像素点,然后,在场景深度图中确定与指定像素点对应的像素值,便可以得知该像素值对应的目标深度层,此时,便可以在n个深度层中确定出目标位置对应的像素点所在的目标深度层。After the mobile terminal determines the target location in the reference image, it can directly go to the specified pixel point of the target location, and then determine the pixel value corresponding to the specified pixel point in the scene depth map, and then the pixel value can be known to correspond to the pixel value. The target depth layer, in this case, the target depth layer where the pixel point corresponding to the target position is located can be determined in the n depth layers.
例如,假设参考图像的场景深度为0米至30米,移动终端按照预先设定好的规则将参考图像的场景深度平均的划分3个深度层,那么第一个深度层的深度范围为0米至10米,第二个深度层的深度范围为10米至20米,第三个深度层的深度范围为20米至30米。假设参考图像的目标位置的指定像素点为像素点A,在场景深度图中确定与像素点A对应的像素值为15米,那么便可以得知该像素值15米对应的目标深度层为第二个深度层,因为该像素值15米落入了第二个深度层的深度范围10米至20米中,所以像素点A所在的目标深度层为第二个深度层。For example, assuming that the depth of the reference image is 0 to 30 meters, the mobile terminal divides the depth of the reference image into three depth layers according to a preset rule, and the depth of the first depth layer is 0 meters. Up to 10 meters, the depth of the second depth layer ranges from 10 meters to 20 meters, and the depth of the third depth layer ranges from 20 meters to 30 meters. Assuming that the specified pixel point of the target position of the reference image is the pixel point A, and the pixel value corresponding to the pixel point A is determined to be 15 meters in the scene depth map, it can be known that the target depth layer corresponding to the pixel value of 15 meters is the first The two depth layers, because the pixel value of 15 meters falls within the depth range of the second depth layer by 10 meters to 20 meters, so the target depth layer where the pixel point A is located is the second depth layer.
目标深度层对应的像素点可能为一个物体的像素点,目标深度层对应的像素点也有可能为多个物体的像素点。例如,目标深度层对应的像素点构成的物体仅为一朵花。又如,目标深度层对应的像素点构成的物体包括一朵花和一棵树。再如,目标深度层对应的像素点构成的物体为一棵树的一部分。再如,目标深度层对应的像素点构成的物体包括一朵花的一部分和一棵树的一部分。The pixel corresponding to the target depth layer may be a pixel of one object, and the pixel corresponding to the target depth layer may also be a pixel of multiple objects. For example, the object formed by the pixel points corresponding to the target depth layer is only one flower. For another example, the object formed by the pixel corresponding to the target depth layer includes a flower and a tree. For another example, the object formed by the pixel corresponding to the target depth layer is a part of a tree. For another example, the object formed by the pixel corresponding to the target depth layer includes a part of a flower and a part of a tree.
步骤S17、将待处理像素点进行模糊处理。Step S17: Perform blur processing on the pixel to be processed.
其中,待处理像素点为n个深度层中除目标深度层以外的深度层中所包含的像素点。The pixel to be processed is a pixel point included in a depth layer other than the target depth layer among the n depth layers.
移动终端从n个深度层中确定出目标位置对应的像素点所在的目标深度层以后,便可以得知目标深度层中的像素点需要保持清晰,而n个深度层中除目标深度层以外的深度层中所包含的像素点均需要模糊处理,而待处理像素点即为需要模糊处理的像素点,所以将待处理像素点进行模糊处理。在对待处理像素点模糊处理以后,由于目标深度层所在的像素点均为清晰的,所以参考图像就变成了目标深度层的像素点清晰且待处理像素点模糊的图像。After the mobile terminal determines the target depth layer where the pixel corresponding to the target position is located from the n depth layers, it can be known that the pixel points in the target depth layer need to be kept clear, and the n depth layers except the target depth layer The pixels included in the depth layer need to be blurred, and the pixel to be processed is the pixel that needs to be blurred, so the pixel to be processed is blurred. After the pixel point blur processing is to be processed, since the pixel points where the target depth layer is located are clear, the reference image becomes an image in which the pixel points of the target depth layer are clear and the pixels to be processed are blurred.
将待处理像素点进行模糊处理的方式有很多种,例如,可以采用高斯模糊算法将待处理像素点进行模糊处理。当然,还可以采用其他模糊算法进行处理。There are many ways to blur the pixel to be processed. For example, the pixel to be processed can be blurred by a Gaussian blur algorithm. Of course, other fuzzy algorithms can also be used for processing.
例如,假设参考图像的场景深度为0米至30米,移动终端按照预先设定好的规则将参考图像的场景深度平均的划分3个深度层,那么第一个深度层的深度范围为0米至10米,第二个深度层的深度范围为10米至20米,第三个深度层的深度范围为20米至30米。假设参考图像的目标位置的指定像素点为像素点A,在场景深度图中确定与像素点A对应的像素值为15米,那么便可以得知该像素值15米对应的目标深度层为第二个深度层,所以需要模糊处理的为第一个深度层和第三个深度层包含的待处理像素点,第二个深度层中的像素点需要保持清晰。在将第一个深度层和第三个深度层包含的待处理像素点进行模糊 处理以后,所以参考图像就变成了第二个深度层的像素点清晰,且第一个深度层和第三个深度层的待处理像素点模糊的图像。For example, assuming that the depth of the reference image is 0 to 30 meters, the mobile terminal divides the depth of the reference image into three depth layers according to a preset rule, and the depth of the first depth layer is 0 meters. Up to 10 meters, the depth of the second depth layer ranges from 10 meters to 20 meters, and the depth of the third depth layer ranges from 20 meters to 30 meters. Assuming that the specified pixel point of the target position of the reference image is the pixel point A, and the pixel value corresponding to the pixel point A is determined to be 15 meters in the scene depth map, it can be known that the target depth layer corresponding to the pixel value of 15 meters is the first Two depth layers, so the pixels to be processed contained in the first depth layer and the third depth layer need to be blurred, and the pixels in the second depth layer need to be kept clear. After the pixels to be processed included in the first depth layer and the third depth layer are blurred, the reference image becomes the pixel of the second depth layer, and the first depth layer and the third layer An image of a depth layer of pixels to be processed that is blurred.
可选的,在步骤S17中,为了使待处理像素点模糊程度不同,从而体现出参考图像中的距离的层次感,可以采用以下方式来实现。所以步骤S17还可以包括以下步骤:第一步,确定待处理像素点所在的L个深度层,L大于等于2且小于n;第二步,计算L个深度层与目标深度层的深度差;第三步,根据深度差将L个深度层中的每个深度层的像素点进行预设比例的模糊处理,L个深度层中的每个深度层的像素点的模糊程度与深度差成正比。Optionally, in step S17, in order to make the pixels to be processed have different degrees of blurring, thereby embodying the layering of the distance in the reference image, the following manner may be implemented. Therefore, the step S17 may further include the following steps: first, determining L depth layers where the pixel to be processed is located, L is greater than or equal to 2 and less than n; and in the second step, calculating a depth difference between the L depth layers and the target depth layer; In the third step, the pixel points of each of the L depth layers are subjected to a predetermined ratio of blur processing according to the depth difference, and the degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference .
其中,由于待处理像素点会分布在不同的深度层中,所以需要确定待处理像素点所在的L个深度层,然后再计算L个深度层与目标深度层的深度差。Wherein, since the pixels to be processed are distributed in different depth layers, it is necessary to determine the L depth layers where the pixel points to be processed are located, and then calculate the depth difference between the L depth layers and the target depth layer.
深度差为两个深度层之间的距离,例如,第一个深度层的深度范围是0米至10米,第二个深度层的深度范围是10米至20米,第三个深度层的深度范围是20米至30米,那么第一个深度层与第二个深度层的深度差之10米,第一个深度层与第三个深度层的深度差为20米。The depth difference is the distance between two depth layers, for example, the depth of the first depth layer ranges from 0 meters to 10 meters, and the depth of the second depth layer ranges from 10 meters to 20 meters, and the third depth layer The depth range is 20 meters to 30 meters, then the depth difference between the first depth layer and the second depth layer is 10 meters, and the depth difference between the first depth layer and the third depth layer is 20 meters.
在得到L个深度层与目标深度层的深度差以后,便可以根据深度差将L个深度层中的每个深度层的像素点进行预设比例的模糊处理。例如,假设第一个深度层为目标深度层,第二个深度层和第三个深度层为待处理像素点所在的2个深度层,且第一个深度层与第二个深度层的深度差为10米,第一个深度层与第三个深度层的深度差为20米,那么将第二个深度层的像素点按照25%的比例进行模糊处理,将第三个深度层的像素点按照50%的比例进行模糊处理。After obtaining the depth difference between the L depth layers and the target depth layer, the pixel points of each of the L depth layers may be subjected to a predetermined ratio of blur processing according to the depth difference. For example, suppose the first depth layer is the target depth layer, the second depth layer and the third depth layer are the two depth layers where the pixel to be processed is located, and the depth of the first depth layer and the second depth layer The difference is 10 meters, and the difference between the depth of the first depth layer and the third depth layer is 20 meters, then the pixel of the second depth layer is blurred by 25%, and the pixel of the third depth layer is used. The point is blurred by 50%.
由于目标深度层和L个深度层都是可以得到的,所以便可以计算L个深度层与目标深度层的深度差,然后,移动终端便可根据深度差将L个深度层中的每个深度层的像素点进行预设比例的模糊处理。L个深度层中的每个深度层的像素点的模糊程度与深度差成正比,如果L个深度层中的深度层与目标深度层的深度差越大,那么该深度层中的像素点的模糊程度越大;如果L个深度层中的深度层与目标深度层的深度差越小,那么该深度层中的像素点的模糊程度越小,从而可以体现出参考图像中的不同距离的层次感。Since both the target depth layer and the L depth layers are available, the depth difference between the L depth layers and the target depth layer can be calculated, and then the mobile terminal can each depth in the L depth layers according to the depth difference. The pixels of the layer are subjected to a preset ratio of blurring. The degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference, and if the depth difference between the depth layer and the target depth layer in the L depth layers is larger, then the pixel points in the depth layer The greater the degree of blurring; if the depth difference between the depth layer and the target depth layer in the L depth layers is smaller, the degree of blurring of the pixel points in the depth layer is smaller, thereby reflecting the level of different distances in the reference image sense.
在图1所示的实施例中,本申请实施例利用得到的场景深度图将参考图像的每个像素点划分到n个深度层,再利用确定出的参考图像的目标位置,在n个深度层中确定该目标位置的像素点所在的目标深度层,所以本申请实施例可以n个深度层中除目标深度层以外的深度层中所包含的待处理像素点进行模糊处理,以得到目标深度层的像素点清晰且待处理像素点模糊的图像。因此,本申请实施例可以使移动终端拍摄出前景清晰且背景模糊的图像。In the embodiment shown in FIG. 1 , the embodiment of the present application divides each pixel of the reference image into n depth layers by using the obtained scene depth map, and then uses the determined target image position of the reference image at n depths. In the layer, the target depth layer in which the pixel of the target location is located is determined. Therefore, in the embodiment of the present application, the pixel to be processed included in the depth layer other than the target depth layer in the n depth layers may be subjected to blur processing to obtain the target depth. An image in which the pixels of the layer are clear and the pixels to be processed are blurred. Therefore, the embodiment of the present application can cause the mobile terminal to capture an image with a clear foreground and a blurred background.
请参见图2所示,图2所示的为本申请实施例提供的另一种图像背景虚化方法的流程图。图2所示的实施例为基于图1中步骤S12细化的实施例,所以与图1相同的内容可参见图1所示的实施例。图2所示方法包括以下步骤。Referring to FIG. 2, FIG. 2 is a flowchart of another image background blurring method provided by an embodiment of the present application. The embodiment shown in FIG. 2 is an embodiment based on the refinement of step S12 in FIG. 1, so that the same contents as in FIG. 1 can be referred to the embodiment shown in FIG. 1. The method shown in Figure 2 includes the following steps.
步骤S21、根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像确定参考图像的初步深度图,第一图像金字塔和m个第二图像金字塔均包括顶层图像和下层图像。Step S21: Determine a preliminary depth map of the reference image according to the top image of the first image pyramid and the top image of the m second image pyramids, the first image pyramid and the m second image pyramids each including a top image and a lower layer image.
本申请实施例中,将第一图像金字塔的第一层图像称为顶层图像,将第一图像金字塔的第二层图像至最后一层图像统称称为下层图像,将第一图像金字塔的最后一层图像称为底层图像。将第二图像金字塔的第一层图像称为顶层图像,将第二图像金字塔的第二层图 像至最后一层图像统称称为下层图像,将第二图像金字塔的最后一层图像称为底层图像。In the embodiment of the present application, the first layer image of the first image pyramid is referred to as a top layer image, and the second layer image to the last layer image of the first image pyramid is collectively referred to as a lower layer image, and the last image of the first image pyramid is The layer image is called the underlying image. The first layer image of the second image pyramid is referred to as the top layer image, the second layer image of the second image pyramid is collectively referred to as the lower layer image, and the last layer image of the second image pyramid is referred to as the bottom layer image. .
由于根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像确定参考图像的初步深度图的方式有很多,下面会介绍一种实现方式,在此先不做赘述。Since there are many ways to determine the preliminary depth map of the reference image according to the top image of the first image pyramid and the top image of the m second image pyramids, an implementation manner will be described below, and will not be described herein.
步骤S22、根据初步深度图、第一图像金字塔的下层图像和m个第二图像金字塔的下层图像,确定参考图像的场景深度图。Step S22: Determine a scene depth map of the reference image according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids.
其中,由于根据初步深度图、第一图像金字塔的下层图像和m个第二图像金字塔的下层图像的方式有很多,下面会介绍一种实现方式,在此先不做赘述。Wherein, since there are many ways according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids, an implementation manner will be described below, and will not be described herein.
在图2所示的实施例中,在第一图像金字塔和m个第二图像金字塔中对不同分辨率下的参考图像进行深度采样,利用低分辨率的初步深度图推导出高分辨率的场景深度图,从而加快了深度恢复的速度,所以本申请实施例可以利用图像金字塔更加快速的生成参考图像的场景深度图。In the embodiment shown in FIG. 2, the reference images at different resolutions are depth-sampled in the first image pyramid and the m second image pyramids, and the high-resolution scene is derived using the low-resolution preliminary depth map. The depth map, thereby speeding up the depth recovery, so the embodiment of the present application can use the image pyramid to generate the scene depth map of the reference image more quickly.
请参见图3所示,图3所示的为本申请实施例提供的又一种图像背景虚化方法的流程图。图3所示的实施例为基于图2中步骤S21的细化的实施例,所以与图2相同的内容可参见图2所示的实施例。图3所示方法包括以下步骤。Referring to FIG. 3, FIG. 3 is a flowchart of still another image background blurring method provided by an embodiment of the present application. The embodiment shown in FIG. 3 is based on the refined embodiment of step S21 in FIG. 2, so the same content as FIG. 2 can be seen in the embodiment shown in FIG. 2. The method shown in Figure 3 includes the following steps.
步骤S31、根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像,计算第一匹配损失体。Step S31: Calculate a first matching loss body according to the top image of the first image pyramid and the top image of the m second image pyramids.
其中,计算第一匹配损失体的具体细节会在后续的步骤中详细描述,在此不再赘述。The specific details of calculating the first matching loss body are described in detail in the subsequent steps, and are not described herein again.
步骤S32、根据第一匹配损失体构建MRF(Markov Random Field,马尔科夫随机场)模型进行全局匹配损失优化,得到参考图像的初步深度图。Step S32, constructing a MRF (Markov Random Field) model according to the first matching loss body to perform global matching loss optimization, and obtain a preliminary depth map of the reference image.
其中,由于得到参考图像的初步深度图的细节不够平滑且不够精细,所以还需要后续步骤对参考图像的初步深度图进行平滑处理。Wherein, since the detail of the preliminary depth map of the reference image is not smooth enough and is not fine enough, a subsequent step is needed to smooth the preliminary depth map of the reference image.
在图3所示的实施例中,给出了一种具体生成参考图像的初步深度图的方式,当然,还可以采用其他手段来生成参考图像的初步深度图,在此不作赘述。通过图3所示的实施例,可以先根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像,计算第一匹配损失体;然后,再根据第一匹配损失体构建MRF模型进行全局匹配损失优化,从而可以得到细节平滑的参考图像的初步深度图。In the embodiment shown in FIG. 3, a manner of specifically generating a preliminary depth map of the reference image is given. Of course, other means may be used to generate a preliminary depth map of the reference image, which is not described herein. According to the embodiment shown in FIG. 3, the first matching loss body may be first calculated according to the top image of the first image pyramid and the top image of the m second image pyramids; and then the MRF model is constructed according to the first matching loss body. The global matching loss is optimized so that a preliminary depth map of the reference image with a smooth detail can be obtained.
请参见图4所示,图4所示的为本申请实施例提供的又一种图像背景虚化方法的流程图。图4所示的实施例为基于图3中步骤S31的细化的实施例,所以与图3相同的内容可参见图3所示的实施例。图4所示方法包括以下步骤。Referring to FIG. 4, FIG. 4 is a flowchart of still another image background blurring method provided by an embodiment of the present application. The embodiment shown in FIG. 4 is based on the refined embodiment of step S31 in FIG. 3, so the same content as FIG. 3 can be seen in the embodiment shown in FIG. The method shown in Figure 4 includes the following steps.
步骤S41、获取参考图像和m个非参考图像所在的视角下的移动终端的相机外参和相机内参。Step S41: Acquire a camera external parameter and a camera internal parameter of the mobile terminal in the perspective of the reference image and the m non-reference images.
其中,其中,移动终端可以参考图像和非参考图像的特征点的坐标、特征点的对应关系和SFM(Structure from Motion,从运动信息中恢复场景三维结构)算法,计算参考图像和非参考图像所在视角下对应的移动终端的相机外参,移动终端的相机外参包括相机光学中心坐标和相机光轴朝向。相机内参为预先通过相机标定得到。例如,移动终端可以通过棋盘格特征利用相机定标工具箱确定相机内参。Wherein, the mobile terminal can refer to the coordinates of the feature points of the image and the non-reference image, the correspondence relationship of the feature points, and the SFM (Structure from Motion) algorithm to calculate the reference image and the non-reference image. The camera external reference of the corresponding mobile terminal in the perspective, the camera external reference of the mobile terminal includes the camera optical center coordinates and the camera optical axis orientation. The camera internal parameters are obtained by pre-calibrating the camera. For example, the mobile terminal can determine the camera internal reference using the camera calibration toolbox through the checkerboard feature.
步骤S42、根据特征点提取规则确定参考图像中的特征点。Step S42: Determine feature points in the reference image according to the feature point extraction rule.
步骤S43、获取参考图像的特征点的三维坐标。Step S43: Obtain three-dimensional coordinates of feature points of the reference image.
其中,移动终端可以对目标视频利用KLT(Kanade Lucas Tomasi Feature Tracker, 特征点跟踪的光流法)算法进行特征点跟踪,以获取得到参考图像的若干个特征点和若干个特征点的三维坐标。The mobile terminal can perform feature point tracking on the target video by using KLT (Kanade Lucas Tomasi Feature Tracker) algorithm to obtain three-dimensional coordinates of several feature points and several feature points of the reference image.
步骤S44、根据参考图像的特征点的三维坐标确定参考图像所在场景内的最小深度值和最大深度值。Step S44: Determine a minimum depth value and a maximum depth value in the scene where the reference image is located according to the three-dimensional coordinates of the feature points of the reference image.
其中,可以先根据该三维坐标确定出参考图像中特征点的最小深度值和最大深度值;然后,再对特征点的最小深度值和最大深度值构成的深度范围扩大预设值,以得到参考图像所在场景内的最小深度值和最大深度值。预设值可以为预先确定的经验值。The minimum depth value and the maximum depth value of the feature points in the reference image may be first determined according to the three-dimensional coordinates; then, the depth range formed by the minimum depth value and the maximum depth value of the feature point is expanded by a preset value to obtain a reference. The minimum depth value and maximum depth value within the scene in which the image is located. The preset value can be a predetermined empirical value.
步骤S45、在最小深度值和最大深度值之间采集多个深度平面。Step S45: Collect a plurality of depth planes between the minimum depth value and the maximum depth value.
其中,可以预先设定好需要采集的深度平面的数量,以及采集深度平面的方式。例如,在最小深度值和最大深度值之间均匀的采集11个深度平面。The number of depth planes to be collected and the manner in which the depth planes are collected may be preset. For example, 11 depth planes are uniformly collected between the minimum depth value and the maximum depth value.
步骤S46、利用相机内参、相机外参和直接线性变换算法,计算多个深度平面由参考图像所在的平面到m个非参考图像所在的平面映射的第一单应性矩阵。Step S46: Calculate, by using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm, a first homography matrix of a plurality of depth planes from a plane where the reference image is located to a plane where the m non-reference images are located.
其中,第一单应性矩阵的数量与计算的情况有关,所以此处会得到多个第一单应性矩阵。Among them, the number of the first homography matrix is related to the calculation, so a plurality of first homography matrices are obtained here.
步骤S47、利用Ps(Plane sweep,平面扫描)算法和第一单应性矩阵,将第一图像金字塔的顶层图像的每个像素点以多个深度平面投影到m个第二图像金字塔的顶层图像所在的平面上,得到每个像素点投影后的参数值。Step S47, using a Ps (Plane sweep) algorithm and a first homography matrix, projecting each pixel of the top image of the first image pyramid to a top image of the m second image pyramids by using multiple depth planes. On the plane where you are, get the parameter values after each pixel point is projected.
其中,参数值可以为每个像素点的颜色与纹理。Among them, the parameter value can be the color and texture of each pixel.
步骤S48、根据第一图像金字塔的顶层图像的每个像素点的参数值和每个像素点投影后的参数值,确定每个像素点在深度值上的匹配损失。Step S48: Determine a matching loss of each pixel point on the depth value according to a parameter value of each pixel point of the top image of the first image pyramid and a parameter value after each pixel point projection.
其中,匹配损失可以被定义为重投影前后参数值的绝对差,参数值可以为像素颜色梯度。The matching loss can be defined as the absolute difference of the parameter values before and after the re-projection, and the parameter value can be a pixel color gradient.
步骤S49、将第一图像金字塔的顶层图像的每个像素点在多个深度平面的匹配损失确定为第一匹配损失体。Step S49, determining a matching loss of each pixel point of the top image of the first image pyramid in the plurality of depth planes as the first matching loss body.
在图4所示的实施例中,给出了一种具体生成第一匹配损失体的方式,当然,还可以采用其他手段来生成参考图像的初步深度图,在此不作赘述。本实施例没有采用传统方法在计算匹配损失之前先对图像进行校正,而是获得多个深度平面,再利用重投影计算匹配损失,这样在深度恢复时能更好的适应参考图像和m个非参考图像对应视角的相机位姿变化,提高深度恢复方法的可靠性。In the embodiment shown in FIG. 4, a specific manner of generating the first matching loss body is given. Of course, other means may be used to generate the preliminary depth map of the reference image, which is not described herein. In this embodiment, the conventional method is not used to correct the image before calculating the matching loss, but multiple depth planes are obtained, and the matching loss is calculated by using the re-projection, so that the reference image and m non-can be better adapted in the depth recovery. The reference image changes the camera pose corresponding to the angle of view, improving the reliability of the depth recovery method.
请参见图5所示,图5所示的为本申请实施例提供的又一种图像背景虚化方法的流程图。图5所示的实施例为基于图4中步骤S45的细化的实施例,所以与图4相同的内容可参见图4所示的实施例。图5所示方法包括以下步骤。Referring to FIG. 5, FIG. 5 is a flowchart of still another image background blurring method provided by an embodiment of the present application. The embodiment shown in FIG. 5 is based on the refined embodiment of step S45 in FIG. 4, so the same content as FIG. 4 can be seen in the embodiment shown in FIG. The method shown in Figure 5 includes the following steps.
步骤S51、利用相机内参、相机外参和DLT(Direct Linear Transform,直接线性变换)算法,计算最小深度值所在的第一深度平面由参考图像平面到m个非参考图像平面映射的第二单应性矩阵。Step S51, using a camera internal parameter, a camera external parameter, and a DLT (Direct Linear Transform) algorithm to calculate a second homography of the first depth plane where the minimum depth value is mapped from the reference image plane to the m non-reference image planes. Sexual matrix.
步骤S52、利用相机内参、相机外参和直接线性变换算法,计算最大深度值所在的第二深度平面由参考图像平面到m个非参考图像平面映射的第三单应性矩阵。Step S52: Calculate, by using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm, a third homography matrix of the second depth plane where the maximum depth value is located, from the reference image plane to the m non-reference image planes.
其中,第二单应性矩阵的数量与计算的情况有关,所以此处会得到多个第二单应性矩阵。Among them, the number of the second homography matrix is related to the calculation, so a plurality of second homography matrices are obtained here.
步骤S53、将参考图像中的一个像素点按照第二单应性矩阵投影到m个非参考图像所在的平面上,得到第一投影点。Step S53: Projecting a pixel point in the reference image onto the plane where the m non-reference images are located according to the second homography matrix, to obtain a first projection point.
步骤S54、将参考图像中的一个像素点按照第三单应性矩阵投影到m个非参考图像所在的平面上,得到第二投影点。Step S54: Projecting one pixel point in the reference image onto the plane where the m non-reference images are located according to the third homography matrix, to obtain a second projection point.
步骤S55、在第一投影点与第二投影点之间构成的直线上均匀取样得到多个采样点。Step S55: uniformly sampling a line formed between the first projection point and the second projection point to obtain a plurality of sampling points.
步骤S56、将多个采样点反向投影到参考图像所在视角的三维空间中,得到与多个采样点的深度值对应的多个深度平面。Step S56: Backprojecting a plurality of sampling points into a three-dimensional space of a viewing angle of the reference image to obtain a plurality of depth planes corresponding to depth values of the plurality of sampling points.
在图5所示的实施例中,在计算参考图像的像素按照一个深度平面的匹配损失时,需要将该像素重投影到m个非参考图像平面上,在采集到多个深度平面重投影后,在m个非参考图像中的位置是等间距的,所以本申请实施例有助于后续步骤更高效地提取参考图像与m个非参考图像之间的像素匹配信息,进而提升了场景深度图的精度。In the embodiment shown in FIG. 5, when calculating the matching loss of the pixels of the reference image according to a depth plane, the pixel needs to be re-projected onto the m non-reference image planes, after the multiple depth planes are re-projected. The positions in the m non-reference images are equally spaced, so the embodiment of the present application helps the subsequent steps to extract the pixel matching information between the reference image and the m non-reference images more efficiently, thereby improving the depth map of the scene. Precision.
请参见图6所示,图6所示的为本申请实施例提供的又一种图像背景虚化方法的流程图。图6所示的实施例为基于图2中步骤S22的细化的实施例,所以与图2相同的内容可参见图2所示的实施例。图6所示方法包括以下步骤。Referring to FIG. 6, FIG. 6 is a flowchart of still another image background blurring method provided by an embodiment of the present application. The embodiment shown in FIG. 6 is based on the refined embodiment of step S22 in FIG. 2, so the same content as FIG. 2 can be seen in the embodiment shown in FIG. 2. The method shown in Figure 6 includes the following steps.
步骤S61、确定与第一图像金字塔的顶层图像的像素点对应的第一图像金字塔的下层图像的像素点。Step S61: Determine pixel points of the lower layer image of the first image pyramid corresponding to the pixel points of the top image of the first image pyramid.
步骤S62、确定与m个第二图像金字塔的顶层图像的像素点对应的m个第二图像金字塔的下层图像的像素点。Step S62: Determine pixel points of the lower layer images of the m second image pyramids corresponding to the pixel points of the top image of the m second image pyramids.
步骤S63、根据初步深度图确定第一图像金字塔的下层图像的像素点的估计深度值。Step S63: Determine an estimated depth value of a pixel point of the lower layer image of the first image pyramid according to the preliminary depth map.
步骤S64、根据估计深度值确定第一图像金字塔的下层图像的像素点的最小深度值和最大深度值。Step S64: Determine a minimum depth value and a maximum depth value of the pixel points of the lower layer image of the first image pyramid according to the estimated depth value.
步骤S65、在最小深度值和最大深度值之间确定第一图像金字塔的下层图像的多个深度平面。Step S65: Determine a plurality of depth planes of the lower layer image of the first image pyramid between the minimum depth value and the maximum depth value.
其中,关于如何在最小深度值和最大深度值之间确定第一图像金字塔的下层图像的多个深度平面的具体实现方式,可以参见图4所示的实施例即可,在此不再赘述。For a specific implementation manner of how to determine a plurality of depth planes of the lower layer image of the first image pyramid between the minimum depth value and the maximum depth value, reference may be made to the embodiment shown in FIG. 4, and details are not described herein again.
步骤S66、利用平面扫描算法和多个深度平面,计算第一图像金字塔的下层图像和m个第二图像金字塔的下层图像对应的第二匹配损失体。Step S66: Calculate a second matching loss body corresponding to the lower layer image of the first image pyramid and the lower layer image of the m second image pyramids by using the plane scanning algorithm and the plurality of depth planes.
步骤S67、以第一图像金字塔的下层图像作为引导图像,利用引导滤波算法对第二匹配损失体进行局部优化得到第三匹配损失体。Step S67: Using the lower layer image of the first image pyramid as the guide image, locally optimizing the second matching loss body by using a bootstrap filtering algorithm to obtain a third matching loss body.
步骤S68、根据第三匹配损失体,为第一图像金字塔的下层图像的每个像素点选取第二匹配损失体中匹配损失最小的深度值,得到参考图像的场景深度图。Step S68: Select a depth value with a minimum matching loss in the second matching loss body for each pixel of the lower layer image of the first image pyramid according to the third matching loss body, to obtain a scene depth map of the reference image.
在图6所示的实施例中,利用初步深度图估计第一图像金字塔的下层图像的像素点的最小深度值和最大深度值,进而确定一个比较小的深度搜索区间,从而降低了计算量并提高了深度恢复方法对图像噪声等干扰的鲁棒性。In the embodiment shown in FIG. 6, the preliminary depth map is used to estimate the minimum depth value and the maximum depth value of the pixel points of the lower layer image of the first image pyramid, thereby determining a relatively small depth search interval, thereby reducing the amount of calculation and The robustness of the depth recovery method to interference such as image noise is improved.
图7所示的为本申请实施例提供的一种图像背景虚化装置的示意图。图7为图1对应的装置实施例,图7中与图1相同的内容请参见图1对应的实施例即可。参照图7,该终端设备包括以下模块:FIG. 7 is a schematic diagram of an image background blurring apparatus provided by an embodiment of the present application. FIG. 7 is an embodiment of the apparatus corresponding to FIG. 1. For the same content as that of FIG. 1 in FIG. 7, please refer to the corresponding embodiment of FIG. Referring to FIG. 7, the terminal device includes the following modules:
提取模块11,用于按照图像提取规则在目标视频中提取一个参考图像和m个非参考图像,目标视频为利用移动终端按照预定轨迹拍摄的视频,m大于等于9;The extraction module 11 is configured to extract a reference image and m non-reference images in the target video according to an image extraction rule, where the target video is a video captured by the mobile terminal according to a predetermined trajectory, m is greater than or equal to 9;
构建模块12,用于利用参考图像构建第一图像金字塔,利用m个非参考图像构建m个第二图像金字塔;a building module 12, configured to construct a first image pyramid by using a reference image, and construct m second image pyramids by using m non-reference images;
第一确定模块13,用于利用第一图像金字塔和m个第二图像金字塔确定参考图像的场景深度图,参考图像的场景深度图表示参考图像中的任意像素点与移动终端之间的相对距离;a first determining module 13 configured to determine a scene depth map of the reference image by using the first image pyramid and the m second image pyramids, where the scene depth map of the reference image represents a relative distance between any pixel point and the mobile terminal in the reference image ;
划分模块14,用于利用场景深度图将参考图像的像素点划分到n个深度层,其中,不同深度层中的像素点对应的物体到移动终端的深度不同,其中n大于等于2;The dividing module 14 is configured to divide the pixel points of the reference image into the n depth layers by using the scene depth map, wherein the objects corresponding to the pixel points in the different depth layers are different in depth to the mobile terminal, where n is greater than or equal to 2;
第二确定模块15,用于在参考图像中确定目标位置;a second determining module 15 configured to determine a target location in the reference image;
第三确定模块16,用于从n个深度层中确定出目标位置对应的像素点所在的目标深度层;The third determining module 16 is configured to determine, from the n depth layers, a target depth layer where the pixel point corresponding to the target location is located;
模糊处理模块17,用于将待处理像素点进行模糊处理,待处理像素点为n个深度层中除目标深度层以外的深度层中所包含的像素点。The fuzzy processing module 17 is configured to perform blur processing on the pixel to be processed, where the pixel to be processed is a pixel point included in a depth layer other than the target depth layer among the n depth layers.
可选的,第一确定模块13,具体用于根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像确定参考图像的初步深度图,第一图像金字塔和m个第二图像金字塔均包括顶层图像和下层图像;根据初步深度图、第一图像金字塔的下层图像和m个第二图像金字塔的下层图像,确定参考图像的场景深度图。Optionally, the first determining module 13 is configured to determine, according to the top image of the first image pyramid and the top image of the m second image pyramids, a preliminary depth map of the reference image, the first image pyramid and the m second image pyramids. Each includes a top layer image and a bottom layer image; and a scene depth map of the reference image is determined according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids.
可选的,第一确定模块13,具体用于根据第一图像金字塔的顶层图像和m个第二图像金字塔的顶层图像,计算第一匹配损失体;根据第一匹配损失体构建马尔科夫随机场模型进行全局匹配损失优化,得到参考图像的初步深度图。Optionally, the first determining module 13 is configured to calculate a first matching loss body according to the top image of the first image pyramid and the top image of the m second image pyramids; and construct a Markov according to the first matching loss body The airport model performs global matching loss optimization to obtain a preliminary depth map of the reference image.
可选的,第一确定模块13,具体用于获取参考图像和m个非参考图像所在的视角下的移动终端的相机外参和相机内参;根据特征点提取规则确定参考图像中的特征点;获取参考图像的特征点的三维坐标;根据参考图像的特征点的三维坐标确定参考图像所在场景内的最小深度值和最大深度值;在最小深度值和最大深度值之间确定多个深度平面;利用相机内参、相机外参和直接线性变换算法,计算多个深度平面由参考图像所在的平面到m个非参考图像所在的平面映射的第一单应性矩阵;利用平面扫描算法和第一单应性矩阵,将第一图像金字塔的顶层图像的每个像素点以多个深度平面投影到m个第二图像金字塔的顶层图像所在的平面上,得到每个像素点投影后的参数值;根据第一图像金字塔的顶层图像的每个像素点的参数值和每个像素点投影后的参数值,确定每个像素点在深度值上的匹配损失;将第一图像金字塔的顶层图像的每个像素点在多个深度平面的匹配损失确定为第一匹配损失体。Optionally, the first determining module 13 is configured to acquire a camera external parameter and a camera internal parameter of the mobile terminal at a viewing angle where the reference image and the m non-reference images are located; and determine a feature point in the reference image according to the feature point extraction rule; Obtaining a three-dimensional coordinate of the feature point of the reference image; determining a minimum depth value and a maximum depth value in the scene where the reference image is located according to the three-dimensional coordinates of the feature point of the reference image; determining a plurality of depth planes between the minimum depth value and the maximum depth value; Using a camera internal parameter, a camera external parameter and a direct linear transformation algorithm, calculating a first homography matrix of a plurality of depth planes from a plane in which the reference image is located to a plane in which the m non-reference images are located; using the plane scanning algorithm and the first single a pixel matrix, each pixel of the top image of the first image pyramid is projected in a plurality of depth planes onto a plane on which the top image of the m second image pyramids is located, to obtain a parameter value after each pixel point projection; The parameter value of each pixel of the top image of the first image pyramid and the parameter value after each pixel point projection, Each pixel in the mismatching loss on the depth value; the top image of each pixel of the pyramid image of the first plurality of depth plane mismatching loss is determined as the first matching loss thereof.
可选的,第一确定模块13,具体用于利用相机内参、相机外参和直接线性变换算法,计算最小深度值所在的第一深度平面由参考图像平面到m个非参考图像平面映射的第二单应性矩阵;利用相机内参、相机外参和直接线性变换算法,计算最大深度值所在的第二深度平面由参考图像平面到m个非参考图像平面映射的第三单应性矩阵;将参考图像中的一个像素点按照第二单应性矩阵投影到m个非参考图像所在的平面上,得到第一投影点;将参考图像中的一个像素点按照第三单应性矩阵投影到m个非参考图像所在的平面上,得到第二投影点;在第一投影点与第二投影点之间构成的直线上均匀取样得到多个采样点;将多个采样点反向投影到参考图像所在视角的三维空间中,得到与多个采样点的深度值对应的多个深度平面。Optionally, the first determining module 13 is configured to calculate, by using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm, a first depth plane where the minimum depth value is located, and a mapping from the reference image plane to the m non-reference image planes. a second homography matrix; using a camera internal parameter, a camera external parameter, and a direct linear transformation algorithm to calculate a third homography matrix in which the second depth plane where the maximum depth value is located is mapped from the reference image plane to m non-reference image planes; A pixel in the reference image is projected onto the plane of the m non-reference images according to the second homography matrix to obtain a first projection point; and one pixel point in the reference image is projected to the third homography matrix to m a second projection point is obtained on a plane where the non-reference image is located; a plurality of sampling points are uniformly sampled on a line formed between the first projection point and the second projection point; and the plurality of sampling points are back-projected to the reference image In the three-dimensional space of the viewing angle, a plurality of depth planes corresponding to the depth values of the plurality of sampling points are obtained.
可选的,第一确定模块13,具体用于确定与第一图像金字塔的顶层图像的像素点对应的第一图像金字塔的下层图像的像素点;确定与m个第二图像金字塔的顶层图像的像素点对应的m个第二图像金字塔的下层图像的像素点;根据初步深度图确定第一图像金字塔的下层图像的像素点的估计深度值;根据估计深度值确定第一图像金字塔的下层图像的像素点的最小深度值和最大深度值;在最小深度值和最大深度值之间确定第一图像金字塔的下层图像的多个深度平面;利用平面扫描算法和多个深度平面,计算第一图像金字塔的下层图像和m个第二图像金字塔的下层图像对应的第二匹配损失体;以第一图像金字塔的下层图像作为引导图像,利用引导滤波算法对第二匹配损失体进行局部优化得到第三匹配损失体;根据第三匹配损失体,为第一图像金字塔的下层图像的每个像素点选取第二匹配损失体中匹配损失最小的深度值,得到参考图像的场景深度图。Optionally, the first determining module 13 is specifically configured to determine a pixel point of the lower layer image of the first image pyramid corresponding to the pixel point of the top image of the first image pyramid; and determine the top image of the m second image pyramid a pixel point of the lower layer image of the m second image pyramids corresponding to the pixel; determining an estimated depth value of the pixel point of the lower layer image of the first image pyramid according to the preliminary depth map; determining the lower layer image of the first image pyramid according to the estimated depth value a minimum depth value and a maximum depth value of the pixel; determining a plurality of depth planes of the lower layer image of the first image pyramid between the minimum depth value and the maximum depth value; calculating the first image pyramid using the plane scanning algorithm and the plurality of depth planes The second matching loss body corresponding to the lower layer image of the m second image pyramids; the lower layer image of the first image pyramid is used as the guiding image, and the second matching loss body is locally optimized by the guiding filtering algorithm to obtain the third matching Loss body; according to the third matching loss body, the lower layer image of the first image pyramid Loss of the second matching member matching each pixel in the selected minimum loss of depth value, scene depth to obtain the reference image of FIG.
可选的,第三确定模块16,具体用于获取参考图像的目标位置的指定像素点;在场景深度图中确定与指定像素点对应的像素值;根据指定像素点对应的像素值在n个深度层中确定指定像素点所在的目标深度层。Optionally, the third determining module 16 is specifically configured to acquire a specified pixel point of the target position of the reference image; determine a pixel value corresponding to the specified pixel point in the scene depth map; and obtain n pixel values according to the specified pixel point Determine the target depth layer where the specified pixel is located in the depth layer.
可选的,模糊处理模块17,具体用于确定待处理像素点所在的L个深度层,L大于等于2且小于n;计算L个深度层与目标深度层的深度差;根据深度差将L个深度层中的每个深度层的像素点进行预设比例的模糊处理,L个深度层中的每个深度层的像素点的模糊程度与深度差成正比。Optionally, the blur processing module 17 is specifically configured to determine L depth layers where the pixel to be processed is located, L is greater than or equal to 2 and less than n; and calculating a depth difference between the L depth layers and the target depth layer; The pixel points of each depth layer in the depth layer are subjected to a preset ratio of blurring processing, and the degree of blur of the pixel points of each of the L depth layers is proportional to the depth difference.
图8所示的为本申请实施例提供的又一种图像背景虚化装置的示意图。参照图8,该装置包括:处理器21和存储器22,其中,存储器22内存储有处理器21能够执行的操作指令,处理器21读取存储器22内的操作指令用于实现上述各方法实施例中的方法。FIG. 8 is a schematic diagram of still another image background blurring device provided by an embodiment of the present application. Referring to FIG. 8, the apparatus includes: a processor 21 and a memory 22, wherein the memory 22 stores operation instructions executable by the processor 21, and the processor 21 reads operation instructions in the memory 22 for implementing the above method embodiments. The method in .
图9所示的为本申请实施例提供的一种图像背景虚化装置的设计结构的示意图。图像背景虚化装置包括发射器1101,接收器1102,控制器/处理器1103,存贮器1104和调制解调处理器1105。FIG. 9 is a schematic diagram showing a design structure of an image background blurring device provided by an embodiment of the present application. The image background blurring device includes a transmitter 1101, a receiver 1102, a controller/processor 1103, a memory 1104, and a modem processor 1105.
发射器1101调节(例如,模拟转换、滤波、放大和上变频等)该输出采样并生成上行链路信号,该上行链路信号经由天线发射给基站。在下行链路上,天线接收基站发射的下行链路信号。接收器1102调节(例如,滤波、放大、下变频以及数字化等)从天线接收的信号并提供输入采样。在调制解调处理器1105中,编码器1106接收要在上行链路上发送的业务数据和信令消息,并对业务数据和信令消息进行处理(例如,格式化、编码和交织)。调制器1107进一步处理(例如,符号映射和调制)编码后的业务数据和信令消息并提供输出采样。解调器1109处理(例如,解调)该输入采样并提供符号估计。解码器1108处理(例如,解交织和解码)该符号估计并提供发送给终端的已解码的数据和信令消息。编码器1106、调制器1107、解调器1109和解码器1108可以由合成的调制解调处理器1105来实现。这些单元根据无线接入网采用的无线接入技术(例如,LTE及其他演进系统的接入技术)来进行处理。 Transmitter 1101 conditions (e.g., analog transforms, filters, amplifies, and upconverts, etc.) the output samples and generates an uplink signal that is transmitted to the base station via the antenna. On the downlink, the antenna receives the downlink signal transmitted by the base station. Receiver 1102 conditions (eg, filters, amplifies, downconverts, digitizes, etc.) the signals received from the antenna and provides input samples. In modem processor 1105, encoder 1106 receives the traffic data and signaling messages to be transmitted on the uplink and processes (e.g., formats, codes, and interleaves) the traffic data and signaling messages. Modulator 1107 further processes (e.g., symbol maps and modulates) the encoded traffic data and signaling messages and provides output samples. Demodulator 1109 processes (e.g., demodulates) the input samples and provides symbol estimates. The decoder 1108 processes (e.g., deinterleaves and decodes) the symbol estimate and provides decoded data and signaling messages that are sent to the terminal. Encoder 1106, modulator 1107, demodulator 1109, and decoder 1108 may be implemented by a composite modem processor 1105. These units are processed according to the radio access technology employed by the radio access network (e.g., access technologies of LTE and other evolved systems).
控制器/处理器1103,用于按照图像提取规则在目标视频中提取一个参考图像和m个非参考图像,目标视频为利用移动终端按照预定轨迹拍摄的视频,m大于等于1;利用参考图像构建第一图像金字塔,利用m个非参考图像构建m个第二图像金字塔;利用第一图像金字塔和m个第二图像金字塔确定参考图像的场景深度图,参考图像的场景深度图表示参考图像中的任意像素点与移动终端之间的相对距离;利用场景深度图将参考图像的像素 点划分到n个深度层,其中,不同深度层中的像素点对应的物体到移动终端的深度不同,其中n大于等于2;在参考图像中确定目标位置;从n个深度层中确定出目标位置对应的像素点所在的目标深度层;将待处理像素点进行模糊处理,待处理像素点为n个深度层中除目标深度层以外的深度层中所包含的像素点。The controller/processor 1103 is configured to extract a reference image and m non-reference images in the target video according to an image extraction rule, where the target video is a video captured by the mobile terminal according to a predetermined trajectory, m is greater than or equal to 1; constructing with the reference image a first image pyramid, m first image pyramids are constructed using m non-reference images; a scene depth map of the reference image is determined using the first image pyramid and the m second image pyramids, and the scene depth map of the reference image represents the reference image The relative distance between the arbitrary pixel and the mobile terminal; the pixel of the reference image is divided into n depth layers by using the scene depth map, wherein the depth of the object corresponding to the pixel in the different depth layer is different to the mobile terminal, where n The target position is determined in the reference image; the target depth layer where the pixel corresponding to the target position is located is determined from the n depth layers; the pixel to be processed is blurred, and the pixel to be processed is n depth layers The pixel points contained in the depth layer other than the target depth layer.
需要说明的是,本申请提供实施例只是本申请所介绍的可选实施例,本领域技术人员在此基础上,完全可以设计出更多的实施例,因此不在此处赘述。It should be noted that the embodiments provided in the present application are only optional embodiments introduced in the present application, and those skilled in the art can design more embodiments based on this, and therefore are not described herein.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods to implement the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。A person skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of cells is only a logical function division. In actual implementation, there may be another division manner. For example, multiple units or components may be combined or integrated. Go to another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application 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.
功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。Functionality, if implemented as a software functional unit and sold or used as a stand-alone product, can be stored on a computer readable storage medium. Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including The instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
以上,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto, and any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, and should cover Within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of protection of the claims.

Claims (19)

  1. 一种图像背景虚化方法,其特征在于,所述方法包括:An image background blurring method, characterized in that the method comprises:
    按照图像提取规则在目标视频中提取一个参考图像和m个非参考图像,所述目标视频为利用移动终端按照预定轨迹拍摄的视频,m大于等于1;Extracting a reference image and m non-reference images in the target video according to an image extraction rule, where the target video is a video captured by the mobile terminal according to a predetermined trajectory, m is greater than or equal to 1;
    利用所述参考图像构建第一图像金字塔,利用所述m个非参考图像构建m个第二图像金字塔;Constructing a first image pyramid using the reference image, and constructing m second image pyramids by using the m non-reference images;
    利用所述第一图像金字塔和所述m个第二图像金字塔确定所述参考图像的场景深度图,所述参考图像的场景深度图表示所述参考图像中的任意像素点与所述移动终端之间的相对距离;Determining a scene depth map of the reference image by using the first image pyramid and the m second image pyramids, the scene depth map of the reference image representing an arbitrary pixel point in the reference image and the mobile terminal Relative distance between
    利用所述场景深度图将所述参考图像的像素点划分到n个深度层,其中,不同深度层中的像素点对应的物体到所述移动终端的深度不同,其中n大于等于2;Decoding, by the scene depth map, the pixel points of the reference image to the n depth layers, wherein the objects corresponding to the pixel points in the different depth layers are different in depth to the mobile terminal, where n is greater than or equal to 2;
    在所述参考图像中确定目标位置;Determining a target position in the reference image;
    从所述n个深度层中确定出所述目标位置对应的像素点所在的目标深度层;Determining, from the n depth layers, a target depth layer where the pixel point corresponding to the target location is located;
    将待处理像素点进行模糊处理,所述待处理像素点为所述n个深度层中除所述目标深度层以外的深度层中所包含的像素点。The pixel to be processed is subjected to blurring processing, and the pixel to be processed is a pixel point included in a depth layer other than the target depth layer among the n depth layers.
  2. 根据权利要求1所述的图像背景虚化方法,其特征在于,利用所述第一图像金字塔和所述m个第二图像金字塔确定所述参考图像的场景深度图包括:The image background blurring method according to claim 1, wherein determining the scene depth map of the reference image by using the first image pyramid and the m second image pyramids comprises:
    根据所述第一图像金字塔的顶层图像和所述m个第二图像金字塔的顶层图像确定所述参考图像的初步深度图,所述第一图像金字塔和所述m个第二图像金字塔均包括顶层图像和下层图像;Determining a preliminary depth map of the reference image according to a top image of the first image pyramid and a top image of the m second image pyramids, the first image pyramid and the m second image pyramids each including a top layer Image and underlying image;
    根据所述初步深度图、所述第一图像金字塔的下层图像和所述m个第二图像金字塔的下层图像,确定所述参考图像的场景深度图。Determining a scene depth map of the reference image according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids.
  3. 根据权利要求2所述的图像背景虚化方法,其特征在于,根据所述第一图像金字塔的顶层图像和所述m个第二图像金字塔的顶层图像确定所述参考图像的初步深度图包括:The image background blurring method according to claim 2, wherein determining the preliminary depth map of the reference image according to the top image of the first image pyramid and the top image of the m second image pyramids comprises:
    根据所述第一图像金字塔的顶层图像和所述m个第二图像金字塔的顶层图像,计算第一匹配损失体;Calculating a first matching loss body according to the top image of the first image pyramid and the top image of the m second image pyramids;
    根据所述第一匹配损失体构建马尔科夫随机场模型进行全局匹配损失优化,得到所述参考图像的初步深度图。A global matching loss optimization is performed according to the first matching loss body to construct a Markov random field model, and a preliminary depth map of the reference image is obtained.
  4. 根据权利要求3所述的图像背景虚化方法,其特征在于,根据所述第一图像金字塔的顶层图像和所述m个第二图像金字塔的顶层图像,计算第一匹配损失体包括:The image background blurring method according to claim 3, wherein calculating the first matching loss body according to the top image of the first image pyramid and the top image of the m second image pyramids comprises:
    获取所述参考图像和所述m个非参考图像所在的视角下的所述移动终端的相机外参和相机内参;Obtaining a camera external parameter and a camera internal reference of the mobile terminal at a viewing angle where the reference image and the m non-reference images are located;
    根据特征点提取规则确定所述参考图像中的特征点;Determining feature points in the reference image according to a feature point extraction rule;
    获取所述参考图像的特征点的三维坐标;Obtaining three-dimensional coordinates of feature points of the reference image;
    根据所述参考图像的特征点的三维坐标确定所述参考图像所在场景内的最小深度值和最大深度值;Determining a minimum depth value and a maximum depth value in a scene in which the reference image is located according to a three-dimensional coordinate of a feature point of the reference image;
    在所述最小深度值和所述最大深度值之间确定多个深度平面;Determining a plurality of depth planes between the minimum depth value and the maximum depth value;
    利用所述相机内参、所述相机外参和直接线性变换算法,计算所述多个深度平面 由所述参考图像所在的平面到所述m个非参考图像所在的平面映射的第一单应性矩阵;Calculating a first homography of the plurality of depth planes from a plane in which the reference image is located to a plane mapping of the m non-reference images by using the camera internal parameter, the camera external parameter, and a direct linear transformation algorithm matrix;
    利用平面扫描算法和所述第一单应性矩阵,将所述第一图像金字塔的顶层图像的每个像素点以所述多个深度平面投影到所述m个第二图像金字塔的顶层图像所在的平面上,得到所述每个像素点投影后的参数值;Using a plane scan algorithm and the first homography matrix, projecting each pixel of the top image of the first image pyramid to the top image of the m second image pyramids by the plurality of depth planes On the plane of the plane, the parameter values after the projection of each pixel point are obtained;
    根据所述第一图像金字塔的顶层图像的每个像素点的参数值和所述每个像素点投影后的参数值,确定所述每个像素点在深度值上的匹配损失;Determining a matching loss of each pixel point on the depth value according to a parameter value of each pixel point of the top image of the first image pyramid and a parameter value after the projection of each pixel point;
    将所述第一图像金字塔的顶层图像的每个像素点在所述多个深度平面的匹配损失确定为第一匹配损失体。A matching loss of each pixel point of the top image of the first image pyramid at the plurality of depth planes is determined as a first matching loss body.
  5. 根据权利要求4所述的图像背景虚化方法,其特征在于,在所述最小深度值和所述最大深度值之间确定多个深度平面包括:The image background blurring method according to claim 4, wherein determining a plurality of depth planes between the minimum depth value and the maximum depth value comprises:
    利用所述相机内参、所述相机外参和直接线性变换算法,计算所述最小深度值所在的第一深度平面由所述参考图像平面到所述m个非参考图像平面映射的第二单应性矩阵;Computing, by the camera internal parameter, the camera external parameter, and a direct linear transformation algorithm, a second homography of the first depth plane where the minimum depth value is mapped from the reference image plane to the m non-reference image planes Sexual matrix
    利用所述相机内参、所述相机外参和所述直接线性变换算法,计算所述最大深度值所在的第二深度平面由所述参考图像平面到所述m个非参考图像平面映射的第三单应性矩阵;Calculating, by the camera internal parameter, the camera external parameter, and the direct linear transformation algorithm, a third depth plane in which the maximum depth value is located, and mapping from the reference image plane to the m non-reference image planes Univariate matrix;
    将所述参考图像中的一个像素点按照所述第二单应性矩阵投影到所述m个非参考图像所在的平面上,得到第一投影点;And projecting a pixel point in the reference image onto the plane where the m non-reference images are located according to the second homography matrix, to obtain a first projection point;
    将所述参考图像中的一个像素点按照所述第三单应性矩阵投影到所述m个非参考图像所在的平面上,得到第二投影点;Projecting a pixel point in the reference image onto the plane where the m non-reference images are located according to the third homography matrix, to obtain a second projection point;
    在所述第一投影点与所述第二投影点之间构成的直线上均匀取样得到多个采样点;And uniformly sampling a line formed between the first projection point and the second projection point to obtain a plurality of sampling points;
    将所述多个采样点反向投影到所述参考图像所在视角的三维空间中,得到与所述多个采样点的深度值对应的多个深度平面。Projecting the plurality of sampling points back to the three-dimensional space of the perspective of the reference image to obtain a plurality of depth planes corresponding to the depth values of the plurality of sampling points.
  6. 根据权利要求2所述的图像背景虚化方法,其特征在于,根据所述初步深度图、所述第一图像金字塔的下层图像和所述m个第二图像金字塔的下层图像,确定所述参考图像的场景深度图包括:The image background blurring method according to claim 2, wherein the reference is determined according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids The scene depth map of the image includes:
    确定与所述第一图像金字塔的顶层图像的像素点对应的所述第一图像金字塔的下层图像的像素点;Determining a pixel point of a lower layer image of the first image pyramid corresponding to a pixel point of the top image of the first image pyramid;
    确定与所述m个第二图像金字塔的顶层图像的像素点对应的所述m个第二图像金字塔的下层图像的像素点;Determining pixel points of the lower layer images of the m second image pyramids corresponding to pixel points of the top image of the m second image pyramids;
    根据所述初步深度图确定所述第一图像金字塔的下层图像的像素点的估计深度值;Determining an estimated depth value of a pixel point of a lower layer image of the first image pyramid according to the preliminary depth map;
    根据所述估计深度值确定所述第一图像金字塔的下层图像的像素点的最小深度值和最大深度值;Determining, according to the estimated depth value, a minimum depth value and a maximum depth value of a pixel point of a lower layer image of the first image pyramid;
    在所述最小深度值和所述最大深度值之间确定所述第一图像金字塔的下层图像的多个深度平面;Determining a plurality of depth planes of the lower layer image of the first image pyramid between the minimum depth value and the maximum depth value;
    利用平面扫描算法和所述多个深度平面,计算所述第一图像金字塔的下层图像和所述m个第二图像金字塔的下层图像对应的第二匹配损失体;Calculating, by using a plane scanning algorithm and the plurality of depth planes, a second matching loss body corresponding to the lower layer image of the first image pyramid and the lower layer image of the m second image pyramids;
    以所述第一图像金字塔的下层图像作为引导图像,利用引导滤波算法对所述第二匹配损失体进行局部优化得到第三匹配损失体;Using the lower layer image of the first image pyramid as a guiding image, locally optimizing the second matching loss body by using a guiding filtering algorithm to obtain a third matching loss body;
    根据所述第三匹配损失体,为所述第一图像金字塔的下层图像的每个像素点选取所述第二匹配损失体中匹配损失最小的深度值,得到所述参考图像的场景深度图。And selecting, according to the third matching loss body, a depth value that is the smallest matching loss in the second matching loss body for each pixel of the lower layer image of the first image pyramid, to obtain a scene depth map of the reference image.
  7. 根据权利要求1至6任意一项所述的图像背景虚化方法,其特征在于,从所述n个深度层中确定出所述目标位置对应的像素点所在的目标深度层包括:The image background blurring method according to any one of claims 1 to 6, wherein the target depth layer in which the pixel point corresponding to the target position is determined from the n depth layers comprises:
    获取所述参考图像的目标位置的指定像素点;Obtaining a specified pixel point of a target position of the reference image;
    在所述场景深度图中确定与所述指定像素点对应的像素值;Determining, in the scene depth map, a pixel value corresponding to the specified pixel point;
    根据所述指定像素点对应的像素值在所述n个深度层中确定所述指定像素点所在的目标深度层。Determining, in the n depth layers, a target depth layer in which the specified pixel point is located according to a pixel value corresponding to the specified pixel point.
  8. 根据权利要求1至6任意一项所述的图像背景虚化方法,其特征在于,将待处理像素点进行模糊处理包括:The image background blurring method according to any one of claims 1 to 6, wherein the blurring of the pixel to be processed comprises:
    确定待处理像素点所在的L个深度层,L大于等于2且小于n;Determining L depth layers where the pixel to be processed is located, L is greater than or equal to 2 and less than n;
    计算所述L个深度层与所述目标深度层的深度差;Calculating a depth difference between the L depth layers and the target depth layer;
    根据所述深度差将所述L个深度层中的每个深度层的像素点进行预设比例的模糊处理,所述L个深度层中的每个深度层的像素点的模糊程度与所述深度差成正比。And performing, according to the depth difference, a pixel of each of the L depth layers by a predetermined proportion of blurring, a degree of blur of the pixel of each of the L depth layers and the The depth difference is proportional.
  9. 一种图像背景虚化装置,其特征在于,所述装置包括:An image background blurring device, characterized in that the device comprises:
    提取模块,用于按照图像提取规则在目标视频中提取一个参考图像和m个非参考图像,所述目标视频为利用移动终端按照预定轨迹拍摄的视频,m大于等于9;An extraction module, configured to extract a reference image and m non-reference images in the target video according to an image extraction rule, where the target video is a video captured by the mobile terminal according to a predetermined trajectory, m is greater than or equal to 9;
    构建模块,用于利用所述参考图像构建第一图像金字塔,利用所述m个非参考图像构建m个第二图像金字塔;a building module, configured to construct a first image pyramid by using the reference image, and construct m second image pyramids by using the m non-reference images;
    第一确定模块,用于利用所述第一图像金字塔和所述m个第二图像金字塔确定所述参考图像的场景深度图,所述参考图像的场景深度图表示所述参考图像中的任意像素点与所述移动终端之间的相对距离;a first determining module, configured to determine, by using the first image pyramid and the m second image pyramids, a scene depth map of the reference image, where a scene depth map of the reference image represents any pixel in the reference image The relative distance between the point and the mobile terminal;
    划分模块,用于利用所述场景深度图将所述参考图像的像素点划分到n个深度层,其中,不同深度层中的像素点对应的物体到所述移动终端的深度不同,其中n大于等于2;a dividing module, configured to divide, by using the scene depth map, pixel points of the reference image into n depth layers, wherein objects corresponding to pixel points in different depth layers have different depths to the mobile terminal, where n is greater than Equal to 2;
    第二确定模块,用于在所述参考图像中确定目标位置;a second determining module, configured to determine a target location in the reference image;
    第三确定模块,用于从所述n个深度层中确定出所述目标位置对应的像素点所在的目标深度层;a third determining module, configured to determine, from the n depth layers, a target depth layer where a pixel point corresponding to the target location is located;
    模糊处理模块,用于将待处理像素点进行模糊处理,所述待处理像素点为所述n个深度层中除所述目标深度层以外的深度层中所包含的像素点。And a fuzzy processing module, configured to perform blur processing on the pixel to be processed, where the pixel to be processed is a pixel point included in a depth layer other than the target depth layer among the n depth layers.
  10. 根据权利要求9所述的图像背景虚化装置,其特征在于:The image background blurring device according to claim 9, wherein:
    所述第一确定模块,具体用于根据所述第一图像金字塔的顶层图像和所述m个第二图像金字塔的顶层图像确定所述参考图像的初步深度图,所述第一图像金字塔和所述m个第二图像金字塔均包括顶层图像和下层图像;根据所述初步深度图、所述第一图像金字塔的下层图像和所述m个第二图像金字塔的下层图像,确定所述参考图像的场景深度图。The first determining module is configured to determine a preliminary depth map of the reference image according to the top image of the first image pyramid and the top image of the m second image pyramids, the first image pyramid and the The m second image pyramids each include a top layer image and a lower layer image; determining the reference image according to the preliminary depth map, the lower layer image of the first image pyramid, and the lower layer image of the m second image pyramids Scene depth map.
  11. 根据权利要求10所述的图像背景虚化装置,其特征在于:The image background blurring device according to claim 10, wherein:
    所述第一确定模块,具体用于根据所述第一图像金字塔的顶层图像和所述m个第二图像金字塔的顶层图像,计算第一匹配损失体;根据所述第一匹配损失体构建马尔 科夫随机场模型进行全局匹配损失优化,得到所述参考图像的初步深度图。The first determining module is configured to calculate a first matching loss body according to the top image of the first image pyramid and the top image of the m second image pyramids; and construct a Mar according to the first matching loss body The Cove random field model performs global matching loss optimization to obtain a preliminary depth map of the reference image.
  12. 根据权利要求11所述的图像背景虚化装置,其特征在于:The image background blurring device according to claim 11, wherein:
    所述第一确定模块,具体用于获取所述参考图像和所述m个非参考图像所在的视角下的所述移动终端的相机外参和相机内参;根据特征点提取规则确定所述参考图像中的特征点;获取所述参考图像的特征点的三维坐标;根据所述参考图像的特征点的三维坐标确定所述参考图像所在场景内的最小深度值和最大深度值;在所述最小深度值和所述最大深度值之间确定多个深度平面;利用所述相机内参、所述相机外参和直接线性变换算法,计算所述多个深度平面由所述参考图像所在的平面到所述m个非参考图像所在的平面映射的第一单应性矩阵;利用平面扫描算法和所述第一单应性矩阵,将所述第一图像金字塔的顶层图像的每个像素点以所述多个深度平面投影到所述m个第二图像金字塔的顶层图像所在的平面上,得到所述每个像素点投影后的参数值;根据所述第一图像金字塔的顶层图像的每个像素点的参数值和所述每个像素点投影后的参数值,确定所述每个像素点在深度值上的匹配损失;将所述第一图像金字塔的顶层图像的每个像素点在所述多个深度平面的匹配损失确定为第一匹配损失体。The first determining module is specifically configured to acquire camera external parameters and camera internal parameters of the mobile terminal at a viewing angle where the reference image and the m non-reference images are located; and determine the reference image according to a feature point extraction rule a feature point in the feature image; acquiring a three-dimensional coordinate of the feature point of the reference image; determining a minimum depth value and a maximum depth value in the scene in which the reference image is located according to the three-dimensional coordinates of the feature point of the reference image; Determining a plurality of depth planes between the value and the maximum depth value; calculating, by the camera internal parameter, the camera outer parameter, and a direct linear transformation algorithm, the plurality of depth planes from a plane in which the reference image is located to a first homography matrix of the plane mapping of the m non-reference images; using a plane scan algorithm and the first homography matrix, each pixel of the top image of the first image pyramid is Projecting a depth image onto a plane on which the top image of the m second image pyramids is located, and obtaining a parameter value after the projection of each pixel point; a parameter value of each pixel of the top image of an image pyramid and a parameter value after the projection of each pixel point, determining a matching loss of the pixel point on the depth value; and the first image pyramid The matching loss of each pixel of the top image at the plurality of depth planes is determined as the first matching loss body.
  13. 根据权利要求12所述的图像背景虚化装置,其特征在于:The image background blurring device according to claim 12, wherein:
    所述第一确定模块,具体用于利用所述相机内参、所述相机外参和直接线性变换算法,计算所述最小深度值所在的第一深度平面由所述参考图像平面到所述m个非参考图像平面映射的第二单应性矩阵;利用所述相机内参、所述相机外参和所述直接线性变换算法,计算所述最大深度值所在的第二深度平面由所述参考图像平面到所述m个非参考图像平面映射的第三单应性矩阵;将所述参考图像中的一个像素点按照所述第二单应性矩阵投影到所述m个非参考图像所在的平面上,得到第一投影点;将所述参考图像中的一个像素点按照所述第三单应性矩阵投影到所述m个非参考图像所在的平面上,得到第二投影点;在所述第一投影点与所述第二投影点之间构成的直线上均匀取样得到多个采样点;将所述多个采样点反向投影到所述参考图像所在视角的三维空间中,得到与所述多个采样点的深度值对应的多个深度平面。The first determining module is configured to calculate, by using the camera internal parameter, the camera external parameter, and a direct linear transformation algorithm, a first depth plane where the minimum depth value is located, from the reference image plane to the m a second homography matrix of the non-reference image plane mapping; using the camera internal parameter, the camera outer parameter, and the direct linear transformation algorithm, calculating a second depth plane where the maximum depth value is located by the reference image plane a third homography matrix mapped to the m non-reference image planes; projecting one pixel point in the reference image according to the second homography matrix onto a plane where the m non-reference images are located Obtaining a first projection point; projecting a pixel point in the reference image onto the plane where the m non-reference images are located according to the third homography matrix, to obtain a second projection point; A plurality of sampling points are uniformly sampled on a line formed between a projection point and the second projection point; and the plurality of sampling points are backprojected into a three-dimensional space of a viewing angle of the reference image, And a plurality of depth planes corresponding to depth values of the plurality of sampling points.
  14. 根据权利要求10所述的图像背景虚化装置,其特征在于:The image background blurring device according to claim 10, wherein:
    所述第一确定模块,具体用于确定与所述第一图像金字塔的顶层图像的像素点对应的所述第一图像金字塔的下层图像的像素点;确定与所述m个第二图像金字塔的顶层图像的像素点对应的所述m个第二图像金字塔的下层图像的像素点;根据所述初步深度图确定所述第一图像金字塔的下层图像的像素点的估计深度值;根据所述估计深度值确定所述第一图像金字塔的下层图像的像素点的最小深度值和最大深度值;在所述最小深度值和所述最大深度值之间确定所述第一图像金字塔的下层图像的多个深度平面;利用平面扫描算法和所述多个深度平面,计算所述第一图像金字塔的下层图像和所述m个第二图像金字塔的下层图像对应的第二匹配损失体;以所述第一图像金字塔的下层图像作为引导图像,利用引导滤波算法对所述第二匹配损失体进行局部优化得到第三匹配损失体;根据所述第三匹配损失体,为所述第一图像金字塔的下层图像的每个像素点选取所述第二匹配损失体中匹配损失最小的深度值,得到所述参考图像的场景深度图。The first determining module is specifically configured to determine a pixel point of a lower layer image of the first image pyramid corresponding to a pixel point of a top image of the first image pyramid; and determine a pyramid with the m second image pyramids a pixel point of a lower layer image of the m second image pyramids corresponding to a pixel of the top image; determining an estimated depth value of a pixel point of the lower layer image of the first image pyramid according to the preliminary depth map; a depth value determining a minimum depth value and a maximum depth value of a pixel point of the lower layer image of the first image pyramid; determining a plurality of lower layer images of the first image pyramid between the minimum depth value and the maximum depth value a depth matching plane; calculating, by the plane scanning algorithm and the plurality of depth planes, a second matching loss body corresponding to the lower layer image of the first image pyramid and the lower layer image of the m second image pyramids; A lower layer image of an image pyramid is used as a guide image, and the second matching loss body is locally optimized by a guided filtering algorithm to obtain a third Determining a loss body; selecting, according to the third matching loss body, a depth value of a minimum matching loss in the second matching loss body for each pixel of the lower layer image of the first image pyramid, to obtain the reference image Scene depth map.
  15. 根据权利要求9至14任意一项所述的图像背景虚化装置,其特征在于:The image background blurring device according to any one of claims 9 to 14, wherein:
    所述第三确定模块,具体用于获取所述参考图像的目标位置的指定像素点;在所述场景深度图中确定与所述指定像素点对应的像素值;根据所述指定像素点对应的像素值在所述n个深度层中确定所述指定像素点所在的目标深度层。The third determining module is specifically configured to acquire a specified pixel point of the target position of the reference image; determine, in the scene depth map, a pixel value corresponding to the specified pixel point; and corresponding to the specified pixel point A pixel value determines a target depth layer in which the specified pixel point is located in the n depth layers.
  16. 根据权利要求9至14任意一项所述的图像背景虚化装置,其特征在于:The image background blurring device according to any one of claims 9 to 14, wherein:
    所述模糊处理模块,具体用于确定待处理像素点所在的L个深度层,L大于等于2且小于n;计算所述L个深度层与所述目标深度层的深度差;根据所述深度差将所述L个深度层中的每个深度层的像素点进行预设比例的模糊处理,所述L个深度层中的每个深度层的像素点的模糊程度与所述深度差成正比。The blur processing module is specifically configured to determine L depth layers where the pixel to be processed is located, L is greater than or equal to 2 and less than n; calculating a depth difference between the L depth layers and the target depth layer; according to the depth Performing a blurring process on a pixel of each of the L depth layers by a predetermined ratio, and a degree of blur of a pixel of each of the L depth layers is proportional to the depth difference .
  17. 一种图像背景虚化装置,其特征在于,包括:处理器和存储器,其中,存储器内存储有处理器能够执行的操作指令,处理器读取存储器内的操作指令用于实现以下权利要求1至8中任一项所述的方法。An image background blurring device, comprising: a processor and a memory, wherein the memory stores an operation instruction executable by the processor, and the processor reads an operation instruction in the memory for implementing the following claim 1 The method of any of 8.
  18. 一种计算机可读存储介质,其特征在于,包括指令,当其在计算机上运行时,使得计算机执行如权利要求1至8中任一项所述的方法。A computer readable storage medium, comprising instructions that, when run on a computer, cause the computer to perform the method of any one of claims 1-8.
  19. 一种计算机程序产品,其特征在于,当其在计算机上运行时,使得计算机执行如权利要求1至8中任一项所述的方法。A computer program product, characterized in that it, when run on a computer, causes the computer to perform the method of any one of claims 1 to 8.
PCT/CN2017/117180 2017-03-27 2017-12-19 Image background blurring method and apparatus WO2018176929A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710189167.0A CN108668069B (en) 2017-03-27 2017-03-27 Image background blurring method and device
CN201710189167.0 2017-03-27

Publications (1)

Publication Number Publication Date
WO2018176929A1 true WO2018176929A1 (en) 2018-10-04

Family

ID=63674131

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/117180 WO2018176929A1 (en) 2017-03-27 2017-12-19 Image background blurring method and apparatus

Country Status (2)

Country Link
CN (1) CN108668069B (en)
WO (1) WO2018176929A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110120009A (en) * 2019-05-09 2019-08-13 西北工业大学 Background blurring implementation method based on obvious object detection and depth estimation algorithm
CN110910304A (en) * 2019-11-08 2020-03-24 北京达佳互联信息技术有限公司 Image processing method, image processing apparatus, electronic device, and medium
CN111222514A (en) * 2019-12-31 2020-06-02 西安航天华迅科技有限公司 Local map optimization method based on visual positioning

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110992412B (en) * 2019-12-09 2023-02-28 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and electronic equipment
CN112948814A (en) * 2021-03-19 2021-06-11 合肥京东方光电科技有限公司 Account password management method and device and storage medium
CN115760986B (en) * 2022-11-30 2023-07-25 北京中环高科环境治理有限公司 Image processing method and device based on neural network model

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156997A (en) * 2010-01-19 2011-08-17 索尼公司 Image processing apparatus and image processing method
US8284258B1 (en) * 2008-09-18 2012-10-09 Grandeye, Ltd. Unusual event detection in wide-angle video (based on moving object trajectories)
CN102801910A (en) * 2011-05-27 2012-11-28 三洋电机株式会社 Image sensing device
CN103037075A (en) * 2011-10-07 2013-04-10 Lg电子株式会社 Mobile terminal and method for generating an out-of-focus image
CN104424640A (en) * 2013-09-06 2015-03-18 格科微电子(上海)有限公司 Method and device for carrying out blurring processing on images
CN105578026A (en) * 2015-07-10 2016-05-11 宇龙计算机通信科技(深圳)有限公司 Photographing method and user terminal
CN106060423A (en) * 2016-06-02 2016-10-26 广东欧珀移动通信有限公司 Bokeh photograph generation method and device, and mobile terminal
CN106331492A (en) * 2016-08-29 2017-01-11 广东欧珀移动通信有限公司 Image processing method and terminal
CN106530241A (en) * 2016-10-31 2017-03-22 努比亚技术有限公司 Image blurring processing method and apparatus

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8284258B1 (en) * 2008-09-18 2012-10-09 Grandeye, Ltd. Unusual event detection in wide-angle video (based on moving object trajectories)
CN102156997A (en) * 2010-01-19 2011-08-17 索尼公司 Image processing apparatus and image processing method
CN102801910A (en) * 2011-05-27 2012-11-28 三洋电机株式会社 Image sensing device
CN103037075A (en) * 2011-10-07 2013-04-10 Lg电子株式会社 Mobile terminal and method for generating an out-of-focus image
CN104424640A (en) * 2013-09-06 2015-03-18 格科微电子(上海)有限公司 Method and device for carrying out blurring processing on images
CN105578026A (en) * 2015-07-10 2016-05-11 宇龙计算机通信科技(深圳)有限公司 Photographing method and user terminal
CN106060423A (en) * 2016-06-02 2016-10-26 广东欧珀移动通信有限公司 Bokeh photograph generation method and device, and mobile terminal
CN106331492A (en) * 2016-08-29 2017-01-11 广东欧珀移动通信有限公司 Image processing method and terminal
CN106530241A (en) * 2016-10-31 2017-03-22 努比亚技术有限公司 Image blurring processing method and apparatus

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110120009A (en) * 2019-05-09 2019-08-13 西北工业大学 Background blurring implementation method based on obvious object detection and depth estimation algorithm
CN110120009B (en) * 2019-05-09 2022-06-07 西北工业大学 Background blurring implementation method based on salient object detection and depth estimation algorithm
CN110910304A (en) * 2019-11-08 2020-03-24 北京达佳互联信息技术有限公司 Image processing method, image processing apparatus, electronic device, and medium
CN110910304B (en) * 2019-11-08 2023-12-22 北京达佳互联信息技术有限公司 Image processing method, device, electronic equipment and medium
CN111222514A (en) * 2019-12-31 2020-06-02 西安航天华迅科技有限公司 Local map optimization method based on visual positioning
CN111222514B (en) * 2019-12-31 2023-06-27 上海星思半导体有限责任公司 Local map optimization method based on visual positioning

Also Published As

Publication number Publication date
CN108668069B (en) 2020-04-14
CN108668069A (en) 2018-10-16

Similar Documents

Publication Publication Date Title
WO2018176929A1 (en) Image background blurring method and apparatus
US20220353432A1 (en) Augmented reality self-portraits
US20230410424A1 (en) System and method for virtual modeling of indoor scenes from imagery
US9729787B2 (en) Camera calibration and automatic adjustment of images
CN105721853B (en) Generate method, system and the computer readable storage devices of image capture instruction
US11816810B2 (en) 3-D reconstruction using augmented reality frameworks
US9558557B2 (en) Online reference generation and tracking for multi-user augmented reality
CN105283905B (en) Use the robust tracking of Points And lines feature
CN108492316A (en) A kind of localization method and device of terminal
CN106875431B (en) Image tracking method with movement prediction and augmented reality implementation method
US20110285810A1 (en) Visual Tracking Using Panoramas on Mobile Devices
US20050265453A1 (en) Image processing apparatus and method, recording medium, and program
CN109887003A (en) A kind of method and apparatus initialized for carrying out three-dimensional tracking
US10545215B2 (en) 4D camera tracking and optical stabilization
CN104835138A (en) Aligning ground based images and aerial imagery
CN109361880A (en) A kind of method and system showing the corresponding dynamic picture of static images or video
CN112085031A (en) Target detection method and system
CN108961182B (en) Vertical direction vanishing point detection method and video correction method for video image
CN103617631B (en) A kind of tracking based on Spot detection
US20240005587A1 (en) Machine learning based controllable animation of still images
CN111192308B (en) Image processing method and device, electronic equipment and computer storage medium
CN114095780A (en) Panoramic video editing method, device, storage medium and equipment
US11315346B2 (en) Method for producing augmented reality image
US20230394749A1 (en) Lighting model
EP3594900A1 (en) Tracking an object in a sequence of panoramic images

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

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

Country of ref document: EP

Kind code of ref document: A1