Video replacement method, system and device based on 3D information and medium

Through deep learning network and 3D camera technology, the proportion and position of the human body and the background are adjusted, solving the problem of unrealistic object proportions and 3D positions in image synthesis, and achieving a more realistic and natural video synthesis effect.

CN118803218APending Publication Date: 2024-10-18SHENZHEN GUANGJIAN TECH CO LTD +2
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310394052.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-13
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

Existing image synthesis technology has problems such as inconsistent proportions of foreground and background objects and unrealistic 3D positions, resulting in unrealistic synthetic images. In addition, there is a lack of connection between multiple frame images in video processing, resulting in unreasonable continuous motion and sudden position changes.

Method used

Use the deep learning network to perform human body recognition on RGB images to obtain the human body range and 3D information. Combined with the background material library collected by the 3D camera, the positional relationship and proportion of the human body and the background are adjusted, and the hair area is adjusted to realize the human body and the background in the video. The background is synthesized more realistically and naturally.

Benefits of technology

The depth information of the synthesized image is increased to make it more consistent with human vision, the 3D information in the background is more accurate, the proportion and positional relationship between the foreground and the background are more realistic, and a more natural fusion effect is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118803218A_ABST
    Figure CN118803218A_ABST
Patent Text Reader

Abstract

The invention discloses a video replacement method based on 3D information. The video replacement method comprises the following steps: S1, acquiring a first frame image in a video; s2, performing human body recognition on the first RGB image by using a deep learning network to obtain a human body range; s3, obtaining 3D information of the human body on the first depth image by using the human body range; s4, a background is obtained from a background material library, and the proper position relation and image proportion of the human body and the background are adjusted by means of the 3D information of the human body and the 3D information of the background; s5, adjusting the hair area according to a second frame image and the background; and S6, performing corresponding processing on the transparency of the human body edge to complete image synthesis. The method can effectively improve the sense of reality of the synthesized video, and is more in line with the scene of the real world.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] The existing image synthesis technology extracts certain objects from the source image, and then synthesizes the extracted objects into the set background image at the original scale. Compared with the traditional reliance on manual image clipping and replacement, the current target detection technology has achieved better results and can detect the target object more accurately. However, the existing image synthesis still has obvious unrealistic feeling, mainly due to the following two reasons:

[0003] 1. The proportions of objects in the foreground and background images are inconsistent;

[0004] 2. The 3D position of the synthesized image is not real.

[0005] The root cause of these problems is that existing synthesis technologies are simple 2D image stitching synthesis, lacking the true 3D information of foreground and background images. 3D cameras provide a feasible solution to these problems.

[0006] Furthermore, in the process of video processing, there is a lack of connection between multiple frames of images, so that in addition to the problems existing in a single image, the video after a single image is replaced is also prone to problems such as unreasonable continuous motion and sudden position changes.

[0007] The disclosure of the above background technology content is only used to assist in understanding the inventive concept and technical solution of the present invention. It does not necessarily belong to the prior art of this patent application. In the absence of clear evidence that the above content has been disclosed on the filing date of this patent application, the above background technology should not be used to evaluate the novelty and creativity of the present application. Summary of the invention

[0008] To this end, the present invention obtains a first frame image in the video, performs human body recognition on the first RGB image through a deep learning network to obtain the human body range, then obtains 3D information of the human body on the first depth image to obtain a background image, and then adjusts the hair area in combination with the background image and the second frame image, so that the synthesized video is more realistic and natural.

[0009] In a first aspect, the present invention provides a video replacement method based on 3D information, characterized in that it comprises the following steps:

[0010] Step S1: Acquire a first frame image in a video; wherein the first frame image includes a first RGB image and a first depth image;

[0011] Step S2: using a deep learning network to perform human body recognition on the first RGB image to obtain a human body range; wherein the human body range includes a hair area;

[0012] Step S3: obtaining 3D information of the human body by using the human body range on the first depth image;

[0013] Step S4: obtaining a background from a background material library, and adjusting a suitable position relationship and image ratio between the human body and the background using the 3D information of the human body and the 3D information of the background; the background in the background material library is acquired by a 3D camera;

[0014] Step S5: adjusting the hair region according to a second frame image and the background; the second frame image is a previous frame image or a plurality of previous frames image of the first frame image;

[0015] Step S6: Perform corresponding processing on the transparency of the human body edge to complete the image synthesis.

[0016] Optionally, the video replacement method based on 3D information is characterized in that step S2 comprises:

[0017] Step S21: using a deep learning network to perform human body recognition on the first RGB image to obtain a first human body range; wherein the first human body range includes a hair area;

