WO2022271085A1 - 一种视频生成方法、装置、设备及介质 - Google Patents

一种视频生成方法、装置、设备及介质 Download PDF

Info

Publication number
WO2022271085A1
WO2022271085A1 PCT/SG2022/050293 SG2022050293W WO2022271085A1 WO 2022271085 A1 WO2022271085 A1 WO 2022271085A1 SG 2022050293 W SG2022050293 W SG 2022050293W WO 2022271085 A1 WO2022271085 A1 WO 2022271085A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
target object
segmented
video
flipping
Prior art date
Application number
PCT/SG2022/050293
Other languages
English (en)
French (fr)
Inventor
莫逸
黄日俊
刘丛笑
高晶
Original Assignee
脸萌有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 脸萌有限公司 filed Critical 脸萌有限公司
Publication of WO2022271085A1 publication Critical patent/WO2022271085A1/zh
Priority to US18/543,969 priority Critical patent/US20240135501A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • G06T13/802D [Two Dimensional] animation, e.g. using sprites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/28Quantising the image, e.g. histogram thresholding for discrimination between background and foreground patterns
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/46Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/103Static body considered as a whole, e.g. static pedestrian or occupant recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20132Image cropping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Definitions

  • the present disclosure provides a video generation method, device, device and medium.
  • An embodiment of the present disclosure provides a video generation method, including: acquiring a background image; acquiring an image to be segmented including a target object; performing image segmentation of the target object on the image to be segmented to obtain a contour image corresponding to the target object; Using the profile image as a foreground image of a target display video; cyclically flipping the background image, and combining the foreground image to generate a target display video.
  • the acquiring the background image includes: acquiring at least the _th_th image input by the user; acquiring in real time the second image captured at the current moment; using the at least one first image and the second image as background image;
  • the cyclic flipping of the background image includes: cyclic flip switching of the at least one first image and the second image.
  • the acquiring the image to be segmented including the target object includes: determining an image including the target object in the first image and/or the second image as the image to be segmented.
  • the cyclically flipping the background image includes: taking the center line of the target object as a flip axis, and cyclically flipping the background image in a horizontal or vertical flipping manner.
  • the displaying the contour image as the foreground image of the target video includes: determining the position of the contour image in the image to be segmented; displaying the target in an area corresponding to the position on the video The image is replaced by the outline image; or, the outline image is overlaid on the target display video as a foreground image.
  • the method further includes: dividing contour images of multiple target objects on the image to be segmented into at least one target object Image composition.
  • the method further includes: switching the corresponding target object image combination whenever the background image is flipped.
  • cyclically flipping the background image includes: using the second image as a cyclically flipped start frame image, starting from the start frame image, displaying in sequence according to a preset presentation sequence, flipping and switching to The corresponding background image; wherein, the display order includes: the input order of the first image, the order of the number of the target objects and/or the spatial arrangement order of the target objects on the second image.
  • the image segmentation of the target object on the image to be segmented includes: determining an area ratio of the target object on the image to be segmented; when the area ratio is less than a preset first When proportioning, a candidate image is intercepted from the image to be segmented, so that the position and area ratio of the target object on the candidate image meet a preset condition; and image segmentation of the target object is performed on the candidate image.
  • the method further includes: during the process of cyclically flipping the background image, the outline image is always displayed in a manner penetrating through the background image.
  • the way of flipping includes: vertical flipping with the horizontal midline of the video shooting interface as the flip axis, horizontal flipping with the vertical midline of the video shooting interface as the flip axis, and/or taking the center point of the video shooting interface as the The circumference of the center of rotation is flipped.
  • the method further includes: during the process of cyclically flipping the background image, the second image and the first image undergo deformation corresponding to the flipping manner.
  • the flipping mode is further: an erasing switching mode, a transparency changing switching mode or a dissolving switching mode.
  • the second image is acquired according to a preset time interval, and the preset time interval is related to a period of cyclic flipping.
  • An embodiment of the present disclosure also provides a video generation device, including: a first acquisition module, configured to acquire a background image; a second acquisition module, configured to acquire an image to be segmented including a target object; an image segmentation module, configured to Carry out image segmentation of the target object on the image to be segmented to obtain a contour image corresponding to the target object; a video generation module is used to use the contour image as the foreground image of the target display video; and is also used to cycle the background image Flip, and combine the foreground image to generate a target display video.
  • An embodiment of the present disclosure also provides an electronic device, and the electronic device includes: a processor; a memory for storing instructions executable by the processor; the processor is used for reading the The instructions can be executed, and the instructions are executed to implement the video generation method provided by the embodiment of the present disclosure.
  • the embodiment of the present disclosure also provides a computer-readable storage medium, the storage medium stores a computer program, and the computer program is used to execute the video generation method provided by the embodiment of the present disclosure. Compared with the prior art, the technical solutions provided by the embodiments of the present disclosure have the following advantages: An embodiment of the present disclosure provides a video generation method, device, device, and medium.
  • the technology includes: first acquiring a background image; acquiring an image to be segmented including a target object; and then performing image segmentation of the target object on the image to be segmented to obtain the target object The corresponding contour image; finally, the contour image is used as the foreground image of the target display video; and the background image is cyclically flipped, and combined with the foreground image to generate the target display video.
  • FIG. 1 is a schematic flowchart of a video generation method provided by an embodiment of the present disclosure
  • FIG. 2 is a schematic diagram of a background image flipping process provided by an embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of a video generation method provided by an embodiment of the present disclosure A schematic diagram of a penetration effect
  • FIG. 4 is a schematic structural diagram of a video generation device provided by an embodiment of the present disclosure
  • FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
  • the solutions of the present disclosure will be further described below. It should be noted that, in the case of no conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other. In the following description, many specific details are set forth in order to fully understand the present disclosure, but the present disclosure can also be implemented in other ways than those described here; obviously, the embodiments in the specification are only a part of the embodiments of the present disclosure, and Not all examples.
  • FIG. 1 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • the method includes: Step 102, acquiring a background image.
  • the user may be currently shooting a video.
  • acquiring a background image may include: acquiring at least one first image input by the user; acquiring a second image captured at the current moment in real time; and using at least the _th_image and the second image as background images.
  • the _th image is an image input by the user according to personal preferences and needs, which can satisfy the pursuit of interesting scenes when shooting videos.
  • the second image is an image in a real scene obtained in real time during video shooting.
  • Step 104 acquire the image to be segmented including the target object.
  • the target object is an object such as a human body, a human face, an animal, or a vehicle.
  • an image including the target object in the first image and/or the second image may be determined as the image to be segmented.
  • Step 106 performing image segmentation of the target object on the image to be segmented to obtain a contour image corresponding to the target object.
  • the key points of the outline of the target object in the image to be segmented are first detected, the outline area of the target object is determined according to the key points of the outline, and then the outline area is clipped from the image to be segmented to obtain the corresponding Contour image.
  • Step 108 using the outline image as the foreground image of the target display video.
  • the contour image As the foreground image. For example: determine the position of the contour image in the image to be segmented; replace the region image corresponding to the position on the target display video with the contour image. During specific implementation, each pixel value of the area image corresponding to the above position on the target display video may be replaced with each corresponding pixel value on the outline image.
  • the profile image is displayed as the foreground image of the target display video.
  • the outline image may be directly overlaid on the target display video as a foreground image.
  • the background image is cyclically flipped, and combined with the foreground image, a target display video is generated.
  • the background image includes at least one first image and a second image.
  • cyclically flipping the background image may include: cyclically flipping at least one first image and the second image. Since the second image is an image in a real scene, in the process of flipping and switching the background image, the second image is usually used as the starting frame image of the loop flip. From this start to flip and switch the _th image, so as to realize the dynamic change of the background image.
  • the method of cyclically flipping the first image and the second image may be, but not limited to: taking the center line of the target object as the flip axis, and cyclically flipping the background image in a horizontal or vertical flipping manner.
  • the target display video can be generated, that is, the content displayed by the target display video includes: displaying the first image and the second image that are cyclically flipped and switched in the background area, and displaying the first image and the second image as the foreground image in the foreground area. Contour image of the image.
  • a contour image corresponding to a target object is obtained based on an image to be segmented, and the contour image is used as a foreground image of the target display video.
  • the background image of the acquired target display video is cyclically flipped, and combined with the foreground image, the target display video is generated.
  • this embodiment provides an implementation method of image segmentation of a target object on an image to be segmented, as follows: Determine the area ratio of the target object on the image to be segmented. When the area ratio is less than the preset
  • the candidate image is intercepted from the image to be segmented, so that the position and area ratio of the target object on the candidate image meet the preset conditions. Then, image segmentation of the target object is performed on the candidate image to obtain a contour image corresponding to the target object.
  • the above preset conditions may specifically include: the proportion of the area of the target object on the candidate image is higher than a preset second proportion, such as higher than 30%, and the position of the target object on the candidate image is within the vertical direction of the candidate image. within a preset offset distance on either side of the straight centerline. When the above preset conditions are satisfied, the target object can occupy a suitable spatial position on the candidate image, and has a strong picture expressive force on the video shooting interface.
  • the resulting profile images are clear, complete and of appropriate size.
  • the contour image is obtained through image segmentation, it is used as the foreground image of the target display video.
  • the background image is cyclically flipped, and combined with the foreground image, a target display video is generated.
  • This embodiment provides several ways to rotate the background image, as shown below.
  • Implementation method 1 when there is a first image and a second image, a preset flip switching mode is used to flip and switch from the second image to the first image.
  • a flipping method using the human body as the flipping axis is provided. Specifically, the image takes the vertical center vertical line of the human body as the axis, and the display background image is flipped perpendicular to the screen.
  • the horizontal flip method Starting from the second image in the video shooting process, use the horizontal flip method to flip the second image until the second image is flipped to 90 degrees perpendicular to the screen, the first image starts from the 90-degree angle, using the same method
  • the horizontal flipping method continues to flip until the flip_cycle reaches the start position of the _th image, switch back to the second image and continue flipping to determine the completion of a flip switching, and so on. It can be understood that, as the video shooting proceeds, the animation of the above-mentioned flip switching is executed in a loop.
  • the frequency of flip switching can be set in advance, such as 0.7 seconds to complete a flip switching; and/or, after each flip switching is completed, the display time of the first image and the second image as the background image can also be preset, such as displaying for 1 second. For example, when the second image captured in real time is used as the background image for display and reaches the preset first time, within the preset second time, the preset flip switching method is used to flip to the first image, The first image is used as the background image for display and the preset third time is reached. The third time may be the same as or different from the first time. As the video is shot, loop the flipping animation of the background image above.
  • Implementation method 2 When there are multiple first images, the background image can be cyclically flipped and switched as follows: The second image is used as the starting frame image which is cyclically flipped. Starting from the starting frame image, the corresponding background images which are flipped and switched to in sequence are displayed according to the preset display order.
  • the presentation sequence includes: the input sequence of the first image.
  • the input _th image includes image A, image B, and image C in sequence.
  • the second image is switched to image A, the image A is switched to image B, the image B is switched to image C, and the image C is switched to Flip transition animation to the second image.
  • Implementation Mode 3 When the image to be segmented includes multiple target objects, in this embodiment, the outline images of the multiple target objects on the image to be segmented are first divided into at least one target object image combination. Each combination of target object images may include at least one profile image of the target object.
  • a manner of cyclically flipping the background image may be: using the second image acquired in real time during video shooting as a starting frame image of cyclic flip switching. Starting from the initial frame image, the corresponding background images that are flipped and switched to are displayed sequentially according to the preset display order, and whenever the background image is flipped, the corresponding combination of target object images is switched.
  • the presentation order includes: the input order of the first image, the order of the number of target objects and/or the spatial arrangement order of the target objects on the image to be segmented.
  • the second image is an image including five target objects.
  • target object image combination (combination for short) A includes the outline image of human body 1
  • combination B includes the respective outline images of human body 2 and human body 3
  • combination C includes the respective outline images of human body 4 and human body 5.
  • the _th image is one
  • the display order is the order of the number of target objects from less to more and the order of the spatial arrangement of the target objects on the second image from left to right.
  • the video capture acquires the second image in real time and displays the second image as a background image
  • all target objects on the second image P1 are currently displayed.
  • the display switches from the second image P1 to the first image.
  • all target objects displayed on the previous background image are switched to combination A, that is, in the target display video with the first image as the background image, the foreground image is the outline image of the human body 1 .
  • switch the combination A shown on the previous background image to combination B or combination C.
  • the switching sequence of the combinations can be determined in combination with the spatial arrangement sequence of the target objects on the second image.
  • the combination A displayed on the previous background image can be switched to combination B, that is, in the target display video with the second image P2 as the background image, the foreground image is the contour image corresponding to the human body 2 and the human body 3 o
  • the display is flipped from the second image P2 to the _th image.
  • Combination B displayed on a background image is switched to combination C, that is, in the target display video with the first image as the background image, the foreground image is the contour image corresponding to the human body 4 and the human body 5.
  • the second image is an image at the current moment acquired in real time as the video is shot. Based on this, the second image can be acquired according to a preset time interval, and the preset time interval is related to a period of cyclic flip switching. For this cycle, in the first implementation above, when switching from the second image to the first image, and continuously displaying the first image as the background image for a preset duration, it is determined as a cycle.
  • the outline image is always displayed in a manner of penetrating the background image.
  • the outline image presents a three-dimensional effect, which can enhance the interesting experience of interaction between the target object and the flipped background image.
  • the flipping method may also include: vertical flipping with the horizontal midline of the video shooting interface as the flipping axis, horizontal flipping with the vertical midline of the video shooting interface as the flipping axis, and/or Circumferential flip with the center point of the video shooting interface as the rotation center.
  • the second image and the first image undergo deformation corresponding to the flipping manner, and the deformation can be referred to as shown in FIG. 2 .
  • the flip switching manner may also be, but not limited to: an erasing switching manner, a transparency changing switching manner, or a dissolving switching manner.
  • Fig. 4 is a schematic structural diagram of a video generation device provided by an embodiment of the present disclosure.
  • the device can be implemented by software and/or hardware, and generally can be integrated in electronic equipment, and can generate interesting videos whose background can be flipped cyclically by executing a video generation method. As shown in FIG.
  • the video generation device includes: a first acquisition module 402, used to acquire a background image; a second acquisition module 404, used to acquire an image to be segmented including a target object; an image segmentation module 406, used to be segmented Carry out the image segmentation of the target object to obtain the contour image corresponding to the target object; the video generation module 408 is used to use the contour image as the foreground image of the target display video; it is also used to cycle the background image and generate the target in combination with the foreground image Show video.
  • the first acquisition module 402 includes: an image input unit, configured to acquire at least one first image input by the user; an image capture unit, configured to acquire in real time the second image captured at the current moment; a background determination unit , for using at least one first image and second image as a background image; correspondingly, the above-mentioned video generating module 408 is used for: performing cyclic flip switching of at least _th_image and second image.
  • the second acquiring module 404 is configured to: determine an image including the target object in the first image and/or the second image as the image to be segmented.
  • the above-mentioned video generation module 408 is configured to: take the center line of the target object as the flip axis, and flip the background image cyclically in a horizontal flip or vertical flip manner. In some embodiments, the above-mentioned video generation module 408 is used to: determine the position of the contour image in the image to be segmented; replace the region image corresponding to the position on the target display video with the contour image; or use the contour image as the foreground image Overlay on target display video.
  • the video generation device when the image to be segmented is an image comprising a plurality of target objects, the video generation device further includes: a combination and division module, configured to divide the contour images of the plurality of target objects on the image to be segmented into at least one target Object image composition. In some embodiments, when there are multiple target object image combinations, the video generating device further includes: a combination switching module, configured to switch the corresponding target object image combination whenever the background image is flipped. In some embodiments, the above-mentioned video generation module 408 is further configured to: use the second image as the start frame image that is cyclically flipped, and start from the start frame image to display the corresponding images that are flipped and switched to in sequence according to a preset presentation order.
  • the presentation order includes: the input order of the first image, the order of the number of target objects and/or the spatial arrangement order of the target objects on the second image.
  • the image segmentation module 406 is configured to: determine the area ratio of the target object on the image to be segmented; when the area ratio is less than a preset first ratio, intercept a candidate image from the image to be segmented, so that The position and area ratio of the target object on the candidate image satisfy a preset condition; performing image segmentation of the target object on the candidate image.
  • the video generating device further includes: a through-display module, configured to display the outline image in a way that penetrates the background image during the process of cyclically flipping the background image.
  • the video generating device further includes: a deformation module, configured to deform the second image and the first image corresponding to the flipping manner during the process of cyclically flipping the background image.
  • the video generation device provided by the embodiments of the present disclosure can execute the video generation method provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method.
  • FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. As shown in FIG. 5 , an electronic device 500 includes one or more processors 501 and a memory 502 .
  • the processor 501 may be a central processing unit (CPU) or other forms of processing units with data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device 500 to perform desired functions.
  • Memory 502 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory.
  • the volatile memory may include, for example, a random access memory (RAM) and/or a cache memory (cache).
  • the non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, and the like.
  • One or more computer program instructions can be stored on the computer-readable storage medium, and the processor 501 can execute the program instructions to realize the video generation method of the above-mentioned embodiments of the present disclosure and/or other desired function.
  • Various contents such as input signal, signal component, and noise component can also be stored in the computer-readable storage medium.
  • the electronic device 500 may further include: an input device 503 and an output device
  • the input device 503 may also include, for example, a keyboard, a mouse, and the like.
  • the output device 504 can output various information to the outside, including determined distance information, direction information, and the like.
  • the output device 504 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.
  • the electronic device 500 may further include any other appropriate components.
  • the embodiments of the present disclosure may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the video generation described in the embodiments of the present disclosure.
  • the computer program product can be written in any combination of one or more programming languages for executing the program codes for the operations of the embodiments of the present disclosure, and the programming languages include object-oriented programming languages, such as Java, C++, etc. , which also includes the regular procedural programming language language, such as "C" or a similar programming language.
  • the program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server to execute.
  • the embodiments of the present disclosure may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the video generation provided by the embodiments of the present disclosure. method.
  • the computer readable storage medium may employ 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 include, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: electrical connection with one or more conductors, portable disk, hard disk, random access memory (RAM X read only memory (ROM X erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • Embodiments of the present disclosure also provide a computer Program products, including computer programs/instructions, when the computer programs/instructions are executed by a processor, the methods in the embodiments of the present disclosure are implemented.

Landscapes

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

Abstract

本申请公开了一种视频生成方法、装置、设备及介质,其中该方法包括:获取背景图像;获取包括目标对象的待分割图像;对待分割图像进行目标对象的图像分割,得到目标对象对应的轮廓图像;将轮廓图像作为目标显示视频的前景图像;将背景图像进行循环翻转,并结合所述前景图像生成目标显示视频。本公开能够增加视频拍摄的趣味性。

Description

一种视 频生成 方法、 装匯、 设备及介质 本 申请要 求于 2021年 6月 24日提 交中 国国家 知识产 权局、 申请号为 2021 107041 10.6、 发明名称为“ _种视频生 成方法 、 装置、 设备及介质” 的 中 国专利 申请的优 先权 ,其全 部内容 通过 引用结合 在本 申请中 。 技术 领域 本 发明属 于视频处理 技术领域 ,具体涉及一种 视频生成 方法、 装置、 设备 及介 质。 背景 技术 随着 视频处理技 术的发 展 ,普通的视频已经无法 满足人们 对内容 的获取需 求 ,充满新奇玩法 的视频逐 渐吸引 了人们的 注意力。目前 ,用户在拍摄 视频时 , 通常 只能显示 用户当 前所处的 真实场景 ,这在很大程度 上限制 了视频的 特效玩 法 ,不能满足 用户对视 频的趣 味性追求 。 发明 内容 为 了解决 上述技 术问题 或者 至少部 分地解 决上 述技术 问题 ,本公开 提 供 了一种视 频生成 方法 、 装置、 设备及介质 。 本 公开实 施例提 供了一 种视频 生成方 法 ,包括 : 获取 背景 图像 ; 获取 包括 目标对 象的待 分割图 像 ; 对所 述待 分割 图像进行 目标 对象的 图像分 割 ,得到所述目标 对象对 应 的轮 廓图像 ; 将 所述轮 廓图像 作为 目标显示 视频的 前景图 像 ; 将 所述背 景图像 进行循 环翻 转 ,并结合所述前 景图像 生成 目标显示 视 频。 可 选的 ,所述获取背景 图像 ,包括 : 获取 用户 输入的 至少 _张 第 _图像 ; 实 时获取 当前时 刻拍摄 得到的 第二图 像 ; 将 所述至 少一张 第一图 像和所 述第 二图像 作为背 景图像 ; 所 述将所 述背景 图像 进行循 环翻转 ,包括 :将所述至少一张 第一 图像 和所 述第 二图像 进行循 环翻转 切换。 可 选的 ,所述获取包括 目标对 象的待 分割 图像 ,包括 : 将 所述 第一图 像和 /或所述 第二图 像中 包括 目标对 象的 图像确 定为 待 分割 图像 。 可 选的 ,所述将所述背 景图像 进行循 环翻转 ,包括 : 以 所述 目标对象 的中心 线为 翻转轴 ,按照水平 翻转或 者垂直 翻转的 方 式将 所述 背景图 像进行 循环翻 转。 可 选的 ,所述将所述轮 廓图像 作为 目标显示 视频的 前景 图像 ,包括 : 确 定所述 轮廓 图像在所 述待 分割图 像中 的位置 ;将所 述目标 显示 视频 上与 所述 位置对 应的区 域图像 替换为 所述轮 廓图像 ; 或 者 ,将所述轮 廓图像 作为前 景图像 覆盖 在所述 目标显 示视频 上。 可 选的 , 当所述待分割图像 为包括 多个所 述 目标对象 的图像 时 ,所述 方法 还包括 : 将 所述待 分割 图像上 多个所 述目标 对象 的轮廓 图像划 分为至 少一个 目 标对 象图像 组合。 可 选的 , 当所述目标对象图像 组合为 多种时 ,所述 方法还 包括 : 每 当所述 背景图 像进行 翻转时 ,切换 对应的 目标对 象图像 组合。 可 选的 ,将所述背景图 像进行 循环翻 转 ,包括: 将 所述 第二 图像作 为循 环翻转 的起 始帧 图像 ,从所述起 始帧 图像开 始 ,按照 预设的 展示顺 序展 示依次 翻转切 换到 的对应 的背景 图像 ;其中 , 所述 展示 顺序包 括 :所述第 一图像 的输入 顺序 、 所述目标对 象的数 量的顺 序和 /或所述目标对象 在所 述第二 图像上 的空 间排列顺 序。 可 选的 ,所述对所述待 分割 图像进行 目标对 象的 图像分 割 ,包括: 确 定所述 目标对 象在所 述待分 割图像 上的 面积 占比 ; 当 所述面 积占比 小于 预设的 第一 占比时 ,从所述待分 割图像 上截 取候 选 图像 ,使得所 述目标 对象在 所述 候选图 像上的 位置 和面积 占比满 足预设 条件 ; 对所 述候 选图像 进行 目标对象 的图像 分割。 可选 的 ,所述方法还包 括 : 在 将所述 背景 图像进行 循环 翻转的 过程 中 ,所述轮廓图像始 终采用 穿 透所 述背 景图像 的方式 进行展 示。 可 选的 ,所述翻转的方 式包 括 :以视频拍 摄界 面的横 向中线 为翻转 轴 的垂 直翻 转、 以视频拍摄 界面 的竖直 中线为翻 转轴 的水平 翻转和 /或以视频 拍摄 界面 的中心 点为旋 转中心 的圆周 翻转。 可选 的 ,所述方法还包 括 : 在 将所述 背景 图像进行 循环 翻转过 程中 ,所述第二图 像和所 述第 一图 像发 生与所 述翻 转的方 式对应 的形变 。 可 选的 ,所述翻转的方 式还 为 :擦除切换方式 、 透明度变化 切换方 式 或溶 解切换 方式 。 可 选的 ,所述第二图像 根据 预设时 间间隔 进行获 取 ,所述预 设时间 间 隔与 循环翻 转的周 期有 关。 本 公开实施 例还 提供了 一种视 频生成 装置 ,包括 : 第 一获取 模块 ,用于获 取背景 图像 ; 第 二获取 模块 ,用于获 取包括 目标对 象的待 分割 图像 ; 图像 分割 模块 ,用于对 所述 待分割 图像进 行目标 对象 的图像 分割 ,得 到所 述目标 对象对 应的轮 廓图像 ; 视频 生成 模块 ,用于将 所述 轮廓图 像作为 目标显 示视频 的前 景图像 ; 还用 于将所 述背 景图像 进行循 环翻 转 ,并结合所述前景 图像 生成 目标显示 视频 。 本 公开实 施例还 提供 了一种 电子设备 ,所述电子 设备包 括 :处理器 ; 用 于存储所 述处 理器可 执行指 令的 存储器 ;所述 处理 器 ,用于从所 述存 储 器 中读取所 述可 执行指 令 ,并执行 所述指 令以 实现如本 公开 实施例 提供 的 视频 生成方 法。 本 公开实 施例还 提供 了一种 计算机 可读存 储介质 ,所述存储 介质存 储 有 计算机程 序 ,所述计算机程 序用 于执行 如本公 开实施 例提 供的视 频生成 方法 。 本 公开实施 例提 供的技 术方案 与现有 技术相 比具 有如下 优点 : 本 公开实 施例提 供的 一种视 频生成 方法、 装置、 设备及介质 ,该技术 包括 : 首先获取背景 图像 ;获取包 括目标 对象的 待分 割图像 ;然后 对待分 割 图像进行 目标 对象的 图像分 割 ,得到目标对象 对应的 轮廓 图像 ;最后将 轮廓 图像作 为目标 显示 视频的 前景图 像 ; 以及将背景图 像进行 循环翻 转 , 并结 合前景 图像生 成 目标显示 视频。 通 过上述 方案 ,用户在 日常 拍摄视 频的过 程中 , 可以实现目标对象 与 用户 需求 的背景 图像相 结合 。 同时 ,通过循环翻 转背景 图像 为用户 带来场 景动 态变化 的特 效玩法 ,使用 户能够 代入 并沉浸 在场景 中 ,增加了视频拍 摄的 趣味性 。 附图 说明 附 图用来 提供对 本发 明的进 _步理解 ,并 且构成 说明书 的 _部分 , 与 本发 明实施 例一起 用于 解释本 发明 ,并不构成对本发 明的 限制。 在附图 中 : 图 1为本公 开实施 例提供 的一种 视频生 成方 法的流 程示意 图 ; 图 2为本公 开实施 例提供 的一种 背景 图像翻 转过程 的示意 图 ; 图 3为本公 开实施 例提供 的一种 穿透效 果的 示意图 ; 图 4为本公 开实施 例提供 的一种 视频生 成装 置的结 构示意 图 ; 图 5为本公 开实施 例提供 的_ 种 电子设备 的结构 示意 图。 具体 实施方 式 为 了能够 更清楚 地理解 本公 开的上 述目 的、 特征和优 点 , 下面将对本 公开 的方 案进行 进一步 描述 。 需要说明的 是 ,在不冲 突的情 况下 ,本公开 的实 施例及 实施例 中的 特征可 以相互 组合 。 在 下面的 描述 中阐述 了很多 具体细 节以便 于充 分理解 本公开 ,但本公 开还 可以采 用其 他不同 于在此 描述 的方式 来实施 ;显然 ,说明书 中的实施 例只 是本 公开的 一部分 实施例 , 而不是全部的实施 例。 图 1 为本公开实 施例提 供的 一种视频 生成方 法的 流程示 意图 ,该方法 可以 由视频 生成装 置执 行。 其中 ,该装置可以采用 软件和 /或硬件实现 , 一 般 可集成 在电子 设备中 。 如图 1所示 ,该方 法包括 : 步骤 102 ,获取背景图像 。 在 实际应用 中 ,用户当前可 能正在 拍摄视 频过程 中。 本实施 例获取 背 景 图像 , 可以包括 : 获取 用户 输入的 至少 一张第 一图像 ; 实时获取当 前时刻 拍摄 得到的 第 二 图像 ;将至少 _张第 _图像和 第二图 像作为 背景 图像。 其中 ,第_图像 是用 户根据 个人 喜好、 需求输入的 图像 , 能够满足拍 摄视频 时对场景 趣味 性 的追求 。 第二图像是 在视频 拍摄过 程中实 时得到 的真实 场景下 的图像 。 步骤 104 ,获取包括 目标对 象的待 分割 图像。 其中 , 目标对象诸如为 人体 、 人脸、 动物或车 辆等对 象。 待分割 图像包 括的 目标对 象可以 为一个 或者 多个 。 本实施例可 以将第 _图像和 /或第二图像中包 括目标 对象 的图像 确定 为待分 割图像 。 步骤 106 ,对待分割 图像进 行目标 对象 的图像 分割 ,得到目标对象 对 应的 轮廓 图像。 在 本实施 例中 , 首先检测待分割图 像中 目标对象 的轮廓 的关 键点 ,根 据轮 廓的关 键点 确定 目标对象 的轮廓 区域 ,再从 待分割 图像 上对该 轮廓区 域进 行剪裁 ,得到目标 对象对 应的轮 廓图像 。 步骤 108 ,将轮廓图像作 为目标 显示 视频的 前景图像 。 将 轮廓图 像作为 前景 图像的 方式可 以有多 种。 例如 :确定轮廓图像 在 待分 割图像 中的 位置 ;将目标 显示 视频上 与该位 置对应 的区域 图像 替换为 轮廓 图像 。 在具体实现 时 , 可以将目标显示视频 上与上 述位 置对应 的区域 图像 的各个 像素 值 ,替换为轮 廓图像 上相 应的各 个像素 值。 从而在 目标显 示视 频的展 示界 面上 ,将轮廓图像作 为目标 显示视 频的 前景图 像进行 展示。 或 者 ,与上述方 式类似 ,还可以确 定待 分割图 像上除 轮廓 图像之外 的 第_ 区域图 像 , 以及确定目标 显示视 频上与 该第 _区域图像 位置 相同 的第 二 区域图像 。 然后将待 分割 图像上 的第 _区域图 像替换 为第二 区域 图像 , 由此 将轮廓 图像作 为目标 显示视 频的 前景图 像。 或 者 ,在另一种 实现方 式中 , 可以直接将轮廓 图像作 为前景 图像覆 盖 在 目标显示 视频上 。 步骤 1 10 ,将背景 图像进行 循环 翻转 ,并结合前景图 像生成 目标显 示 视频 。 背 景图像 包括至 少一 张第一 图像和 第二 图像。 基于此,将背 景图像 进 行循 环翻转 可以包 括 :将至少一张 第一图 像和第 二图像 进行循 环翻转 切换。 由 于第二 图像为 真实场 景下 的图像 , 因此 ,在翻转切换背景 图像的 过 程 中 ,通常将第二图像 作为循 环翻 转的起 始帧图 像。 由此开始翻转 切换第 _ 图像 ,从而实现 背景图 像的动 态变化 。 第_ 图像和 第二 图像进 行循环 翻 转切 换的方 式可 以为但 不限 于 : 以目标对象的中心线 为翻转 轴 ,按照水平 翻转 或者 垂直翻 转的方 式将 背景图 像进行 循环翻 转。 具体的 , 当以目标对 象 的横向 中心线 为翻转 轴时 ,对应于垂直 翻转。 当以目标对象 的竖 直中心 线为 翻转轴 时 ,对应于水 平翻转 。 基 于上述 前景 图像 和该 循环翻 转的 背景 图像 , 可以生成目标 显示视 频 , 也即目标显 示视频 展示的 内容包 括 :在背景 区域 展示循 环翻转 切换的 第_ 图像和 第二图 像 ,在前景 区域展 示作为 前景图像 的轮 廓图像 。 本 公开实 施例提 供的 一种视 频生成 方法 ,基于待 分割 图像得 到目标 对 象对 应的轮 廓图像 ,将轮廓图 像作 为目标显 示视 频的前 景图像 。 将获取的 目标 显示视 频的 背景图 像进行 循环翻 转 , 并结合前景图像生成 目标显 示视 频。 通过上述方 案 ,用户在 日常拍 摄视频 的过程 中 , 可以实现目标对象与 用户 需求 的背景 图像相 结合 。 同时 ,通过循环翻 转背景 图像 为用户 带来场 景动 态变化 的特 效玩法 ,使用 户能够 代入 并沉浸 在场景 中 ,增加了视频拍 摄的 趣味性 。 考 虑到实 际拍摄 中 , 可能会由于拍摄距离 较远或 者拍 摄角度 较偏 , 而 导致 目标对 象在 待分割 图像上 表现 为一个 很小的 目标 ,或者 在待分 割图像 上处 于极偏 的空 间位置 。 在此情况 下 ,通过图像分割 得到的 轮廓 图像会 不 清楚 。 针对于此 ,本实施例提 供一 种对待 分割图 像进行 目标对 象的 图像分 割 的实现方 法 ,参照如 下所示 : 确 定目标 对象在 待分割 图像 上的面 积占比 。 当面积 占比小于 预设 的第
_ 占比 时 ,从待分割图像 上截 取候选 图像 ,使得 目标对 象在候 选图像 上的 位 置和面 积占比 满足预 设条件 。 而后再对 候选图 像进行 目标对 象的 图像分 割 ,以得 到目标 对象对 应的轮廓 图像 。 上 述预设 条件具 体可 以包括 : 目标对象在候选 图像上 的面积 占比 高于 预设 的第 二占比 ,比如 高于 30% ,以及, 目标对象在 候选 图像上 的位置 为 在候 选图像 的竖 直中心 线两侧 的预设 偏离 距离之 内。 当满足上述预 设条件 时 , 目标对象能够在候 选图像 上占据 合适 的空间 位置 ,在视 频拍摄 界面上 具有 较强 的画面 表现力 。 由此得到 的轮廓 图像能 够清 楚、 完整且尺 寸大 小 合适 。 通 过图像 分割得 到轮廓 图像 后 ,将其作为 目标显 示视 频的前 景图像 。 以及 ,将背景图 像进行 循环翻 转 ,并结合前 景图像 生成 目标显 示视频 。 本 实施例 提供几 种将背 景图像 进行循 环翻转 的方 式 ,参照如下 所示。 实现 方式 一 , 当有一张第一图像和 一张第 二图像 时 ,采用预设的翻 转 切换 方式 ,从第 二图像 翻转切 换至第 一图像 。 如图 2所 示 ,提供了 一种以 人体 为翻 转轴的 翻转方 式 ,具体为图像以 人体纵 向中心 垂线 为轴 ,显示背 景 图像垂 直于屏 幕进行 翻转 的方式 。 从视频拍摄 过程 中的第 二图像 开始 , 采用 该水 平翻转 的方式 对第 二图像 进行翻 转 , 直至第二图像翻转至 垂直于 屏幕 90度 时 ,第一图像从该 90度的角 度开始 ,采用 同样 的水平 翻转方 式 继续 进行翻 转 , 直至翻转_周至 第 _图 像开始 位置 时 ,切换回第二图像 继 续翻 转 ,以确定完成一 次翻转 切换 ,如此循 环。 可 以理解 , 随着视频 拍摄的 进行 , 上述翻转切换 的动 画循环 执行。 翻 转切 换的频 次可以 预先设 置 ,比如 0.7秒完成一 次翻转 切换 ;和 /或,每一 次 翻转切 换完成 后 ,第_ 图像 和第二 图像作 为背 景图像 的展示 时间也 可以 预先 设置 ,比如 展示 1 秒。 具体的示例如 , 当以实时拍摄的第 二图像 为背 景 图像进 行展示 并达到 预设 的第一 时间后 ,在预设的第 二时 间内 ,采用预 设 的翻转切 换方 式翻转 至第 一图像 ,以第 一图像 为背景 图像 进行展 示并达 到预 设的 第三时 间。 该第三时 间可以 与第 一时间 相同或 不同 。 随着视频的 拍摄 ,循环上述 背景图 像的翻 转切换 的动画 。 实现 方式 二 : 当第一图像为多张时 , 可以按照如下方 式将背 景图像 进 行循 环翻转 切换 : 将 第二图 像作为 循环翻 转的起 始帧 图像 ,从起始 帧图像 开始 ,按照预 设的 展示顺 序展 示依次 翻转切 换到 的对应 的背景 图像。 其中 ,展示顺序包 括 :第一 图像的 输入顺 序。 在_ 种具体 示例中 ,假设输入 的第_ 图像 依次 包括图 像 A、 图像 B和 图像 C。 那么 ,从视频拍摄过 程中实 时得到 的第 二图像开 始 ,展示由 第二 图像 翻转切 换到 图像 A、 由图像 A翻转切 换到 图像 B、 由图像 B翻转 切换 到 图像 C ,以及由图像 C翻 转切换 到第 二图像 的翻转切 换动 画。 实现 方式 三 : 当待分割图像为包括 多个 目标对象 的图像 时 ,本实施例 首 先将待 分割图 像上多 个目标 对象 的轮廓 图像划 分为至 少一 个目标 对象图 像组 合。 各目标对象图 像组合 中可 以包括 至少_ 个 目标对 象的 轮廓图 像。 将背 景图像 进行 循环翻 转的方 式可 以为 :将视频拍摄过 程中实 时获取 的第 二 图像作 为循环 翻转切 换的起 始帧 图像。 从起始 帧图像 开始 ,按照预设的 展 示顺序 展示依 次翻转 切换到 的对 应的背 景图像 ,且每当背 景图像 进行翻 转时 ,切换对应 的目标对 象图 像组合 。 其中 ,展示顺序包括 :第一图像的 输入 顺序、 目标对象的数 量的顺 序和 /或目标对象 在待 分割图 像上的 空间排 列顺 序。 在 一种具 体示例 中 ,假设在对以五 个人体 为目标 对象 的视频 拍摄场 景 中 ,第二图像 为包括 五个 目标对 象的图 像。相应 地 , 目标对象图像组合 (简 称组 合 ) A包括人体 1 的轮廓图像 ,组合 B包 括人体 2、 人体 3各 自的轮 廓 图像 ,组合 C包括人 体 4和人体 5各自的 轮廓图 像。 第_ 图像为 一张 , 以及 ,展示顺序 为目标 对象 的数量 由少到 多的顺 序和 目标对 象在第 二图像 上 的空间排 列由 左到右 的顺序 。 在 此情况 下 , 当视频拍摄实时获取 到第二 图像并 将第 二图像 作为背 景 图像 展示 时,当前展 示的是 第二 图像 P1上的全 部目标 对象 。从该第 二图像 P1 开始 ,展示由第 二图像 P1翻 转切换 到第一 图像。 与此同时 ,将上一个 背景 图像 上展示 的全部 目标对 象切换 为组合 A , 也即在以第一图 像为背 景 图像 的目标 显示视 频中 , 前景图像是人体 1的轮廓 图像。 接 下来 ,展示由第 一图像 翻转 切换到 实时获取 的第 二图像 P2。 与此同 时 ,将上 一个背景 图像 上展示 的组合 A切换 为组合 B或者 组合 C。 考虑到 组合 B和 组合 C对应的 目标对 象的数 量相 同 ,基于此,可以结合 目标对 象 在 第二图 像上的 空间排 列顺序 确定 组合的 切换顺 序。 在本示例中 , 可以将 上 一个背 景图像 上展示 的组合 A切 换为组 合 B , 也即在以第二图 像 P2为 背景 图像 的目标 显示视频 中 ,前景图像是人 体 2和人体 3对应的 轮廓图像 o 再 接下来 ,展示 由第二 图像 P2翻转切 换到第 _图像 。与此同 时 ,将上
— 个背 景图 像上展 示的组 合 B切换为 组合 C , 也即在以第一 图像为背 景图 像 的目标显 示视频 中 , 前景图像是人体 4和 人体 5对应的轮 廓图像 。 在 以上多 种实现 方式 中 ,第二图像是随着 视频 拍摄 ,实时获 取的当 前 时刻 的图像 。 基于此 ,第二 图像可 以根据 预设 时间间 隔进行获 取 ,预设时 间 间隔与循 环翻 转切换 的周期 有关 。 针对该周期 ,在上述实现 方式 一中 , 从 第二图 像翻转 切换至 第一 图像 ,且将第 一图像 作为 背景图 像持续 展示至 预设 时长 时 ,确定为 _个 周期。 在上述实现 方式二 中 ,从第二图像依 次翻 转切 换至 各第一 图像 ,且将展 示顺 序为最 后的第 一图像 作为 背景图 像持续 展 示至预 设时长 时 ,确定为 _个周期 。 在上述实现 方式 三中 ,从前景为全 部 目标对 象的第 二图像 开始翻 转切换 ,每当第二 图像与 第一 图像循 环翻转 切换 时均 同时切 换组合 , 直至切换至 最后_ 个组合 时 ,相对应的背景 图像 持续 展示至 预设 时长时 ,确定 为 _个周 期。 可 以理解 , 以上仅为 将背景 图像进 行循环 翻转 的几种 示例性 描述 ,在 实际 应用 中可以有 更多 种翻转 切换的 实施例 ,对此不应理 解为 限制。 在 以上任 意一种 将背景 图像进 行循环 翻转 的过程 中 ,如图 3所示 ,轮 廓 图像始 终采用 穿透背 景图像 的方 式进行 展示 。 通过采用穿 透背景 图像 的 方 式展示 轮廓图 像 ,令轮廓 图像呈 现立体 效果 , 能够增强 目标对象 与翻转 切换 的背景 图像 之间进行 交互 的趣味 性体验 。 在 以上将 背景 图像进 行循环 翻转的 过程 中 ,翻转的方式还可 以包括 : 以视 频拍 摄界面 的横 向中线 为翻转轴 的垂 直翻转 、 以视频拍摄 界面 的竖直 中线 为翻 转轴 的水平 翻转 和 /或以视频拍 摄界面 的中 心点 为旋转 中心 的圆 周 翻转。 相应的 ,在将背景 图像进 行循环 翻转过 程中 ,第二图像和 第一 图 像发 生与 翻转的 方式对 应的形 变 ,该形变可 参照图 2所示 。 此 外 ,在其他实 现方 式中 , 翻转切换的方式还 可以为 但不限 于 :擦除 切换 方式 、 透明度变化 切换方 式或溶 解切换 方式 。 综 上 , 上述公开实施例 提供 的视频 生成方 法 ,在用户 日常拍 摄视频 的 过程 中 , 可以实现目标对象与 用户 需求的 背景图 像相结 合。 同时 ,通过循 环翻 转背景 图像 为用户 带来场 景动态 变化的 特效 玩法 ,使用户 能够代 入并 沉浸 在场 景中。 以及,在背 景图像 循环翻 转过程 中 ,通过切换用户 输入的 第 一图像 和实时 拍摄的 第二 图像 ,将该第 一图像 和第 二图像作 为翻 转切换 的不 同的 背景图 像 , 为用户营造场景 切换 或场景 穿越 的特效 玩法 ,以上 明 显增 加了视 频拍摄 的趣 味性。 图 4为本 公开实 施例提 供的 一种视频 生成装 置的 结构示 意图。 该装置 可 由软件和 /或硬件实现 , 一般可集成在 电子设 备中 , 可通过执行视频生成 方法 来生 成背景 可以循 环翻转 的趣味 性视频 。 如图 4所 示 ,该视频生 成装 置包 括 : 第 一获取 模块 402 ,用于获取 背景图 像 ; 第 二获取 模块 404 ,用于获取 包括 目标对象 的待分 割图像 ; 图像 分割 模块 406 ,用于对 待分 割图像 进行 目标对象 的图像 分割 ,得 到 目标对象 对应的 轮廓 图像 ; 视频 生成模 块 408 ,用于将 轮廓 图像作 为目标 显示视 频的前 景图像 ; 还用 于将背 景图像 进行循 环翻 转 ,并结合前 景图像 生成 目标显示 视频。 在 一些实 施例中 ,第一获取模 块 402包括 : 图像 输入单 元 ,用于获 取用户 输入的 至少一 张第 一图像 ; 图像 拍摄单 元 ,用于实 时获取 当前时 刻拍摄 得到的 第二 图像 ; 确定 背景 单元 ,用于将 至少 一张第 一图像 和第二 图像作 为背景 图像 ; 相 应的 ,上述视频生成 模块 408用于 :将至少 _张第 _图像和 第二 图 像进 行循环 翻转切 换。 在_ 些实施 例中 ,第二获取 模块 404用于 :将第 _图像和 /或第二图像 中包 括目标 对象 的图像 确定为 待分割 图像。 在_ 些实施 例中 , 上述视频生成模块 408用于 :以目标对象 的中 心线 为翻 转轴 ,按照水平翻 转或者 垂直翻 转的方 式将背 景图像 进行循 环翻 转。 在_ 些实施 例中 , 上述视频生成模块 408用于 :确定轮廓 图像在 待分 割 图像中 的位置 ;将目标显 示视频 上与位 置对应 的区域 图像 替换为轮 廓图 像 ;或者 ,将轮 廓图像 作为前 景图像 覆盖在 目标显 示视频 上。 在 一些实 施例 中 , 当待分割图像为包括 多个 目标对象 的图像 时 ,视频 生成 装置还 包括 : 组合 划分 模块 ,用于将 待分 割图像 上多个 目标 对象的 轮廓图 像划分 为 至少 _个目标 对象 图像组合 。 在 一些实 施例 中 , 当目标对象图像组合为 多种时 ,视频生成装 置还 包 括 : 组合 切换 模块 ,用于每 当背 景图像 进行翻 转时 ,切换对应的 目标对 象 图像 组合。 在_ 些实施 例中 , 上述视频生成模块 408还用 于 :将第二图像作 为循 环翻 转的起 始帧 图像 ,从起始 帧图像 开始 ,按照预设的 展示顺 序展 示依次 翻转 切换 到的对 应的背 景图像 ; 其中 ,展示顺序包括 :第一 图像的 输入顺 序、 目标对象的数 量的顺 序和 /或目标对象在第 二图像 上的空 间排 列顺序 。 在 一些实 施例中 , 图像分割模块 406用于 : 确定 目标 对象在 待分割 图像上 的面积 占比 ; 当 面积 占比小于 预设 的第一 占比时 ,从待分割 图像上 截取候 选图像 , 使得 目标对 象在候 选图像 上的 位置和 面积 占比满足 预设条 件 ; 对候 选图像 进行 目标对象 的图像 分割 。 在 一些实 施例中 ,视频生成装 置还包 括 : 穿 透展示 模块 ,用于 在将背 景图像 进行循 环翻 转的过 程中 ,轮廓图像 始终 采用穿 透背 景图像 的方式 进行展 示。 在 一些实 施例中 ,视频生成装 置还包 括 : 形 变模块 ,用于 在将背 景图 像进行 循环翻 转过程 中 ,第二图像和第 一 图像 发生与 翻转 的方式 对应的 形变。 本 公开实 施例所 提供 的视频 生成装 置可执 行本发 明任 意实施 例所提 供 的视 频生成 方法 ,具备执 行方 法相应 的功能 模块和 有益效 果。 图 5为本公 开实施 例提供 的_ 种 电子设备 的结构 示意 图。如图 5所 示, 电子 设备 500包括 一个或 多个处 理器 501和存储 器 502。 处理 器 501 可以是中央 处理单 元 ( CPU)或者 具有 数据处 理能力 和 / 或指 令执行 能力 的其他 形式的 处理单 元 ,并且可 以控制 电子设 备 500 中的 其他 组件以 执行期 望的 功能。 存储 器 502可以包 括一 个或多 个计算 机程序 产品 ,所述计算机 程序产 品 可以包括 各种 形式的 计算机 可读存 储介质 ,例如 易失性 存储器 和 /或非易 失性 存储器 。 所述易失性 存储 器例如 可以包 括随机 存取 存储器 ( RAM )和/ 或 高速缓冲 存储器 ( cache)等。 所述非易失 性存储 器例 如可以 包括只 读存 储器 ( ROM )、 硬盘、 闪存等。 在所述计算机 可读存 储介质 上可 以存储 一 个或 多个 计算机 程序指 令 ,处理器 501 可以运行所 述程 序指令 ,以实 现上 文所 述的本 公开 的实施 例的视 频生成 方法以 及 /或者其他期 望的功 能。 在所 述 计算机 可读存 储介质 中还可 以存储 诸如 输入信 号、 信号分 量、 噪声分量 等各 种内容 。 在 一个示 例中 , 电子设备 500还可以包 括 :输入装置 503和 输出装 置
504 ,这些组件 通过 总线系 统和 /或其他形式 的连接 机构 (未示 出 )互连。 此外 ,该输入装 置 503还 可以包 括例 如键盘 、 鼠标等等。 该输 出装 置 504 可以向外 部输 出各种 信息 ,包括确 定出 的距离 信息、 方 向信息 等。 该输出装 置 504可以包 括例如 显示器 、 扬声器、 打印机 、 以 及通 信网 络及其 所连接 的远程 输出设 备等等 。 当 然 , 为了简化, 图 5中仅示 出了该 电子设备 500中 与本公 开有关 的 组件 中的_ 些 ,省略了诸 如总线 、 输入 /输出接口等等的 组件。 除此之外 , 根据 具体 应用情 况 , 电子设备 500还可以包括 任何 其他适 当的组 件。 除 了上述 方法 和设 备以 外 ,本公开的实 施例 还可以 是计 算机 程序产 品 ,其包括计算 机程序 指令 ,所述 计算机 程序 指令在 被处理 器运 行时使 得 所述 处理器 执行本 公开 实施例 所述视 频生成 方法。 所 述计算 机程序 产品 可以以 一种或 多种程 序设 计语言 的任意 组合来 编 写用 于执 行本公 开实施 例操作 的程 序代码 ,所述程序 设计语 言包括 面向对 象 的程序 设计语言 ,诸如 Java、 C++等 ,还包括常规的 过程式 程序设 计语 言 ,诸如 “C”语言或类似的 程序设 计语言 。 程序代码可 以完全 地在用 户计算 设 备上执 行、 部分地在用户 设备 上执行 、 作为一个独 立的 软件包 执行、 部 分 在用 户计算 设备上 部分在 远程 计算设备 上执 行、 或者完全 在远程 计算 设 备 或服务 器上执 行。 此 外 ,本公开 的实施 例还 可以是 计算机 可读存 储介 质 ,其上存储有计 算 机程 序指令 ,所述 计算 机程序 指令在 被处 理器运 行时使 得所述 处理 器执 行 本公开 实施例 所提 供的视 频生成 方法。 所 述计 算机可 读存储 介质 可以采 用一个 或多 个可读 介质的 任意组 合。 可读介质 可以 是可读 信号介 质或 者可读 存储介 质。 可读存储介质例 如可 以 包 括但 不限于 电、 磁、 光、 电磁、 红外线、 或半导体的*** 、 装置或器件 , 或 者任 意以上 的组合 。 可读存储 介质的 更具体 的例 子 (非穷举的 列表 )包 括 : 具有一个或 多个导 线的 电连接 、 便携式 盘、 硬盘、 随机存取 存储器 ( RAM X 只读存储 器 ( ROM X 可擦式 可编程 只读存 储器 ( EPROM 或 闪 存 )、 光纤、 便携式紧凑盘 只读存 储器(CD-ROM )、 光存储器件、 磁存储器 件 、 或者上述 的任意 合适 的组合 。 本 公开 实施例 还提供 了一种 计算机 程序产 品 ,包括计算机程 序 /指令, 该 计算机 程序 /指令被处理 器执 行时实现 本公 开实施例 中的 方法。 需要说 明的是 ,在本 文中 ,诸如“第一”和“第二”等之 类的关 系术语仅 仅 用 来将 一个实 体或者 操作 与另一 个实体 或操 作区分 开来 , 而不一定要 求或 者 暗示 这些实 体或操 作之 间存在 任何这 种实际 的关系 或者顺 序。 而且 ,术 语“包 括”、 “包含”或者其任 何其他 变体意 在涵盖 非排 他性的 包含 ,从而使 得 包 括一 系列要 素的过 程、 方法、 物品或者设 备不仅 包括那 些要素 , 而且还 包 括没 有明确 列出 的其他 要素 , 或者是还包括为这 种过程 、 方法、 物品或 者 设备所 固有 的要 素。 在没有 更多限 制的情 况下 , 由语句 “包括 _个 ...... ” 限定的 要素 ,并不排除在 包括所 述要 素的过 程、 方法、 物品或者设备 中还 存 在另外 的相 同要素 。 以上所 述仅是 本公开 的具 体实施 方式 ,使本领域技 术人员 能够理 解或 实 现本公 开。 对这些 实施例 的多种 修改对 本领 域的技 术人员 来说将 是显 而 易 见的 ,本文中所定 义的 一般原 理可以 在不 脱离本 公开的 精神 或范围 的情 况 下 ,在其它实施例 中实现 。 因此,本公 开将不 会被 限制于 本文所 述的 这 些实 施例 , 而是要符合与本 文所公 开的原 理和 新颖特 点相 一致的 最宽的 范 围 o

Claims

权 利 要 求
1 . 一种视频生成方 法 ,其特征 在于 ,包括: 获取 背景 图像 ; 获取 包括 目标对 象的待 分割图 像 ; 对所 述待 分割图 像进行 目标对 象的 图像分 割 ,得到所述目标 对象对 应 的轮 廓图像 ; 将所 述轮 廓图像 作为 目标显示 视频的 前景图 像 ; 将 所述背 景图像 进行循 环翻 转 ,并结合所述前景 图像 生成所 述目标 显 示视 频。
2 .根据权利 要求 1所述的 方法 ,其特征在 于 ,所述获取背景 图像 ,包 括 : 获取 用户 输入的 至少 _张 第 _图像 ; 实 时获取 当前时 刻拍摄 得到的 第二图 像 ; 将所 述至 少一张 第一图 像和所 述第 二图像作 为背 景图像 ; 所 述将所 述背景 图像进 行循 环翻转 ,包括 :将所述至少一张 第一 图像 和所 述第 二图像 进行循 环翻转 切换。
3 .根据权利要 求 2所述的方 法 ,其特征在 于 ,所述获取包括 目标对象 的待 分割 图像 ,包括 : 将 所述第 一图 像和 /或所述 第二图 像中 包括 目标对 象的 图像确 定为 待 分割 图像 。
4 .根据权利要 求 1所述的方 法 ,其特征在 于 ,所述将所述背景 图像进 行循 环翻转 ,包括 : 以 所述 目标对象 的中心 线为 翻转轴 ,按照水平翻 转或 者垂直 翻转的 方 式将 所述 背景图 像进行 循环翻 转。
5 .根据权利要 求 1所述的方 法 ,其特征在 于 ,所述将所述轮廓 图像作 为 目标显示 视频的 前景 图像 ,包括 : 确 定所述 轮廓图 像在所 述待 分割图 像中 的位置 ;将所 述目标 显示视 频 上与 所述位 置对 应的区 域图像 替换为 所述轮 廓图像 ; 或 者 ,将所述轮 廓图像 作为前 景图像 覆盖在 所述 目标显 示视频 上。
6 .根据权利要 求 2所述的方 法 ,其特征在 于 ,当所述待分割 图像为包 括 多个所 述目标 对象的 图像时 ,所述方法还 包括 : 将 所述待 分割 图像上 多个所 述目标 对象 的轮廓 图像划 分为至 少一个 目 标对 象图像 组合。
7 .根据权利要 求 6所述的方 法 ,其特征在 于 ,当所述目标对象 图像组 合 为多种 时 ,所述方法还包括 : 每 当所述 背景图 像进行 翻转切 换时 ,切换对应的 目标对象 图像组 合。
8 .根据权利要 求 6所述的方 法 ,其特征在 于 ,将所述背景图像 进行循 环翻 转切换 ,包括 : 将 所述第 二图像 作为循 环翻 转切换 的起始 帧图像 ,从所述起 始帧图 像 开始 ,按照预设的 展示顺 序展示 依次翻 转切换 到的对 应的 背景图像 ;其中 , 所述 展示 顺序包 括 :所述第 一图像 的输入 顺序 、 所述目标对 象的数 量的顺 序和 /或所述目标对象 在所 述第二 图像上 的空 间排列顺 序。
9 .根据权利要 求 1所述的方 法 ,其特征在 于 ,所述对所述待分 割图像 进行 目标对 象的 图像分 割 ,包括 : 确 定所述 目标对 象在所 述待分 割图像 上的 面积 占比 ; 当 所述面 积占比 小于 预设的 第一 占比时 ,从所述待分 割图像 上截 取候 选 图像 ,使得所 述目标 对象在 所述 候选图 像上的 位置 和面积 占比满 足预设 条件 ; 对所 述候 选图像 进行 目标对象 的图像 分割。
10 .根据权 利要求 1所述 的方法 ,其特 征在于 ,所述方法 还包括 : 在 将所述 背景 图像进 行循环 翻转的 过程 中 ,所述轮廓图像始 终采用 穿 透所 述背 景图像 的方式 进行展 示。
1 1 .根据权利 要求 2所述的 方法 ,其特征在 于 ,所述翻转的方式 包括 : 以视 频拍 摄界面 的横 向中线 为翻转轴 的垂 直翻转 、 以视频拍摄 界面 的竖直 中线 为翻 转轴 的水平 翻转 和 /或以视频拍 摄界面 的中 心点 为旋转 中心 的圆 周翻 转。
12 .根据权 利要求 2所述 的方法 ,其特 征在于 ,所述方法 还包括 : 在 将所述 背景 图像进 行循环 翻转过 程中 ,所述第二图 像和所 述第 一图 像发 生与所 述翻 转的方 式对应 的形变 。
13 .根据权利 要求 2所述的 方法 ,其特征在 于 ,所述翻转的方式 还为 : 擦 除切换方 式、 透明度变化切 换方式 或溶解 切换方 式。
14 .根据权 利要求 2所述 的方法 ,其特征在 于 ,所述第二图像根 据预 设时 间间隔 进行获 取 ,所述预设 时间间 隔与循 环翻转 切换的 周期有 关。
15 . 一种视频生成装 置 ,其特征 在于 ,包括: 第 一获取 模块 ,用于获 取背景 图像 ; 第 二获取 模块 ,用于获 取包括 目标对 象的待 分割 图像 ; 图像 分割 模块 ,用于对 所述 待分割 图像进 行目标 对象 的图像 分割 ,得 到所 述目标 对象对 应的轮 廓图像 ; 视频 生成 模块 ,用于将 所述 轮廓图 像作为 目标显 示视频 的前 景图像 ; 还用 于将所 述背 景图像 进行循 环翻 转 ,并结合所述前景 图像 生成 目标显示 视频 。
16 . _种电子 设备 ,其特征 在于 ,所述电子设备 包括 : 处理 器 ; 用 于存储 所述处 理器可 执行指 令的存 储器 ; 所 述处理 器 ,用于从所 述存 储器 中读取所 述可 执行指 令 ,并执行所 述 指令 以实现 上述权 利要 求 1 -14中任一所述的视 频生成 方法。
17 . —种计算 机可读 存储介 质 ,其特征在于 ,所述存储介质 存储有 计 算机 程序 , 当所述计算机程 序被计 算设备 执行时 ,使所述计 算机设 备实现 上述 权利要 求 1-14中任 _所述 的视频 生成 方法。
PCT/SG2022/050293 2021-06-23 2022-05-10 一种视频生成方法、装置、设备及介质 WO2022271085A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/543,969 US20240135501A1 (en) 2021-06-23 2023-12-18 Video generation method and apparatus, device and medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110704110.6 2021-06-24
CN202110704110.6A CN113422914B (zh) 2021-06-24 2021-06-24 一种视频生成方法、装置、设备及介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/543,969 Continuation US20240135501A1 (en) 2021-06-23 2023-12-18 Video generation method and apparatus, device and medium

Publications (1)

Publication Number Publication Date
WO2022271085A1 true WO2022271085A1 (zh) 2022-12-29

Family

ID=77716513

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/SG2022/050293 WO2022271085A1 (zh) 2021-06-23 2022-05-10 一种视频生成方法、装置、设备及介质

Country Status (3)

Country Link
US (1) US20240135501A1 (zh)
CN (1) CN113422914B (zh)
WO (1) WO2022271085A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002359A (zh) * 2022-05-23 2022-09-02 北京字跳网络技术有限公司 视频处理方法、装置、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105654471A (zh) * 2015-12-24 2016-06-08 武汉鸿瑞达信息技术有限公司 应用于互联网视频直播的增强现实ar***及方法
CN106303288A (zh) * 2015-06-05 2017-01-04 福建凯米网络科技有限公司 合成演唱视频的方法、装置及***
CN111464761A (zh) * 2020-04-07 2020-07-28 北京字节跳动网络技术有限公司 视频的处理方法、装置、电子设备及计算机可读存储介质
CN111669502A (zh) * 2020-06-19 2020-09-15 北京字节跳动网络技术有限公司 目标对象显示方法、装置及电子设备

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100507950C (zh) * 2006-12-12 2009-07-01 北京中星微电子有限公司 数字摄像装置的视频动画背景处理方法和***
US8830293B2 (en) * 2009-05-26 2014-09-09 Cisco Technology, Inc. Video superposition for continuous presence
JP5231331B2 (ja) * 2009-05-29 2013-07-10 株式会社エム・ソフト 映像合成方法、映像合成システム
CN105975239B (zh) * 2016-04-29 2019-08-20 广东远峰汽车电子有限公司 一种车载电子设备显示屏动态背景的生成方法和装置
US10891030B1 (en) * 2018-10-18 2021-01-12 Facebook, Inc. Compound animation showing user interactions
CN109361888B (zh) * 2018-10-25 2022-10-14 上海小度技术有限公司 通话背景的调整方法和装置、视频通话设备及存储介质
CN109726632A (zh) * 2018-11-22 2019-05-07 深圳艺达文化传媒有限公司 背景推荐方法及相关产品
CN110047034A (zh) * 2019-03-27 2019-07-23 北京大生在线科技有限公司 在线教育场景下的抠图换背景方法、客户端及***
CN110784662A (zh) * 2019-09-09 2020-02-11 天脉聚源(杭州)传媒科技有限公司 一种视频背景的更换方法、***、装置和存储介质
CN110913267B (zh) * 2019-11-29 2020-11-06 上海赛连信息科技有限公司 图像处理方法、装置、***、界面、介质和计算设备
CN111491123A (zh) * 2020-04-17 2020-08-04 维沃移动通信有限公司 视频背景处理方法、装置及电子设备
CN112822542A (zh) * 2020-08-27 2021-05-18 腾讯科技(深圳)有限公司 视频合成方法、装置、计算机设备和存储介质
CN112188266A (zh) * 2020-09-24 2021-01-05 北京达佳互联信息技术有限公司 视频生成方法、装置及电子设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106303288A (zh) * 2015-06-05 2017-01-04 福建凯米网络科技有限公司 合成演唱视频的方法、装置及***
CN105654471A (zh) * 2015-12-24 2016-06-08 武汉鸿瑞达信息技术有限公司 应用于互联网视频直播的增强现实ar***及方法
CN111464761A (zh) * 2020-04-07 2020-07-28 北京字节跳动网络技术有限公司 视频的处理方法、装置、电子设备及计算机可读存储介质
CN111669502A (zh) * 2020-06-19 2020-09-15 北京字节跳动网络技术有限公司 目标对象显示方法、装置及电子设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
SENGUPTA SOUMYADIP; JAYARAM VIVEK; CURLESS BRIAN; SEITZ STEVEN M.; KEMELMACHER-SHLIZERMAN IRA: "Background Matting: The World Is Your Green Screen", 2020 IEEE/CVF CONFERENCE ON COMPUTER VISION AND PATTERN RECOGNITION (CVPR), IEEE, 13 June 2020 (2020-06-13), pages 2288 - 2297, XP033805494, DOI: 10.1109/CVPR42600.2020.00236 *

Also Published As

Publication number Publication date
CN113422914A (zh) 2021-09-21
US20240135501A1 (en) 2024-04-25
CN113422914B (zh) 2023-11-21

Similar Documents

Publication Publication Date Title
US10832086B2 (en) Target object presentation method and apparatus
WO2022083383A1 (zh) 图像处理方法、装置、电子设备及计算机可读存储介质
CN107909022B (zh) 一种视频处理方法、装置、终端设备和存储介质
CN108845741B (zh) 一种ar表情的生成方法、客户端、终端和存储介质
WO2022068479A1 (zh) 图像处理方法、装置、电子设备及计算机可读存储介质
WO2022237594A1 (zh) 应用程序的页面显示方法、装置和设备
WO2022116751A1 (zh) 交互方法、装置、终端、服务器和存储介质
WO2021254502A1 (zh) 目标对象显示方法、装置及电子设备
WO2018000619A1 (zh) 一种数据展示方法、装置、电子设备与虚拟现实设备
WO2017166682A1 (zh) 拍照参数菜单的加载方法和装置
WO2022055418A1 (zh) 基于增强现实的显示方法、设备及存储介质
US20240135501A1 (en) Video generation method and apparatus, device and medium
WO2022055421A1 (zh) 基于增强现实的显示方法、设备及存储介质
WO2022089273A1 (zh) 视频通话的互动方法和装置
WO2022055420A2 (zh) 榜单信息显示方法、装置、电子设备及存储介质
WO2023226814A1 (zh) 视频处理方法、装置、电子设备及存储介质
WO2022100690A1 (zh) 动物脸风格图像生成方法、模型训练方法、装置和设备
US20230316529A1 (en) Image processing method and apparatus, device and storage medium
EP4343580A1 (en) Media file processing method and apparatus, device, readable storage medium, and product
WO2021170123A1 (zh) 视频生成方法、装置及对应的存储介质
CN113559503B (zh) 视频生成方法、设备及计算机可读介质
WO2022117028A1 (zh) 基于游戏直播的主播输入操作分享与显示方法、及设备
CN110349270B (zh) 基于现实空间定位的虚拟沙盘呈现方法
CN113609194A (zh) 一种数据处理方法、装置、存储介质及电子设备
WO2019127770A1 (zh) 一种机构窗口的显示方法、装置、设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22828874

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE