Image processing method and device

By obtaining the grayscale image and the original depth map output by the binocular camera, extracting the fitting plane and performing fusion processing, determining and optimizing the foreground area in the depth map, the problem of high computational consumption of the stereo matching algorithm in the existing technology is solved, and the implementation Provides efficient and accurate depth map optimization.

CN114359123BActive Publication Date: 2024-09-20GUANGDONG HUITIAN AEROSPACE TECH CO LTD
View PDF 15 Cites 0 Cited by

Patent Information

Application Number
CN202210033560.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-12
Publication Date
2024-09-20
Estimated Expiration
2042-01-12

AI Technical Summary

Technical Problem

The existing stereo matching algorithm consumes a lot of calculations in the real-time processing system, making it impossible for users to optimize or adjust the algorithm according to specific usage scenarios, and the customization cost is high and the cycle is long.

Method used

By obtaining the original depth map and grayscale image, generating a fitting plane, merging images, determining the foreground area, and optimizing its resolution, a target depth map is generated to avoid global pan-optimization and achieve local clarity optimization.

Benefits of technology

It improves the clarity and accuracy of the depth map, reduces the optimization cost, and achieves precise depth map optimization based on specific scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114359123B
    Figure CN114359123B
Patent Text Reader

Abstract

The embodiment of the present invention provides an image processing method and device, the method comprising: obtaining an original depth map and a grayscale map; generating a fitting plane based on the original depth map; generating a fused image based on the original depth map and the grayscale map; determining a foreground area in the original depth map based on the fitting plane and the fused image; optimizing the resolution of the foreground area to obtain a target foreground; generating a target depth map based on the target foreground and the fitting plane. The embodiment of the present invention can accurately detect the foreground area in the depth map, optimize the resolution of the foreground area, and improve the clarity of the foreground area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image technology, and in particular to an image processing method and an image processing device. Background Art

[0002] Stereo vision has important applications in many fields such as surveying and mapping, dense 3D reconstruction, autonomous driving, and visual navigation, and the generation of depth images has always been a critical factor in the field of stereo vision. The accuracy of the depth map output directly affects the overall stability and availability of the stereo vision system.

[0003] Usually, the depth map is generated by a stereo disparity matching algorithm, and the current stereo matching algorithm is relatively mature. Since the stereo matching algorithm consumes a lot of computational power, in real-time processing systems, the camera device usually integrates the stereo matching algorithm (that is, the device directly outputs the depth map), without the need for the user to implement the stereo matching algorithm on the back end. Because the device manufacturer burns the stereo matching algorithm on the device chip, users cannot optimize the algorithm and adjust the algorithm parameters according to the specific usage scenario unless the manufacturer supports user customization. However, customization has the problems of high customization costs and long time periods. Summary of the invention

[0004] In view of the above problems, embodiments of the present invention are proposed to provide an image processing method and a corresponding image processing device that overcome the above problems or at least partially solve the above problems.

[0005] In order to solve the above problem, an embodiment of the present invention discloses an image processing method, including:

[0006] Get the original depth map and grayscale image;

[0007] generating a fitting plane according to the original depth map;

[0008] Generate a fused image based on the original depth map and the grayscale map;

[0009] Determining a foreground area in the original depth map based on the fitting plane and the fused image;

[0010] Optimizing the resolution of the foreground area to obtain a target foreground;

[0011] A target depth map is generated based on the target foreground and the fitted plane.

[0012] Optionally, the step of generating a fused image based on the original depth map and the grayscale map includes:

[0013] Performing edge detection on the grayscale image to obtain an edge detection result; the edge detection result includes a first pixel value;

[0014] Determining a second pixel value in the depth map corresponding to a position of the first pixel value;

[0015] Fusing the first pixel value and the second pixel value according to a preset linear relationship to obtain a third pixel value;

[0016] A fused image is generated for the third pixel value.

[0017] Optionally, the step of determining the foreground area in the original depth map based on the fitting plane and the fused image includes:

[0018] Generate a mask image for the fused image; the mask image is composed of fourth pixel values;

[0019] Determining a boundary length corresponding to the fourth pixel value;

[0020] Determine at least one area to be distinguished in the original depth map except the position of the fitting plane;

[0021] Determine the depth value of the pixel point in the area to be distinguished;

[0022] Obtaining a foreground reference value of the area to be distinguished according to the depth value and the boundary length;

[0023] Obtaining the number of edges for the original depth map;

[0024] A foreground area is determined based on the foreground reference value and the edge quantity.

[0025] Optionally, the step of determining the foreground area based on the foreground reference value and the edge quantity includes:

[0026] If the foreground reference value of the area to be distinguished is not greater than a first preset threshold and the number of edges corresponding to the area to be distinguished is not less than a first preset number, determining that the area to be distinguished is a foreground area;

[0027] If the foreground reference value of the area to be distinguished is greater than a first preset threshold and the number of edges corresponding to the area to be distinguished is less than a first preset number, the area to be distinguished is determined to be a background area.

[0028] Optionally, the step of optimizing the resolution of the foreground area to obtain a target foreground includes:

[0029] Using preset active contour information, identifying a target virtual object in the foreground area;

[0030] The resolution of the target virtual object is optimized to obtain a target foreground.

[0031] Optionally, the step of optimizing the resolution of the target virtual object to obtain a target foreground includes:

[0032] Acquire an external sub-image in the original depth map that matches the target virtual object;

[0033] Acquire an edge mask in the grayscale image that matches the circumscribed sub-image;

[0034] Performing interpolation processing on the external sub-image to obtain an interpolated image;

[0035] superimposing the interpolated image and the edge mask to obtain a superimposed image;

[0036] Performing edge filtering on the superimposed image to obtain a filtered image containing connected areas;

[0037] Performing depth value restoration processing on the filtered image to obtain a target sub-image;

[0038] Based on the target sub-image, a target foreground is generated.

[0039] Optionally, the step of performing depth value restoration processing on the filtered image to obtain a target sub-image includes:

[0040] Performing mean filtering on both sides of the edge of the connected area to obtain a mean image;

[0041] Generating three-dimensional point cloud data corresponding to the mean image;

[0042] Fitting the three-dimensional point cloud data to obtain a virtual plane;

[0043] De-mapping the virtual plane to obtain a depth value gradient image;

[0044] Down-sampling is performed on the depth value gradient image to generate a target sub-image.

[0045] The embodiment of the present invention further discloses an image processing device, comprising:

[0046] Image acquisition module, used to obtain original depth map and grayscale image;

[0047] A fitting plane generating module, used to generate a fitting plane according to the original depth map;

[0048] A fusion module, used for generating a fused image based on the original depth map and the grayscale map;

[0049] a foreground area determination module, configured to determine a foreground area in the original depth map based on the fitting plane and the fused image;

[0050] A target foreground generation module is used to optimize the resolution of the foreground area to obtain a target foreground;

[0051] The target depth map generation module is used to generate a target depth map based on the target foreground and the fitting plane.

[0052] An embodiment of the present invention further discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the steps of the above-mentioned image processing method when executed by the processor.

[0053] The embodiment of the present invention further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image processing method described above are implemented.

[0054] The embodiments of the present invention include the following advantages:

[0055] After obtaining the grayscale image and original depth map output by the binocular camera, the fitting plane is extracted according to the original depth map, the grayscale image processed by edge detection and the original depth map are fused to obtain a fused image, the foreground area in the original depth map is detected based on the fitting plane and the fused image, the resolution of the foreground area is optimized to obtain a target foreground with improved clarity, and the target foreground and the fitting plane are superimposed to obtain a target depth map with local resolution optimization of the target foreground of interest. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 is a flowchart of steps of an image processing method embodiment of the present invention;

[0057] Figure 2 is a grayscale image provided by an embodiment of the present invention;

[0058] Figure 3 It is for Figure 2 A structural diagram of

[0059] Figure 4 It is a schematic diagram of edge results of a grayscale image provided by the present invention;

[0060] Figure 5 It is a kind of circumscribed rectangular character diagram provided by the present invention;

[0061] Figure 6 is an example flow chart of image processing of the present invention;

[0062] Figure 7 It is a structural block diagram of an image processing device embodiment of the present invention. DETAILED DESCRIPTION

[0063] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0064] One of the core concepts of an embodiment of the present invention is that after obtaining the grayscale image and the original depth map output by the binocular camera, a fitting plane is extracted according to the original depth map, the grayscale image processed by edge detection and the original depth map are fused to obtain a fused image, the foreground area in the original depth map is detected based on the fitting plane and the fused image, the resolution of the foreground area is optimized to obtain a target foreground with improved clarity, and the target foreground and the fitting plane are superimposed to obtain a target depth map with local resolution optimization of the target foreground of interest, thereby avoiding global optimization and making the optimization more accurate and obvious than global optimization.

[0065] Reference Figure 1 , shows a flowchart of an image processing method embodiment of the present invention, which may specifically include the following steps:

[0066] Step 101, obtaining an original depth map and a grayscale map;

[0067] The embodiment of the present invention can be applied to a flying mobile object, in which a binocular camera is provided. When the mobile object is in the air, images of the ground can be collected, and original depth maps and grayscale maps of the ground can be output.

[0068] The original depth map is an image processed by a preset binocular stereo matching algorithm. The present invention does not limit the specific binocular stereo matching algorithm method.

[0069] Step 102, generating a fitting plane according to the original depth map;

[0070] First, convert the depth map into a 3D point cloud using formulas (1)-(2):

[0071]

[0072]

[0073] Where f is the focal length of the lens, dx, dy are the intrinsic parameters of the camera, representing the physical length of a single pixel on the x / y axis on the image plane, R and T are the extrinsic parameter matrices of the camera, which default to the unit matrix (u0, v0) for the position of the camera in pixel coordinates, and Zc for the preset optical axis of the camera. By combining equations (1) and (2), the image point [u, v] can be calculated: T To the world coordinate point [x w ,y w ,z w ]T .

[0074] First, a subset is selected from the 3D point set corresponding to the depth map, and then a plane is fitted to the 3D point cloud subset. The plane equation is as follows:

[0075] ax+by+cz=d(d≥0), 2 +2+2=1

[0076] ( i ,y i ,i) is a point set, i=1,2,3…n

[0077] Fitting the plane is a least squares problem, as shown in equation (4), d i Represents the distance to the plane:

[0078]

[0079] The least squares calculation formula (4) is converted into extreme value calculation to obtain the calculation formula (5):

[0080]

[0081] Perform partial derivative calculation on d, a, b, and c in formula (5), and obtain formula (6):

[0082]

[0083] In the calculation formula (6), the left curly bracket is the covariance matrix of n points, and (a, b, c)T is an eigenvector of the covariance matrix. Among the obtained eigenvectors, the smallest eigenvector is selected as the normal vector of the best fitting plane. Because the smaller the eigenvector, the smaller the difference between the points in the point set included in the covariance matrix, that is, the better the consistency.

[0084] Through the above calculation, a plurality of fitting planes are obtained, and the fitting planes include a ground surface fitting plane for the ground.

[0085] In another optional embodiment, image clustering or region segmentation based on grayscale images can be used, and then a larger area after segmentation is selected (a threshold σ is set) to divide the point cloud subset for plane fitting, and a fitting plane is generated based on the point cloud subset.

[0086] Reference Figure 2 , shows a grayscale image provided by an embodiment of the present invention. Figure 3 , showing the Figure 2 A structural diagram of. Figure 2 Figure 3It can be seen that in some scenes, the binocular camera may collect image data for the building facade (for example, the surface of a building), and the image data for the building exterior surface can obtain the corresponding building exterior fitting plane.

[0087] The sizes and angles of different fitting planes can be used to determine whether the fitting plane is a ground surface fitting plane or a building exterior fitting plane.

[0088] Step 103, generating a fused image according to the original depth map and the grayscale map;

[0089] The pixels in the original depth map and the pixels in the grayscale map can be fused to obtain a fused image, and the fused image has better edge detection characteristics.

[0090] Step 104, determining a foreground area in the original depth map based on the fitting plane and the fused image;