[0018] Step S22: expanding n pixels inward or outward at the edge of the first human body range to obtain a second human body range, where n is a positive integer and is related to the brightness difference between the edge pixel point and the adjacent background pixel point;

[0019] Step S23: different first weight values ​​a are assigned to the pixel points in the second human body range in sequence from the inside to the outside according to the direction of their normal lines; wherein the value range of a is [0, 1].

[0020] Optionally, the video replacement method based on 3D information is characterized in that step S4 comprises:

[0021] Step S41: selecting a background from the background material library; Step S42: adjusting the 3D position and deformation angle of the human body according to the 3D information of the human body and the 3D information of the background in the camera coordinate system;

[0022] Step S43: adjusting the size of the human body according to the 3D information of the human body and the 3D information of the background in the camera coordinate system.

[0023] Optionally, the video replacement method based on 3D information is characterized in that step S42 comprises:

[0024] Step S421: determine whether the human body and the background overlap, if yes, execute step S422; if no, execute step S423;

[0025] Step S422: determining the orientation of the human body, and moving the human body to a first preset area according to the orientation;

[0026] Step S423: determining a reference angle between the human body and the background, and rotating and adjusting the deformation angle of the human body according to the reference angle.

[0027] Optionally, the video replacement method based on 3D information is characterized in that step S43 comprises:

[0028] Step S431: According to the position adjustment of the human body in step S42, the size of the human body is proportionally adjusted in the camera coordinate system;

[0029] Step S432: adjusting the position of the human body at the same depth so that the bottom of the human body is partially in contact with the ground or is blocked;

[0030] Step S433: comparing the depth relationship between the human body and the background, and displaying the portion with a smaller depth value.

[0031] Optionally, the video replacement method based on 3D information is characterized in that step S5 comprises:

[0032] Step S51: determining the hair movement trajectory according to the preset information of the background;

[0033] Step S52: determining the hair movement state according to the second frame image;

[0034] Step S53: Adjust the hair area.

[0035] Optionally, the video replacement method based on 3D information is characterized in that step S53 comprises:

[0036] Step S531: Divide the hair area into a fixed area and a moving area according to the hairstyle;

[0037] Step S532: determining the position where the motion area moves;

[0038] Step S533: adjusting the curvature of the motion region according to the overlap between the motion region and the background.

[0039] In a second aspect, the present invention provides a 3D information-based video replacement system, which is used to implement any of the above-mentioned 3D information-based video replacement methods, and is characterized by comprising:

[0040] An image acquisition module, used to acquire a first frame image in a video; wherein the first frame image includes a first RGB image and a first depth image;

[0041] An RGB image module, used to perform human body recognition on the first RGB image using a deep learning network to obtain a human body range; wherein the human body range includes a hair area;

[0042] A depth image module, configured to obtain 3D information of the human body by using the human body range on the first depth image;

[0043] A background adjustment module is used to obtain a background from a background material library, and adjust a suitable position relationship and image ratio between the human body and the background by using the 3D information of the human body and the 3D information of the background; the background in the background material library is acquired by a 3D camera;

[0044] A hair adjustment module, used for adjusting the hair area according to a second frame image and the background; the second frame image is a previous frame image or a plurality of previous frames image of the first frame image;

[0045] The synthesis module is used to perform corresponding processing on the transparency of the edge of the human body to complete the synthesis of the image.

[0046] In a third aspect, the present invention provides a video replacement device based on 3D information, characterized in that it includes:

[0047] processor;

[0048] a memory storing executable instructions of the processor;

[0049] The processor is configured to execute any one of the steps of the above-mentioned video replacement method based on 3D information by executing the executable instructions.

[0050] In a fourth aspect, the present invention provides a computer-readable storage medium for storing a program, wherein when the program is executed, the steps of any one of the aforementioned methods for video replacement based on 3D information are implemented.

[0051] Compared with the prior art, the present invention has the following beneficial effects:

[0052] The present invention uses a 3D camera and a 3D image to process the image, and adds depth information to the synthesized image, which is more in line with human vision and has a more realistic effect.

[0053] The present invention adopts a background material library collected by a 3D camera. Compared with the 3D information obtained on a 2D image through an algorithm, the 3D information in the background is more accurate and real. At the same time, the background image in the background material library can be better synthesized in the camera coordinate system, has better consistency, and can obtain a better synthesized image.

[0054] The present invention adjusts the image ratio and position relationship of the human body and the background, and processes the transparency of the human body edge, so that the size, position and fusion effect of the foreground and background are more realistic, consistent with the scene in the real world, and meet the visual requirements of the human eye.

