Method for replacing background in picture, device, storage medium and program product
AssigneeBeijing Bytedance Network Technology Co., Ltd.
InventorsYingyi Chen, Shaohui Jiao
Life of this patent
Estimating the term…
Abstract
A method for replacing a background in a picture, a device, a storage medium and a program product provided in the embodiments relate to image processing technologies and include: acquiring a basic background image of a preset scene, where the basic background image is an image obtained by shooting the preset scene in advance; acquiring a captured picture obtained by currently shooting the preset scene, and determining a current background image of the preset scene according to the basic background image and the captured picture; replacing the current background image in the captured picture with a preset background image to obtain a final captured picture.
Claims10
A method for replacing a background in a picture, comprising:
- acquiring a basic background image of a preset scene, wherein the basic background image is an image obtained by shooting the preset scene in advance;
- acquiring a captured picture obtained by currently shooting the preset scene, and determining a current background image of the preset scene according to the basic background image and the captured picture;
- and
- replacing the current background image in the captured picture with a preset background image to obtain a final captured picture,
- wherein the determining the current background image of the preset scene according to the basic background image and the captured picture comprises:
- extracting basic feature point information of the basic background image, and extracting shooting feature point information in the captured picture;
- and
- determining a matching relationship between each piece of the basic feature point information and each piece of the shooting feature point information, and determining the current background image in the captured picture according to the matching relationship,
- wherein the determining the current background image in the captured picture according to the matching relationship comprises:
- stitching a background portion in the captured picture and the basic background image according to the matching relationship, to obtain the current background image of the preset scene in the captured picture,
- wherein the method further comprises:
- extending a boundary of the current background image to obtain an extended background image;
- and
- replacing the extended background image in the captured picture with the preset background image correspondingly according to the extended background image, to obtain the final captured picture,
- wherein the method further comprises:
- performing any of the following enhancement processing on the extended background image to obtain an enhanced background image:
- stitching seam feathering, light transformation;
- and
- replacing the enhanced background image in the captured picture with the preset background image correspondingly according to the enhanced background image, to obtain the final captured picture, and
- wherein the extended background image and the enhanced background image are images extended based on a current shooting angle.
An apparatus for replacing a background in a picture, comprising:
- at least one processor, and
- a memory communicatively connected to the at least one processor;
- wherein,
- the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor is configured to:
- acquire a basic background image of a preset scene, wherein the basic background image is an image obtained by shooting the preset scene in advance;
- acquire a captured picture obtained by currently shooting the preset scene;
- determine a current background image of the preset scene according to the basic background image and the captured picture;
- and
- replace the current background image in the captured picture with a preset background image to obtain a final captured picture,
- wherein the at least one processor is further configured to:
- extract basic feature point information of the basic background image, and extract shooting feature point information in the captured picture;
- and
- determine a matching relationship between each piece of the basic feature point information and each piece of the shooting feature point information, and determine the current background image in the captured picture according to the matching relationship,
- wherein the at least one processor is further configured to:
- stitch a background portion in the captured picture and the basic background image according to the matching relationship, to obtain the current background image of the preset scene in the captured picture,
- wherein the at least one processor is further configured to:
- extend a boundary of the current background image to obtain an extended background image;
- and
- replace the extended background image in the captured picture with the preset background image correspondingly according to the extended background image, to obtain the final captured picture,
- wherein the at least one processor is further configured to:
- perform any of the following enhancement processing on the extended background image to obtain an enhanced background image:
- stitching seam feathering, light transformation;
- and
- replace the enhanced background image in the captured picture with the preset background image correspondingly according to the enhanced background image, to obtain the final captured picture, and
- wherein the extended background image and the enhanced background image are images extended based on a current shooting angle.
A non-transitory computer-readable storage medium, wherein the computer-readable storage medium has a computer-executed instruction stored thereon, and when a processor executes the computer-executed instruction, the processor executes steps of:
- acquiring a basic background image of a preset scene, wherein the basic background image is an image obtained by shooting the preset scene in advance;
- acquiring a captured picture obtained by currently shooting the preset scene, and determining a current background image of the preset scene according to the basic background image and the captured picture;
- and
- replacing the current background image in the captured picture with a preset background image to obtain a final captured picture,
- wherein the computer-executed instruction is further used to perform the following steps:
- extracting basic feature point information of the basic background image, and extracting shooting feature point information in the captured picture;
- and
- determining a matching relationship between each piece of the basic feature point information and each piece of the shooting feature point information, and determining the current background image in the captured picture according to the matching relationship,
- wherein the computer-executed instruction is further used to perform the following steps:
- stitching a background portion in the captured picture and the basic background image according to the matching relationship, to obtain the current background image of the preset scene in the captured picture,
- wherein the computer-executed instruction is further used to perform the following steps:
- extending a boundary of the current background image to obtain an extended background image;
- and
- replacing the extended background image in the captured picture with the preset background image correspondingly according to the extended background image, to obtain the final captured picture,
- wherein the computer-executed instruction is further used to perform the following steps:
- performing any of the following enhancement processing on the extended background image to obtain an enhanced background image:
- stitching seam feathering, light transformation;
- and
- replacing the enhanced background image in the captured picture with the preset background image correspondingly according to the enhanced background image, to obtain the final captured picture, and
- wherein the extended background image and the enhanced background image are images extended based on a current shooting angle.
Dependencies are inferred from the claim text.