[0091] The original depth map is divided into a foreground area, a background area, and a fitted plane area, wherein the background area is the area where the image data collected for unstructured objects (for example, plants) is located. The fitted plane area can be excluded from the original depth map first, and the remaining areas in the original depth map are divided into foreground and background areas based on the fused image. Since the fused image has better edge detection features, the foreground area of ​​the original depth map divided based on the fused image has better confidence.

[0092] Step 105, optimizing the resolution of the foreground area to obtain a target foreground;

[0093] The resolution of the foreground area obtained in the above steps is optimized to obtain a target foreground with higher clarity.

[0094] Step 106: Generate a target depth map based on the target foreground and the fitting plane.

[0095] Based on the superposition of the target foreground and the fitting plane, the target depth map is reconstructed. Due to the optimization of the target foreground, the target foreground in the target depth map has higher clarity than other areas, thereby achieving local clarity optimization of the foreground area of ​​the original depth map.

[0096] In a specific implementation, the target foreground, fitting plane, and background area may be superimposed to generate a target depth map.

[0097] In an embodiment of the present invention, after obtaining the grayscale image and the original depth map output by the binocular camera, a fitting plane is extracted according to the original depth map, the grayscale image processed by edge detection and the original depth map are fused to obtain a fused image, the foreground area in the original depth map is detected based on the fitting plane and the fused image, the resolution of the foreground area is optimized to obtain a target foreground with improved clarity, and the target foreground and the fitting plane are superimposed to obtain a target depth map with local resolution optimization of the target foreground of interest, thereby avoiding global optimization and making the optimization more accurate and obvious than global optimization.

[0098] In an optional embodiment of the present invention, step 103 includes:

[0099] Sub-step S11, performing edge detection on the grayscale image to obtain an edge detection result; the edge detection result includes a first pixel value;

[0100] Sub-step S12, determining a second pixel value corresponding to the position of the first pixel value in the depth map;

[0101] Sub-step S13, fusing the first pixel value and the second pixel value according to a preset linear relationship to obtain a third pixel value;

[0102] Sub-step S14: generating a fused image for the third pixel value.

[0103] Reference Figure 4 , shows a schematic diagram of an edge result of a grayscale image provided by the present invention. In order to enhance the robustness of edge detection, edge detection is performed on the grayscale to obtain an edge detection result, and the edge detection result including the first pixel value is fused to the depth map to obtain a fused image.

[0104] Specifically, the third pixel value contained in the fused image can be calculated by the following formula (7):

[0105]

[0106] Among them, P i ' is the fused pixel value, i.e., the third pixel value, α, β, γ are preset coefficients, is the pixel value of the original grayscale image after edge detection, that is, the first pixel value, is the value of the corresponding position in the depth map, i.e., the second pixel value, and i is the pixel index used to distinguish pixels at different positions.

[0107] In an optional embodiment of the present invention, step 104 includes:

[0108] Sub-step S21, generating a mask image for the fused image; the mask image is composed of fourth pixel values;

[0109] Sub-step S22, determining a boundary length corresponding to the fourth pixel value;

[0110] Sub-step S23, determining at least one area to be distinguished except the position of the fitting plane in the original depth map;

[0111] Sub-step S24, determining the depth value of the pixel points in the area to be distinguished;

[0112] Sub-step S25, obtaining a foreground reference value of the area to be distinguished according to the depth value and the boundary length;

[0113] Sub-step S26, obtaining the number of edges for the original depth map;

[0114] Sub-step S27, determining a foreground area based on the foreground reference value and the edge quantity.

[0115] In a specific implementation, a matching mask image may be generated for the fused image, and then the fourth pixel value P contained in the mask image may be determined. j , and determine the boundary length K of the mask image corresponding to the fourth pixel value.

[0116] The original depth map is clustered, and the original depth map is region-cut based on the clustering result, and at least one region in the original depth map other than the region where the fitting plane is located is divided as the region to be distinguished. After obtaining the depth value in the region to be distinguished, the foreground reference value is calculated according to formula (8) for the region to be distinguished that meets the preset area size:

[0117]