[0055] The present invention identifies the hair area and adjusts the hair area according to the relationship between different frames, so as to achieve the effect that the hair in the video flutters with the background, so that in the synthesized video, the character and the background are more harmonious and natural. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings in the following descriptions are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work. By reading the detailed description of the non-limiting embodiments with reference to the following drawings, other features, purposes and advantages of the present invention will become more obvious:

[0057] Figure 1 is a flowchart of a video replacement method based on 3D information in an embodiment of the present invention;

[0058] Figure 2 A flowchart of steps for obtaining a human body range in an embodiment of the present invention;

[0059] Figure 3 A human body range map in an embodiment of the present invention;

[0060] Figure 4 This is a schematic diagram of a second human body range weight in an embodiment of the present invention;

[0061] Figure 5 A flowchart of the steps of adjusting the appropriate position relationship and image ratio between the human body and the background in an embodiment of the present invention;

[0062] Figure 6 A flowchart of the steps of adjusting the 3D position and deformation angle in an embodiment of the present invention;

[0063] Figure 7 A flowchart of steps for adjusting the size of a human body according to an embodiment of the present invention;

[0064] Figure 8 This is a flow chart of the steps of adjusting the hair area according to the second frame image and the background in an embodiment of the present invention;

[0065] Fig. 9 This is a flow chart of steps for adjusting a hair area in an embodiment of the present invention;

[0066] Fig.10 A schematic diagram of a process of adjusting a hair area in an embodiment of the present invention;

[0067] Fig.11 A schematic diagram of the structure of a video replacement system based on 3D information in an embodiment of the present invention;

[0068] Fig.12 is a schematic structural diagram of a video replacement device based on 3D information in an embodiment of the present invention; and

[0069] Fig.13 Schematic diagram of the structure of a computer-readable storage medium in an embodiment of the present invention. DETAILED DESCRIPTION

[0070] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements may be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0071] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein, for example, can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0072] The embodiment of the present invention provides a video replacement method based on 3D information, aiming to solve the problems existing in the prior art.

[0073] The following specific embodiments are used to describe in detail the technical solution of the present invention and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.

[0074] The present invention obtains a first frame image in a video, performs human body recognition on the first RGB image through a deep learning network to obtain the human body range, then obtains 3D information of the human body on the first depth image to obtain a background image, and then adjusts the hair area in combination with the background image and the second frame image, so that the synthesized video is more realistic and natural.

[0075] Figure 1 FIG. 1 is a flowchart of a video replacement method based on 3D information in an embodiment of the present invention. Figure 1 As shown, a video replacement method based on 3D information in an embodiment of the present invention includes:

[0076] Step S1: Get the first frame image in the video.

[0077] In this step, the first frame image includes a first RGB image and a first depth image. The video is obtained by a 3D camera. The first RGB image and the first depth image obtained by the 3D camera are pixel-level aligned. Since the first RGB image and the first depth image need to be processed separately in subsequent steps, the first RGB image and the first depth image are obtained separately in this step. The first RGB image is a two-dimensional image obtained by the RGB camera.

[0078] Step S2: Use a deep learning network to perform human body recognition on the first RGB image to obtain a human body range.

[0079] In this step, the depth image is an image composed of depth information. In the prior art, there are various deep learning networks that can recognize RGB images, obtain human body information, and obtain the human body range. The human body range is an area that contains all the details of the human body, such as the face, clothes, hands, hair, etc. The human body range obtained in this step includes the hair area. The hair area identified in this step can be recognized by a separate deep learning network, or it can be learned by the same deep learning network as the human body range.

[0080] Step S3: on the first depth image, using the human body range, obtaining 3D information of the human body.

[0081] In this step, since the first RGB image and the first depth image are aligned at the pixel level, after obtaining the human body range on the first RGB image, the depth information of the human body can be obtained on the first depth image according to the corresponding relationship of pixels, thereby obtaining the 3D information of the human body.

[0082] Step S4: obtaining a background from a background material library, and adjusting a suitable position relationship and image ratio between the human body and the background by using the 3D information of the human body and the 3D information of the background.

[0083] In this step, the background in the background material library is acquired by a 3D camera. A preset background image is acquired at a preset position using a 3D camera. There are multiple preset background images for obtaining various types of background materials. For the same scene, multiple background images at different angles can be obtained. The background image is a 3D image. In the background material library, it can be stored separately in the form of RGB images and depth images, or in the form of RGBD images. The background images are classified and stored in the background material library, such as conference rooms, grasslands, offices, homes, etc. The 3D camera can be the same as the 3D camera in step S1, or it can be different. The parameters of different 3D cameras can be different, such as the camera's FOV, resolution, effective measurement distance, etc.

[0084] The positional relationship is the orientation relationship of the human body relative to the background, for example, the human body is located in the center, left side, right side, top, middle or bottom of the background image. The image ratio is the size of the human body relative to the background. When adjusting the image ratio, it is adjusted according to the change in the depth value of the human body. For example, the depth value of the human body obtained in step S2 is 150, and after adjusting the position of the human body in the background, its depth value is 300. Then, according to the change of the human body in the camera coordinate system, its change is calculated to obtain the enlarged or reduced size of the human body area. This step can make the position and ratio of the human body and the background more scientific and reasonable, and avoid abruptness.

[0085] Step S5: adjusting the hair area according to the second frame image and the background.

[0086] In this step, the second frame image is the previous frame image or the previous multiple frames of the first frame image. The second frame image and the first frame image are images taken at different time points. Different types of backgrounds require different hair fluctuations. For example, the wind on the prairie is strong, and the adjustment range of the hair area is large; while the wind in the city is relatively weak, the adjustment range of the hair area is small. The second frame image shows the previous fluctuation state of the hair, and the hair area adjustment in the first frame image needs to continue to be adjusted on the basis of the second frame image. This step also needs to be adjusted in combination with the time difference between different frames.

[0087] Step S6: Perform corresponding processing on the transparency of the human body edge to complete the image synthesis.

[0088] In this step, the edge of the human body is the edge of the human body area. If the human body is composed of more than two independent areas in the image, the edge of each independent area is processed. When processing the transparency of the edge of the human body, the color difference and depth difference between the human body and the background are considered, and various operations are performed on the transparency of the edge of the human body, such as sharpening, blurring, smoothing, etc. This step takes into account the influence of distance and background light on the edge of the human body, so that the synthesis of the human body and the background is more natural, which has better effects than the simple processing method in the prior art.

[0089] Figure 2 FIG. 1 is a flow chart of steps for obtaining the human body range in an embodiment of the present invention. Figure 2 As shown, a method for obtaining a human body range in an embodiment of the present invention includes:

[0090] Step S21: using a deep learning network to perform human body recognition on the first RGB image to obtain a first human body range.

[0091] In this step, the deep learning network can recognize the complete hair when recognizing the human body. Figure 3 As shown, the human body recognized by the deep learning network includes the whole of all parts of the human body, including hanging hair, torso, etc., but the texture inside the human body is not displayed, and only the area where the human body is located is displayed.

[0092] Step S22: expanding n pixels inward or outward at the edge of the first human body range to obtain a second human body range.

[0093] In this step, the edge of the first human body range can be determined in a variety of ways, such as obtained by the rate of change of the depth value, obtained by the size of the depth value, determined by the speed of color change in the RGB image, etc. Any method that can obtain the first human body range is acceptable. Taking the edge as the starting boundary, expand n pixels inward or outward to obtain the second human body range. n is a positive integer and is related to the brightness difference between the edge pixel point and the adjacent background pixel point, that is, the inward or outward amplitude of different edge positions may be different. The higher the brightness of the edge pixel point and the adjacent background pixel point, the larger the n value; the lower the brightness of the edge pixel point and the adjacent background pixel point, the smaller the n value. In some embodiments, the size of n is also related to the distance d between the edge point in the normal direction of the first human body range and another edge point. The larger the distance d, the larger n; the smaller the distance d, the smaller n.

[0094] Step S23: different first weight values ​​a are assigned to the pixel points in the second human body range in sequence from the inside to the outside according to the normal direction thereof.

[0095] In this step, the value range of a is [0,1]. Figure 4 As shown, each pixel point is given a different first weight value a from inside to outside along its normal direction. The first weight value a can be set in many ways, such as linear change, exponential change, etc.

[0096] In some embodiments, the first weight value Wherein, m is the total number of pixels along the normal direction in the second human body range; n is the sequence number of pixels along the normal direction in the second human body range.

[0097] This embodiment processes the edge of the human body to obtain the second human body range, thereby realizing the recognition of the edge of the human body and its surrounding pixels, and achieving a better fusion effect of the human body and the background through different first weight values.

[0098] Figure 5 FIG. 1 is a flowchart of a step of adjusting the appropriate position relationship and image ratio between the human body and the background in an embodiment of the present invention. Figure 5 As shown, in an embodiment of the present invention, a method for adjusting the appropriate position relationship and image ratio between the human body and the background includes:

[0099] Step S41: Select a background from the background material library.

[0100] In this step, the background is selected according to different types. After obtaining the background image, its type and other related information are also obtained.