[0118] is the foreground reference value, v i represents the depth value of the pixel in the area to be distinguished, N is the number of pixels in the area to be distinguished, K is the convolution result at the point, and represents the boundary length of the boundary model in the mxm area near the point (where m is the size of the convolution matrix, for example: the convolution matrix is ​​3, and the mxm area is a 3x3 area), P j is the pixel value of the mask image.

[0119] Perform edge detection on the original depth map to obtain the number of edges in the original depth map.

[0120] The foreground area is determined by combining the foreground reference value and the edge quantity.

[0121] In an optional embodiment of the present invention, the sub-step S27 includes:

[0122] Sub-step S271, if the foreground reference value of the area to be distinguished is not greater than a first preset threshold and the number of edges corresponding to the area to be distinguished is not less than a first preset number, determining that the area to be distinguished is a foreground area;

[0123] Sub-step S272: If the foreground reference value of the area to be distinguished is greater than a first preset threshold and the number of edges corresponding to the area to be distinguished is less than a first preset number, then determining that the area to be distinguished is a background area.

[0124] If the foreground reference value in the area to be distinguished is greater than the first threshold, and the position corresponding to the area to be distinguished has a first preset number of edges, the area to be distinguished is the foreground area, otherwise it is the background area.

[0125] In an optional embodiment of the present invention, step 105 includes:

[0126] Sub-step S31, using preset active contour information to identify a target virtual object in the foreground area;

[0127] An active contour can be constructed, and the active contour is adapted to the 4-space curve to determine the target virtual object of interest in the target foreground area, where the target virtual object is an object with structural features. For example: Figure 3 Vehicle A, vehicle B, and vehicle C in the diagram.

[0128] Sub-step S32, performing resolution optimization on the target virtual object to obtain a target foreground.

[0129] The resolution of the target virtual object is specifically improved to obtain the target foreground.

[0130] In the specific implementation, the active contour can be constructed as shown in expression (9):

[0131] v(s)=(x(s),y())∈[0,1]

[0132] And determine its energy function as expression (10):

[0133]

[0134] Among them, E ext represents external energy,

[0135] α, β are constant coefficients used to represent the influence of each energy term on the optimization result. They correspond to the square of the modulus of the first-order derivative and the second-order derivative of the activity curve, respectively. When the contour C is close to the edge of the target image, the gray gradient of C will increase, and E extwill decrease. In the process of energy minimization, the contour line will evolve towards the direction close to the edge of the target. After the active contour, a relatively single object block (target virtual object) can be obtained from the foreground, and the object block can be super-resolved and super-resolution transformed to refine the object depth data and obtain the target foreground.

[0136] In an optional embodiment of the present invention, the sub-step S32 includes:

[0137] Sub-step S321, obtaining an external sub-image in the original depth map that matches the target virtual object;

[0138] Sub-step S322, obtaining an edge mask in the grayscale image that matches the circumscribed sub-image;

[0139] Sub-step S323, performing interpolation processing on the external sub-image to obtain an interpolated image;

[0140] Sub-step S324, superimposing the interpolated image and the edge mask to obtain a superimposed image;

[0141] Sub-step S325, performing edge filtering on the superimposed image to obtain a filtered image containing a connected area;

[0142] Sub-step S326, performing depth value restoration processing on the filtered image to obtain a target sub-image;

[0143] Sub-step S327, generating a target foreground based on the target sub-image.

[0144] Reference Figure 5 , showing a circumscribed rectangular character map provided by the present invention. In a specific implementation, the circumscribed rectangular sub-map of the above-mentioned active contour can be cut out from the original depth map first. Then, trilinear interpolation is performed on the rectangular sub-map to improve the resolution and superimpose the edge model of the original grayscale image in this area, and the edges in the original grayscale image corresponding to the sub-map with improved resolution are filtered (deletion can be performed based on the length of the edge, and the edges with shorter edges are removed). After the object edges are processed in the second step, the sub-depth map is divided into several connected areas, so the depth value of this connected area can be repaired in the end.

[0145] In an optional embodiment of the present invention, the sub-step S326 includes:

[0146] Sub-step S3261, performing mean filtering on both sides of the edge of the connected area to obtain a mean image;

[0147] Sub-step S3262, generating three-dimensional point cloud data corresponding to the mean image;