[0101] Step S42: adjusting the 3D position and deformation angle of the human body according to the 3D information of the human body and the 3D information of the background in the camera coordinate system.

[0102] In this step, the position and deformation angle of the human body are adjusted in the camera coordinate system. Since the 3D information of the human body and the background image are obtained by the 3D camera, adjusting in the camera coordinate system is the fastest and most efficient way. Since the human body and the background information are information in two images taken at different times and time and space, there may be overlap or partial overlap. Therefore, according to the overlap, the 3D position of the human body is adjusted to make the adjusted image more reasonable. At the same time, since the direction of the human body is not always reasonable in the background image, such as toward the wall, toward an inappropriate object (including animals and people, etc.), the direction of the human body needs to be adjusted, so it is also necessary to adjust the deformation angle accordingly.

[0103] Step S43: adjusting the size of the human body according to the 3D information of the human body and the 3D information of the background in the camera coordinate system.

[0104] In this step, due to the adjustment of the position and deformation angle of the human body, the size of the human body and the background will also be inconsistent. This is due to the principle of large objects when near and small objects when the camera is shooting. When the human body is adjusted, its depth value changes, such as from 150 to 300, and the proportion of the human body in the image will decrease accordingly. Since the camera shooting adopts the pinhole imaging principle, the size change of the human body is not linearly related to the change of the depth value, but presents a tangent function correlation.

[0105] This embodiment adjusts the 3D position, deformation angle and size of the human body according to the matching relationship between the human body and the background and the background characteristics, so that the synthesized image is more realistic, conforms to the characteristics of the three-dimensional world, and has a better synthesis effect.

[0106] Figure 6 FIG. 1 is a flow chart of the steps for adjusting the 3D position and deformation angle in an embodiment of the present invention. Figure 6 As shown, a method for adjusting a 3D position and a deformation angle in an embodiment of the present invention includes:

[0107] Step S421: Determine whether the human body overlaps with the background.

[0108] In this step, if there is overlap, execute step S422; if not, execute step S423.

[0109] Step S422: determining the orientation of the human body, and moving the human body to a first preset area according to the orientation.

[0110] In this step, the first preset area is a preset area in the background where a human body is placed. There may be multiple first preset areas. Different orientations may have different positions. When an object or a human body already exists in the first preset area, the first preset area where an object or a human body already exists is marked as the second preset area, and the first preset area where an object or a human body does not exist is marked as the third preset area. The second preset area and the third preset area are dynamically updated according to the presence of a human body or an object in the first preset area. The human body is moved to the third preset area according to the orientation of the human body.

[0111] Step S423: determining a reference angle between the human body and the background, and rotating and adjusting the deformation angle of the human body according to the reference angle.

[0112] In this step, the first reference of the human body is compared with the second reference in the background to calculate the angle. For example, if the first reference and the second reference are both the ground, the reference angle is obtained by calculating the angle of the ground. According to the angle, the human body is rotated and the deformation angle is adjusted so that the first reference and the second reference coincide. At this time, the reference angle is zero.

[0113] In this embodiment, when there is overlap between the human body and the background, the human body is moved to eliminate the overlap, and then a reference angle is determined for the non-overlapping image, and the human body is rotated and the deformation angle is adjusted to make the human body and the background more consistent and realistic.

[0114] Figure 7 FIG. 1 is a flow chart of steps for adjusting the size of a human body according to an embodiment of the present invention. Figure 7 As shown, a method for adjusting the size of a human body in an embodiment of the present invention includes:

[0115] Step S431: According to the position adjustment of the human body in step S42, the size of the human body is proportionally adjusted in the camera coordinate system.

[0116] In this step, due to the camera's characteristic of "larger near and smaller far", the change in the depth value of the human body will cause the size of the human body on the image to change, so the size of the human body needs to be adjusted proportionally. The proportion in this step is not linearly related, but refers to the adjustment of the human body size in proportion to the change in the depth value.

[0117] Step S432: adjusting the position of the human body at the same depth so that the bottom of the human body is in contact with or blocked from the ground.

[0118] In this step, the human body is adjusted vertically in 3D space so that the bottom of the human body is partially in contact with the ground or blocked. When the human body is fully presented, the feet of the human body are in contact with the ground to obtain a reasonable height relationship between the human body and the background. When the human body is partially blocked and not completely presented in the lens, it is necessary to move the human body at the same depth so that the bottom of the human body is blocked, so that the human body will not appear "broken legs" or "no feet".

[0119] Step S433: comparing the depth relationship between the human body and the background, and displaying the portion with a smaller depth value.

[0120] In this step, when the human body is partially blocked, the depth values ​​of the human body and the background are compared. When the depth value of the human body is small, the human body is completely in the foreground. When the depth value of the human body part is smaller than that of the background, the background part is placed in front of the human body so that the human body is partially blocked.

[0121] This embodiment adjusts the height and occlusion of the human body and the background according to the human body, so that the synthesized image is more realistic and reasonable.

[0122] Figure 8 FIG. 1 is a flow chart of the steps of adjusting the hair area according to the second frame image and the background in an embodiment of the present invention. Figure 8As shown, a method for adjusting the hair area according to the second frame image and the background in an embodiment of the present invention includes:

[0123] Step S51: determining the hair movement trajectory according to the preset information of the background.

[0124] In this step, different hair motion trajectories are preset for different backgrounds. For example, the grassland background is preset with a large hair motion amplitude, while the city background is preset with a small hair motion amplitude. Different motion trajectories are set for different motion amplitudes. The motion trajectory includes parameters such as the angle, position, and maximum amplitude of the hair changing over time. The motion trajectory can be set to a periodic motion, such as a reciprocating motion similar to a pendulum, a circular motion, etc.

[0125] Step S52: determining the hair movement state according to the second frame image.

[0126] In this step, the second frame image is the previous frame or previous frames of the first frame image. According to the hair position, angle and other information of the second frame image, the current motion state of the hair, that is, the position and direction in the motion trajectory can be determined. For reciprocating motion like a pendulum, a position may be in different motion states, that is, it may be left or right. For circular motion, after determining the direction of motion (such as clockwise or counterclockwise), a position has only one motion state. For a motion trajectory with only one state at the same position, the second frame image is the previous frame of the first frame image. For a motion trajectory with two or more states at the same position, the second frame image is at least the previous two frames of the second frame image.

[0127] Step S53: Adjust the hair area.

[0128] In this step, parameters such as the target angle or target position of the first frame image can be determined according to the movement state of the hair. The final position of the hair region is determined according to the shape, length, and target angle or target position of the hair. There are multiple methods for determining the position of the hair region.

[0129] In some embodiments, the hair is divided into small areas according to strands, the endpoints are moved to target positions, and then the overall deformation of the small areas is adapted to the positions of the endpoints.

[0130] In some embodiments, a plurality of key points are set for a hair strand, the key points are moved to a target position, and then other parts of the hair strand are adjusted accordingly, so that the hair strand is natural as a whole.

[0131] This embodiment adjusts the hair area through background information and the second frame image, so that the adjusted hair area can interact with the background. The interaction between the character and the background makes the video more vivid and the synthesized video more realistic.

[0132] Fig. 9 FIG. 1 is a flow chart of steps for adjusting the hair area in an embodiment of the present invention. Fig. 9 As shown, a method for adjusting a hair area in an embodiment of the present invention includes:

[0133] Step S531: Divide the hair area into a fixed area and a moving area according to the hairstyle.

[0134] In this step, the fixed area is the area that remains stationary during adjustment. The moving area is the area that changes position during adjustment. The range of the fixed area and the moving area is not always constant, but changes with different backgrounds. The greater the impact of the background on the character, the larger the moving area, and vice versa. Fig.10 As shown, the fixed area is at the smallest distance from the head, and the moving area is at a larger distance from the head.

[0135] Step S532: Determine the position where the motion area moves.

[0136] In this step, the motion modes of different motion areas are set according to the background, such as a large-scale motion mode corresponding to a grassland background and a small-scale motion mode corresponding to an urban background. The amplitude of the motion area changes corresponding to the motion model. In this step, the generative adversarial network model can be used to learn the motion trajectory of hair under different wind conditions and generate the state of the current motion area at the preset position. Fig.10 As shown, the position of the motion area is different in different frames, for example, moving from position 1 to position 2.

[0137] Step S533: adjusting the curvature of the motion region according to the overlap between the motion region and the background.

[0138] In this step, the position of the moving area obtained in the previous step is judged whether it overlaps with the background. If there is overlap, the depth value of the moving area is adjusted so that the moving area does not overlap with the background. When adjusting the moving area, the position of the overlapping moving area is placed on the surface of the corresponding background, that is, the depth value of the background is assigned to the moving area, and the shape of the moving area is adjusted while keeping the total length of the moving area unchanged.

[0139] This embodiment divides the hair area into a fixed area and a moving area, determines the position of the moving area, and then adjusts possible overlapping situations, so that the movement of the hair is more realistic, the interaction with the background is more efficient, and the synthesis effect is more realistic.