[0148] Sub-step S3263, fitting the three-dimensional point cloud data to obtain a virtual plane;

[0149] Sub-step S3264, performing inverse mapping on the virtual plane to obtain a depth value gradient image;

[0150] Sub-step S3265, down-sampling the depth value gradient image to generate a target sub-image.

[0151] In a specific implementation, mean filtering can be performed on at least part of the pixels in the area on both sides of the edge, and then the connected area can be mapped to the three-dimensional point cloud and a corresponding virtual plane can be fitted. The virtual plane is then mapped back to the depth map (converted into a continuous gradient of values) to obtain a depth value gradient image. The continuous and value-gradient depth value gradient images are spliced ​​to obtain the target sub-image of the object after the final optimization. Finally, the target sub-image is filled into the original depth map by downsampling. By generating a virtual plane and mapping it back to the depth map, the continuity and consistency of the values ​​of the non-edge texture area of ​​the depth map object can be significantly improved.

[0152] The following is an example to further illustrate the embodiment of the present invention:

[0153] Reference Figure 6 , shows an example flow chart of image processing provided by the present invention, comprising the following steps:

[0154] 601, original grayscale image. The binocular camera outputs an original grayscale image based on the collected image data.

[0155] 602, binocular stereo matching and outputting a depth map. The binocular camera processes the collected image data according to a preset binocular stereo matching algorithm and outputs a depth map.

[0156] 603, fusion edge detection. Perform edge detection on the grayscale image, and fuse pixels in the grayscale image and the depth image based on the detection result to obtain a fused image.

[0157] 604, foreground and background separation. The foreground area and the background area in the depth map are distinguished based on the fused image to achieve foreground and background separation of the depth map.

[0158] 605, foreground optimization. Determine an area of ​​interest from the foreground area, and optimize the resolution of the area of ​​interest, thereby optimizing the foreground area and obtaining a target foreground.

[0159] 606, plane fitting based on the depth map: Perform plane fitting processing on the depth map to obtain at least one fitting plane.

[0160] 607, ground extraction: By performing plane fitting processing on the depth map, a ground surface fitting plane corresponding to the ground in the depth map is generated.

[0161] 608, extracting the building facade: By performing plane fitting processing on the depth map, a portion of the depth map corresponding to the building facade is generated as a fitting plane of the building exterior.

[0162] 609, depth map reconstruction. The target foreground, the background area, the ground surface fitting plane, and the building surface fitting plane are combined to reconstruct the depth map and generate a new depth map.

[0163] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0164] Reference Figure 7 , shows a structural block diagram of an image processing device embodiment of the present invention, which may specifically include the following modules:

[0165] An image acquisition module 701 is used to acquire an original depth map and a grayscale map;

[0166] A fitting plane generating module 702, configured to generate a fitting plane according to the original depth map;

[0167] A fusion module 703, used to generate a fused image based on the original depth map and the grayscale map;

[0168] A foreground area determination module 704, configured to determine a foreground area in the original depth map based on the fitting plane and the fused image;

[0169] A target foreground generation module 705 is used to optimize the resolution of the foreground area to obtain a target foreground;

[0170] The target depth map generating module 706 is configured to generate a target depth map based on the target foreground and the fitting plane.

[0171] In an optional embodiment of the present invention, the fusion module includes:

[0172] An edge detection submodule, configured to perform edge detection on the grayscale image to obtain an edge detection result; the edge detection result includes a first pixel value;

[0173] A second pixel value determination submodule, used to determine a second pixel value corresponding to the position of the first pixel value in the depth map;

[0174] A third pixel value determination submodule, used to fuse the first pixel value and the second pixel value according to a preset linear relationship to obtain a third pixel value;

[0175] The image fusion submodule is used to generate a fused image according to the third pixel value.

[0176] In an optional embodiment of the present invention, the foreground area determination module includes:

[0177] A mask image generation submodule, used to generate a mask image for the fused image; the mask image is composed of fourth pixel values;

[0178] A boundary length determination submodule, used to determine a boundary length corresponding to the fourth pixel value;

[0179] A to-be-differentiated area determination submodule, used to determine at least one to-be-differentiated area in the original depth map except for the position of the fitting plane;