[0140] Fig.11 FIG. 1 is a schematic diagram of a video replacement system based on 3D information in an embodiment of the present invention. Fig.11As shown, a video replacement system based on 3D information in an embodiment of the present invention includes:

[0141] An image acquisition module, used to acquire a first frame image in a video; wherein the first frame image includes a first RGB image and a first depth image;

[0142] An RGB image module, used to perform human body recognition on the first RGB image using a deep learning network to obtain a human body range; wherein the human body range includes a hair area;

[0143] A depth image module, configured to obtain 3D information of the human body by using the human body range on the first depth image;

[0144] A background adjustment module is used to obtain a background from a background material library, and adjust a suitable position relationship and image ratio between the human body and the background by using the 3D information of the human body and the 3D information of the background; the background in the background material library is acquired by a 3D camera;

[0145] A hair adjustment module, used for adjusting the hair area according to a second frame image and the background; the second frame image is a previous frame image or a plurality of previous frames image of the first frame image;

[0146] The synthesis module is used to perform corresponding processing on the transparency of the edge of the human body to complete the synthesis of the image.

[0147] Specifically, the image acquisition module obtains the image in the video, thereby realizing the processing of a single frame image. The RGB image module uses RGB images for human body recognition, and can use existing models for recognition to improve application efficiency. The depth image module uses the characteristics of pixel-level alignment of the first RGB image and the first depth image to obtain 3D information of the human body. The background adjustment module obtains the background from the background material library. When obtaining, it can be manually or automatically selected according to the preset category, and the position relationship and image ratio of the human body and the background can be adjusted. The hair adjustment module processes the most characteristic hair on the human body, so that the hair in the video presents the same characteristics as the background and is better integrated with the background. The synthesis module processes the transparency of the human edge so that the light of the human body and the background is better integrated, and the overall look is more real and natural.

[0148] In this embodiment, a first frame image is obtained in a video, a human body is recognized on the first RGB image through a deep learning network to obtain a human body range, 3D information of the human body is obtained on the first depth image to obtain a background image, and the hair area is adjusted in combination with the background image and the second frame image to make the synthesized video more realistic and natural.

[0149] The embodiment of the present invention further provides a video replacement device based on 3D information, comprising a processor and a memory storing executable instructions of the processor, wherein the processor is configured to execute the steps of a video replacement method based on 3D information by executing the executable instructions.

[0150] As described above, this embodiment obtains a first frame image in a video, performs human body recognition on the first RGB image through a deep learning network to obtain the human body range, then obtains 3D information of the human body on the first depth image to obtain a background image, and then adjusts the hair area in combination with the background image and the second frame image, so that the synthesized video is more realistic and natural.

[0151] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as systems, methods or program products. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits", "modules" or "platforms".

[0152] Fig.12 Schematic diagram of the structure of a video replacement device based on 3D information in an embodiment of the present invention. Fig.12 The electronic device 600 according to this embodiment of the present invention is described. Fig.12 The electronic device 600 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0153] like Fig.12 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.

[0154] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 executes the steps of various exemplary embodiments of the present invention described in the above-mentioned video replacement method based on 3D information of this specification. For example, the processing unit 610 can execute the following steps: Figure 1 Follow the steps shown in .

[0155] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0156] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0157] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0158] The electronic device 600 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device 600, and / or any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 through the bus 630. It should be understood that although Fig.12 Not shown, other hardware and / or software modules may be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.

[0159] In an embodiment of the present invention, a computer-readable storage medium is further provided for storing a program, and when the program is executed, steps of a video replacement method based on 3D information are implemented. In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary implementations of the present invention described in the above-mentioned video replacement method based on 3D information section of this specification.

[0160] As shown above, this embodiment obtains a first frame image in a video, performs human body recognition on the first RGB image through a deep learning network to obtain the human body range, then obtains 3D information of the human body on the first depth image to obtain a background image, and then adjusts the hair area in combination with the background image and the second frame image, so that the synthesized video is more realistic and natural.

[0161] Fig.13Schematic diagram of the structure of a computer-readable storage medium in an embodiment of the present invention. Fig.13 As shown, a program product 800 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0162] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0163] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.

[0164] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0165] In this embodiment, a first frame image is obtained in a video, a human body is recognized on the first RGB image through a deep learning network to obtain a human body range, 3D information of the human body is obtained on the first depth image to obtain a background image, and the hair area is adjusted in combination with the background image and the second frame image to make the synthesized video more realistic and natural.

[0166] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the embodiments can be referred to each other. The above description of the disclosed embodiments enables professionals and technicians in this field to implement or use the present invention. Various modifications to these embodiments will be obvious to professionals and technicians in this field, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown in this article, but will comply with the widest range consistent with the principles and novel features disclosed herein.