[0180] A depth value determination submodule, used to determine the depth value of the pixel point in the area to be distinguished;

[0181] A foreground reference value submodule, used for obtaining a foreground reference value of the area to be distinguished according to the depth value and the boundary length;

[0182] An edge quantity determination submodule, used to obtain the edge quantity for the original depth map;

[0183] The foreground area determination submodule is used to determine the foreground area based on the foreground reference value and the edge quantity.

[0184] In an optional embodiment of the present invention, the foreground area determination submodule includes:

[0185] A first judgment unit, configured to determine that the area to be distinguished is a foreground area if the foreground reference value of the area to be distinguished is not greater than a first preset threshold and the number of edges corresponding to the area to be distinguished is not less than a first preset number;

[0186] The second judgment unit is used to determine that the area to be distinguished is a background area if the foreground reference value of the area to be distinguished is greater than a first preset threshold and the number of edges corresponding to the area to be distinguished is less than a first preset number.

[0187] In an optional embodiment of the present invention, the target foreground generation module includes:

[0188] A target virtual object recognition submodule, used to recognize the target virtual object in the foreground area by using preset active contour information;

[0189] The target foreground determination submodule is used to optimize the resolution of the target virtual object to obtain the target foreground.

[0190] In an optional embodiment of the present invention, the target foreground determination submodule includes:

[0191] An external sub-image acquisition unit, used to acquire an external sub-image matching the target virtual object in the original depth map;

[0192] An edge mask unit, used for obtaining an edge mask in the grayscale image that matches the circumscribed sub-image;

[0193] An interpolation unit, used for performing interpolation processing on the external sub-image to obtain an interpolated image;

[0194] A superimposing unit, used for superimposing the interpolated image and the edge mask to obtain a superimposed image;

[0195] A filtering image unit, used for performing edge filtering on the superimposed image to obtain a filtered image containing a connected area;

[0196] A target sub-image unit, used for performing depth value restoration processing on the filtered image to obtain a target sub-image;

[0197] The target foreground generating unit is used to generate a target foreground based on the target sub-image.

[0198] In an optional embodiment of the present invention, the target sub-image unit includes:

[0199] A mean subunit, used for performing mean filtering on both sides of the edge of the connected area to obtain a mean image;

[0200] A point cloud data subunit, used to generate three-dimensional point cloud data corresponding to the mean image;

[0201] A virtual plane subunit, used for fitting the three-dimensional point cloud data to obtain a virtual plane;

[0202] A demapping subunit, used for demapping the virtual plane to obtain a depth value gradient image;

[0203] The target sub-image sub-unit is used to perform down-sampling processing on the depth value gradient image to generate a target sub-image.

[0204] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0205] An embodiment of the present invention also provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned image processing method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0206] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned image processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0207] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0208] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0209] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0210] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0211] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0212] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0213] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0214] The image processing method and the image processing device provided by the present invention are introduced in detail above. The principles and implementation methods of the present invention are explained in this article by using specific examples. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. An image processing method, characterized in that: include: Get the original depth map and grayscale image; Generate a fitting plane according to the original depth map; wherein the fitting plane is generated by selecting a target point cloud subset from the three-dimensional point set corresponding to the original depth map, and performing plane fitting on the target point cloud subset, wherein the target point cloud subset is selected by image clustering or region segmentation based on the grayscale image; Generate a fused image based on the original depth map and the grayscale map; Determining a foreground area in the original depth map based on the fitting plane and the fused image; Optimizing the resolution of the foreground area to obtain a target foreground; Based on the target foreground and the fitting plane, generating a target depth map; Wherein, the step of determining the foreground area in the original depth map based on the fitting plane and the fused image comprises: Generate a mask image for the fused image; the mask image is composed of fourth pixel values; Determining a boundary length corresponding to the fourth pixel value; Determine at least one area to be distinguished in the original depth map except the position of the fitting plane; Determine the depth value of the pixel point in the area to be distinguished; Obtaining a foreground reference value of the area to be distinguished according to the depth value and the boundary length; Obtaining the number of edges for the original depth map; A foreground area is determined based on the foreground reference value and the edge quantity.