[0167] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art may make various modifications or variations within the scope of the claims, which do not affect the essence of the present invention.

Claims

1. A video replacement method based on 3D information, characterized in that: The steps include: Step S1: Acquire a first frame image in a video; wherein the first frame image includes a first RGB image and a first depth image; Step S2: using a deep learning network to perform human body recognition on the first RGB image to obtain a human body range; wherein the human body range includes a hair area; Step S3: obtaining 3D information of the human body using the human body range on the first depth image; Step S4: obtaining a background from a background material library, and adjusting a suitable positional relationship and image ratio between the human body and the background using the 3D information of the human body and the background; wherein the background in the background material library is acquired by a 3D camera; Step S5: adjusting the hair region according to a second frame image and the background; wherein the second frame image is a previous frame image or multiple previous frames of images of the first frame image; Step S6: performing corresponding processing on the transparency of the human body edge to complete the image synthesis.

2. The video replacement method based on 3D information according to claim 1, characterized in that: Step S2 includes: Step S21: using a deep learning network to perform human body recognition on the first RGB image to obtain a first human body range; wherein the first human body range includes a hair area; Step S22: Expand n pixels inward or outward from the edge of the first human body range to obtain a second human body range; n is a positive integer and is related to the brightness difference between the edge pixel and the adjacent background pixel; Step S23: assigning different first weight values ​​a to the pixel points in the second human body range from the inside to the outside according to their normal directions; wherein the value range of a is [0, 1].

3. The video replacement method based on 3D information according to claim 1, characterized in that: Step S4 includes: Step S41: selecting a background from the background material library; Step S42: adjusting the 3D position and deformation angle of the human body according to the 3D information of the human body and the 3D information of the background in the camera coordinate system; Step S43: adjusting the size of the human body according to the 3D information of the human body and the 3D information of the background in the camera coordinate system.

4. The video replacement method based on 3D information according to claim 3, characterized in that: Step S42 includes: Step S421: Determine whether the human body and the background overlap, if so, execute step S422; if not, execute step S423; Step S422: determining the orientation of the human body, and moving the human body to a first preset area according to the orientation; Step S423: determining a reference angle between the human body and the background, and rotating and adjusting the deformation angle of the human body according to the reference angle.

5. The video replacement method based on 3D information according to claim 3, characterized in that: Step S43 includes: Step S431: adjusting the size of the human body in proportion in the camera coordinate system according to the position adjustment of the human body in step S42; Step S432: adjusting the position of the human body at the same depth so that the bottom of the human body is partially in contact with the ground or is blocked; Step S433: comparing the depth relationship between the human body and the background, and displaying the portion with the smaller depth value.

6. The video replacement method based on 3D information according to claim 1, characterized in that: Step S5 includes: Step S51: determining the hair movement trajectory according to the preset information of the background; Step S52: determining the hair movement state according to the second frame image; Step S53: Adjust the hair area.

7. The video replacement method based on 3D information according to claim 6, characterized in that: Step S53 includes: Step S531: Divide the hair area into a fixed area and a moving area according to the hairstyle; Step S532: determining the position of the movement area; Step S533: adjusting the curvature of the motion region according to the overlap between the motion region and the background.

8. A video replacement system based on 3D information, used to implement the video replacement method based on 3D information according to any one of claims 1 to 7, characterized in that: include: An image acquisition module is configured to acquire a first frame of image in a video; wherein the first frame of image includes a first RGB image and a first depth image; An RGB image module, configured to perform human body recognition on the first RGB image using a deep learning network to obtain a human body range; wherein the human body range includes a hair area; a depth image module, configured to obtain 3D information of the human body using the human body range on the first depth image; A background adjustment module is used to obtain a background from a background material library and adjust the appropriate positional relationship and image ratio between the human body and the background using the 3D information of the human body and the background; the background in the background material library is acquired by a 3D camera; a hair adjustment module, configured to adjust the hair region according to a second frame image and the background; the second frame image being a previous frame image or a plurality of previous frames image of the first frame image; The synthesis module is used to perform corresponding processing on the transparency of the human body edge to complete the image synthesis.

9. A video replacement device based on 3D information, characterized in that: include: processor; a memory storing executable instructions for the processor; The processor is configured to execute the steps of the 3D information-based video replacement method according to any one of claims 1 to 7 by executing the executable instructions.

10. A computer-readable storage medium for storing a program, characterized in that: When the program is executed, the steps of the video replacement method based on 3D information according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Image processing method, electronic equipment and storage medium

    CN119478102A