2. The method according to claim 1, characterized in that The step of generating a fused image based on the original depth map and the grayscale map comprises: Performing edge detection on the grayscale image to obtain an edge detection result; the edge detection result includes a first pixel value; Determining a second pixel value in the depth map corresponding to a position of the first pixel value; Fusing the first pixel value and the second pixel value according to a preset linear relationship to obtain a third pixel value; A fused image is generated for the third pixel value.

3. The method according to claim 1, characterized in that The step of determining the foreground area based on the foreground reference value and the edge quantity comprises: If the foreground reference value of the area to be distinguished is not greater than a first preset threshold and the number of edges corresponding to the area to be distinguished is not less than a first preset number, determining that the area to be distinguished is a foreground area; If the foreground reference value of the area to be distinguished is greater than a first preset threshold and the number of edges corresponding to the area to be distinguished is less than a first preset number, the area to be distinguished is determined to be a background area.

4. The method according to any one of claims 1 to 3, characterized in that: The step of optimizing the resolution of the foreground area to obtain the target foreground includes: Using preset active contour information, identifying a target virtual object in the foreground area; The resolution of the target virtual object is optimized to obtain a target foreground.

5. The method according to claim 4, characterized in that The step of optimizing the resolution of the target virtual object to obtain the target foreground includes: Acquire an external sub-image in the original depth map that matches the target virtual object; Acquire an edge mask in the grayscale image that matches the circumscribed sub-image; Performing interpolation processing on the external sub-image to obtain an interpolated image; superimposing the interpolated image and the edge mask to obtain a superimposed image; Performing edge filtering on the superimposed image to obtain a filtered image containing connected areas; Performing depth value restoration processing on the filtered image to obtain a target sub-image; Based on the target sub-image, a target foreground is generated.

6. The method according to claim 5, characterized in that The step of performing depth value restoration processing on the filtered image to obtain a target sub-image comprises: Performing mean filtering on both sides of the edge of the connected area to obtain a mean image; Generating three-dimensional point cloud data corresponding to the mean image; Fitting the three-dimensional point cloud data to obtain a virtual plane; De-mapping the virtual plane to obtain a depth value gradient image; Down-sampling is performed on the depth value gradient image to generate a target sub-image.

7. An image processing device, characterized in that: include: Image acquisition module, used to obtain original depth map and grayscale image; A fitting plane generation module, used to generate a fitting plane according to the original depth map; wherein the fitting plane is generated by selecting a target point cloud subset from the three-dimensional point set corresponding to the original depth map, and performing plane fitting on the target point cloud subset, wherein the target point cloud subset is selected by image clustering or region segmentation based on the grayscale image; A fusion module, used for generating a fused image based on the original depth map and the grayscale map; a foreground area determination module, configured to determine a foreground area in the original depth map based on the fitting plane and the fused image; A target foreground generation module is used to optimize the resolution of the foreground area to obtain a target foreground; A target depth map generating module, used for generating a target depth map based on the target foreground and the fitting plane; Wherein, the foreground area determination module includes: A mask image generation submodule, used to generate a mask image for the fused image; the mask image is composed of fourth pixel values; A boundary length determination submodule, used to determine a boundary length corresponding to the fourth pixel value; A to-be-differentiated area determination submodule, used to determine at least one to-be-differentiated area in the original depth map except for the position of the fitting plane; A depth value determination submodule, used to determine the depth value of the pixel point in the area to be distinguished; A foreground reference value submodule, used for obtaining a foreground reference value of the area to be distinguished according to the depth value and the boundary length; An edge quantity determination submodule, used to obtain the edge quantity for the original depth map; The foreground area determination submodule is used to determine the foreground area based on the foreground reference value and the edge quantity.

8. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the image processing method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image processing method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Video image depth estimation method based on image segmentation

    CN105069808A

  • Method and device for realizing interactive image segmentation, and terminal

    CN106898002A

  • Single-depth camera depth map real-time enhancement method and device based on neural network

    CN110211061A

  • Depth map portrait edge optimization method and processing device

    CN111553940A

  • Matting method and system based on RGBD camera

    CN111899266A