Method and device for replacing photo background, computer equipment and storage medium

Generative artificial intelligence technology generates background wallpapers and matches user photo coordinates, which solves the problem that users cannot change the background of uploading photos in smart TVs, and realizes the diversity of personalized wallpapers and the satisfaction of user needs.

CN119052594APending Publication Date: 2024-11-29SHENZHEN COOCAA NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411032459.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

Existing smart TVs cannot replace the background of photos uploaded by users according to user needs, and lack effective background replacement methods.

Method used

Generative artificial intelligence technology is used to generate a series of background wallpapers, and the coordinates of the white space area are marked in the wallpaper, and the photos uploaded by users are obtained for preprocessing, matching the coordinates of the white space area and character coordinates in the background wallpaper to generate the target wallpaper.

Benefits of technology

It realizes the background replacement of photos uploaded by users, increases the diversity of smart TV wallpapers, and meets users' personalized needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119052594A_ABST
    Figure CN119052594A_ABST
Patent Text Reader

Abstract

The invention discloses a photo background replacement method and device, computer equipment and a storage medium, and the method comprises the steps: generating a series of background wallpapers based on a generative artificial intelligence technology, marking the coordinates of a blank area in the background wallpapers, obtaining a photo uploaded by a user, carrying out the preprocessing of the photo, obtaining the coordinates of a character in a preprocessed image, and carrying out the replacement of the background of the photo. And matching the coordinates of the blank area in the background wallpaper with the figure coordinates in the preprocessed image to generate target wallpaper. According to the invention, background replacement is carried out on the photo uploaded by the user at the client based on the generative artificial intelligence technology, and the replaced background is used as the wallpaper of the client, so that the paper diversity of the client wall is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of photo background replacement, and in particular to a photo background replacement method, device, computer equipment and storage medium. Background Art

[0002] With the popularity of smart TVs, existing smart TVs have added more and more additional functions in addition to watching TV programs, such as the ability to change the TV wallpaper. However, most TV wallpapers on the market are built-in TV systems or photos uploaded by users, but the photos uploaded by users cannot change the background according to the needs of users. Therefore, a method for changing the background of photos uploaded by users to the client is urgently needed. Summary of the invention

[0003] The embodiments of the present invention provide a method, an apparatus, a computer device and a storage medium for changing the background of a photo, so as to solve the problem of changing the background of a photo.

[0004] A method for changing a photo background, comprising:

[0005] Generate a series of background wallpapers based on generative artificial intelligence technology, and mark the coordinates of blank areas in the background wallpapers;

[0006] Get the photos uploaded by the user, pre-process the photos, and obtain the coordinates of the people in the pre-processed images;

[0007] The coordinates of the blank area in the background wallpaper are matched with the coordinates of the characters in the pre-processed image to generate a target wallpaper.

[0008] A device for changing a photo background, comprising:

[0009] A background generation module, used to generate a series of background wallpapers based on generative artificial intelligence technology, and mark the coordinates of blank areas in the background wallpapers;

[0010] The image processing module is used to obtain photos uploaded by users, pre-process the photos, and obtain the coordinates of the characters in the pre-processed images;

[0011] The wallpaper generation module matches the coordinates of the blank area in the background wallpaper with the coordinates of the characters in the pre-processed image to generate a target wallpaper.

[0012] Optionally, the image processing module includes:

[0013] Picture acquisition module, to obtain the photos uploaded by users to the TV terminal;

[0014] An image processing submodule, used to remove the background image from the user uploaded photo, and extract the person image from the user uploaded photo as a pre-processed image;

[0015] The sending module is used to upload the pre-processed image and the coordinates of the person in the pre-processed image to the server.

[0016] Optionally, the wallpaper generation module includes:

[0017] An acquisition module, used for acquiring the preprocessed image and the coordinates of the person in the preprocessed image;

[0018] The processing module is used to screen the generated series of background wallpapers based on the coordinates of the characters in the pre-processed image, match the coordinates of the blank areas in the screened background wallpapers with the coordinates in the pre-processed image, and synthesize the target wallpaper.

[0019] A system for changing photo background, comprising: a client and a server;

[0020] The client is used to receive uploaded user photos and send the photos uploaded by the user to the client to the server;

[0021] The server generates a series of background wallpapers based on generative artificial intelligence technology, marks the coordinates of blank areas in the background wallpapers, accepts photos uploaded by the client and pre-processes the photos, obtains the coordinates of the characters in the pre-processed images, matches the coordinates of the blank areas in the background wallpapers with the coordinates of the characters in the pre-processed images, and generates target wallpapers.

[0022] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method for changing the background of a photo when executing the computer program.

[0023] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for changing the background of a photo is implemented.

[0024] The above-mentioned method, device, computer equipment and storage medium for changing the background of a photo generate a series of background wallpapers based on generative artificial intelligence technology, and mark the coordinates of the blank area in the background wallpaper, obtain the user's uploaded photos, pre-process the photos, obtain the coordinates of the person in the pre-processed image, match the coordinates of the blank area in the background wallpaper with the coordinates of the person in the pre-processed image, and generate the target wallpaper. This application replaces the background of the photos uploaded by the user on the client based on generative artificial intelligence technology, and uses the replaced background as the wallpaper of the client, so as to increase the diversity of the client's wallpaper. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0026] Figure 1 is a schematic diagram of an application environment of a method for changing a photo background in an embodiment of the present invention;

[0027] Figure 2 is a flow chart of a method for changing a photo background in one embodiment of the present invention;

[0028] Figure 3 is a schematic diagram of a device for changing photo background in one embodiment of the present invention;

[0029] Figure 4 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0031] The method for changing the background of a photo provided by the embodiment of the present invention can be applied as follows: Figure 1 Specifically, the method for changing the photo background is applied in a system for changing the photo background, and the system for changing the photo background includes: Figure 1 The client and server shown in the figure communicate with each other through the network to realize the replacement of the background of the photo uploaded by the user on the TV. The client is also called the user end, which refers to the program corresponding to the server and provides local services to the customer. The client can be on, but not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The server can be implemented as an independent server or a server cluster consisting of multiple servers.

[0032] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0033] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0034] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]", depending on the context.

[0035] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0036] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0037] It should be understood that the order of execution of the steps in the following embodiments does not imply a precedence of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0038] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.

[0039] In one embodiment, if Figure 2 As shown, a method for changing the background of a photo is provided, and the method is applied in Figure 1 The server in the example is used as an example to illustrate the process, including the following steps:

[0040] S10: Generate a series of background wallpapers based on generative artificial intelligence technology, and mark the coordinates of blank areas in the background wallpapers;

[0041] S20: Obtain the photo uploaded by the user, pre-process the photo, and obtain the coordinates of the person in the pre-processed image;

[0042] S30: Matching the coordinates of the blank area in the background wallpaper with the coordinates of the person in the pre-processed image to generate a target wallpaper.

[0043] Specifically, a series of background wallpapers are generated by generative artificial intelligence technology, and the coordinates of blank areas are marked in the background wallpapers, wherein the blank areas are reserved in advance when they are generated based on artificial intelligence technology, so that users can synthesize the preprocessed pictures and the generated background wallpapers into target wallpapers. When synthesizing the target wallpaper, it is necessary to first obtain the coordinates of the characters in the preprocessed images, and match the background wallpapers suitable for the blank areas in the series of background wallpapers generated by generative artificial intelligence technology according to the coordinates of the characters in the preprocessed pictures to generate the target wallpaper.

[0044] In one embodiment, the method for changing the photo background, such as step S20, is to obtain the photo uploaded by the user, and pre-process the photo to obtain the coordinates of the person in the pre-processed image, which specifically includes the following steps:

[0045] S21: Obtaining photos uploaded by the user to the TV terminal;

[0046] S22: removing the image of the background part in the photo uploaded by the user, and extracting the image of the person part from the photo uploaded by the user as a pre-processed image;

[0047] S23: Upload the preprocessed image and the coordinates of the person in the preprocessed image to a server.

[0048] Specifically, after the user uploads the photos on the TV, since the photos need to be pre-processed and the background in the user uploaded photos needs to be replaced, it is necessary to remove the image of the background part of the user uploaded photo, that is, to make the background in the user uploaded photo transparent and retain the image of the character part, so as to facilitate the identification of the character part image in the uploaded photo, extract the character part, and upload the preprocessed image and the character coordinates in the preprocessed image to the server for subsequent processing.

[0049] In one embodiment, the method for changing the photo background, as described in step S22, that is, removing the background part image in the photo uploaded by the user, and extracting the character part image from the photo uploaded by the user as a pre-processed image, specifically includes the following steps:

[0050] S21: Divide the photos uploaded by the user into regions, and identify the images in each region.

[0051] S22: The image identified as the background is made transparent, and the image of the character part is saved and extracted.

[0052] Specifically, after the user uploads the photo, the photo uploaded by the user is divided into regions, and the image of each area of ​​the photo is identified in order from top to bottom and from left to right. If it is identified as a background image, it is made transparent. If it is identified as a person image, it is retained and the identified partial image of the person is extracted as a whole.

[0053] In one embodiment, in the method for changing the photo background, as described in step S30, the coordinates of the blank area in the background wallpaper and the coordinates of the person in the pre-processed image are matched to generate the target wallpaper, which specifically includes the following steps:

[0054] S31: Acquire the preprocessed image and the coordinates of the person in the preprocessed image;

[0055] S32: Based on the coordinates of the characters in the preprocessed image, the generated series of background wallpapers are screened, the coordinates of the blank areas in the screened background wallpapers are matched with the coordinates in the preprocessed image, and the target wallpaper is synthesized.

[0056] Specifically, after preprocessing the photos uploaded by the user, the server will obtain the preprocessed image and the coordinates of the characters in the preprocessed image. Based on the coordinates of the characters in the preprocessed image, the server will screen the generated series of background wallpapers to find pictures with blank areas at the coordinate positions corresponding to the characters, match the coordinates of the blank areas in the screened background wallpapers with the coordinates in the preprocessed image, and synthesize the wallpaper. After synthesizing the wallpaper, the wallpaper is polished, the blank areas in the background wallpaper are filled with color, and the colored pictures are output as the target wallpaper.

[0057] The above-mentioned method, device, computer equipment and storage medium for changing the background of a photo generate a series of background wallpapers based on generative artificial intelligence technology, and mark the coordinates of the blank area in the background wallpaper, obtain the user's uploaded photos, pre-process the photos, obtain the coordinates of the person in the pre-processed image, match the coordinates of the blank area in the background wallpaper with the coordinates of the person in the pre-processed image, and generate the target wallpaper. This application replaces the background of the photos uploaded by the user on the client based on generative artificial intelligence technology, and uses the replaced background as the wallpaper of the client, so as to increase the diversity of the client's wallpaper.

[0058] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0059] In one embodiment, a device for changing the background of a photo is provided, and the device for changing the background of a photo corresponds to the method for changing the background of a photo in the above embodiment. Figure 3As shown, the device for changing the photo background includes: a background generation module, an image processing module, and a wallpaper generation module. The detailed description of each functional module is as follows:

[0060] A background generation module, used to generate a series of background wallpapers based on generative artificial intelligence technology, and mark the coordinates of blank areas in the background wallpapers;

[0061] The image processing module is used to obtain photos uploaded by users, pre-process the photos, and obtain the coordinates of the characters in the pre-processed images;

[0062] The wallpaper generation module matches the coordinates of the blank area in the background wallpaper with the coordinates of the characters in the pre-processed image to generate a target wallpaper.

[0063] Specifically, a series of background wallpapers are generated by generative artificial intelligence technology, and the coordinates of blank areas are marked in the background wallpapers, wherein the blank areas are reserved in advance when they are generated based on artificial intelligence technology, so that users can synthesize the preprocessed pictures and the generated background wallpapers into target wallpapers. When synthesizing the target wallpaper, it is necessary to first obtain the coordinates of the characters in the preprocessed images, and match the background wallpapers suitable for the blank areas in the series of background wallpapers generated by generative artificial intelligence technology according to the coordinates of the characters in the preprocessed pictures to generate the target wallpaper.

[0064] Optionally, the image processing module includes:

[0065] Picture acquisition module, to obtain the photos uploaded by users to the TV terminal;

[0066] An image processing submodule, used to remove the background image from the user uploaded photo, and extract the person image from the user uploaded photo as a pre-processed image;

[0067] The sending module is used to upload the pre-processed image and the coordinates of the person in the pre-processed image to the server.

[0068] Optionally, the wallpaper generation module includes:

[0069] An acquisition module, used for acquiring the preprocessed image and the coordinates of the person in the preprocessed image;

[0070] The processing module is used to screen the generated series of background wallpapers based on the coordinates of the characters in the pre-processed image, match the coordinates of the blank areas in the screened background wallpapers with the coordinates in the pre-processed image, and synthesize the target wallpaper.

[0071] The specific definition of the device for changing the photo background can be found in the definition of the method for changing the photo background above, which will not be repeated here. Each module in the above-mentioned device for changing the photo background can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0072] In one embodiment, a system for changing the background of a photo is provided, and the system for changing the background of a photo corresponds one-to-one to the method for changing the background of a photo in the above embodiment. Figure 3 As shown, the device for changing the photo background includes: a client and a server. The detailed description of each functional module is as follows:

[0073] The client is used to receive uploaded user photos and send the photos uploaded by the user to the client to the server;

[0074] The server generates a series of background wallpapers based on generative artificial intelligence technology, marks the coordinates of blank areas in the background wallpapers, accepts photos uploaded by the client and pre-processes the photos, obtains the coordinates of the characters in the pre-processed images, matches the coordinates of the blank areas in the background wallpapers with the coordinates of the characters in the pre-processed images, and generates target wallpapers.

[0075] The specific definition of the system for changing the photo background can be found in the definition of the method for changing the photo background in the above text, which will not be repeated here. Each module in the above-mentioned system for changing the photo background can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0076] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store background wallpapers for changing photos. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for changing the background of a photo is implemented.

[0077] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for changing the background of a photo in the above embodiment is implemented, for example Figure 2 Alternatively, when the processor executes the computer program, the functions of each module / unit in the embodiment of the device for changing the background of a photo are realized, for example Figure 3 The function of changing the photo background shown will not be repeated here to avoid repetition.

[0078] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for changing the background of a photo in the above embodiment is implemented, for example Figure 2 Alternatively, when the computer program is executed by a processor, the functions of each module / unit in the embodiment of the device for changing the background of a photo are realized, for example Figure 3 The function of changing the photo background shown will not be repeated here to avoid repetition.

[0079] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0080] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0081] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for changing the background of a photo, characterized in that: include: Generate a series of background wallpapers based on generative artificial intelligence technology, and mark the coordinates of blank areas in the background wallpapers; Get the photos uploaded by the user, pre-process the photos, and obtain the coordinates of the people in the pre-processed images; The coordinates of the blank area in the background wallpaper are matched with the coordinates of the characters in the pre-processed image to generate a target wallpaper.

2. The method for changing the photo background according to claim 1, characterized in that: The method of obtaining the photo uploaded by the user, preprocessing the photo, and obtaining the coordinates of the person in the preprocessed image includes: Get the photos uploaded by the user to the TV; Eliminate the image of the background part in the photo uploaded by the user, and extract the image of the person part from the photo uploaded by the user as the pre-processed image; The preprocessed image and the coordinates of the person in the preprocessed image are uploaded to a server.

3. The method for changing the photo background according to claim 1, characterized in that: Matching the coordinates of the blank area in the background wallpaper with the coordinates of the person in the pre-processed image to generate a target wallpaper, including: Acquire the preprocessed image and the coordinates of the person in the preprocessed image; Based on the coordinates of the characters in the preprocessed image, the generated series of background wallpapers are screened, and the coordinates of the blank areas in the screened background wallpapers are matched with the coordinates in the preprocessed image to synthesize the target wallpaper.

4. The method for changing the photo background according to claim 2, characterized in that: The removing of the background part image in the photo uploaded by the user and extracting the character part image from the photo uploaded by the user as the pre-processed image includes: Divide the photos uploaded by the user into regions and identify the images in each region; The image identified as the background is made transparent, and the image of the character part is saved and extracted.

5. A device for changing photo background, characterized in that: include: A background generation module, used to generate a series of background wallpapers based on generative artificial intelligence technology, and mark the coordinates of blank areas in the background wallpapers; The image processing module is used to obtain photos uploaded by users, pre-process the photos, and obtain the coordinates of the characters in the pre-processed images; The wallpaper generation module matches the coordinates of the blank area in the background wallpaper with the coordinates of the characters in the pre-processed image to generate a target wallpaper.

6. The device for changing photo background according to claim 5, characterized in that: The image processing module; Picture acquisition module, to obtain the photos uploaded by users to the TV terminal; An image processing submodule, used to remove the background image from the user uploaded photo, and extract the person image from the user uploaded photo as a pre-processed image; The sending module is used to upload the pre-processed image and the coordinates of the person in the pre-processed image to the server.

7. The device for changing photo background according to claim 5, characterized in that: The wallpaper generating module; An acquisition module, used for acquiring the preprocessed image and the coordinates of the person in the preprocessed image; The processing module is used to screen the generated series of background wallpapers based on the coordinates of the characters in the pre-processed image, match the coordinates of the blank areas in the screened background wallpapers with the coordinates in the pre-processed image, and synthesize the target wallpaper.

8. A system for changing photo background, characterized in that: include: Client and server; The client is used to receive uploaded user photos and send the photos uploaded by the user to the client to the server; The server generates a series of background wallpapers based on generative artificial intelligence technology, marks the coordinates of blank areas in the background wallpapers, accepts photos uploaded by the client and pre-processes the photos, obtains the coordinates of the characters in the pre-processed images, matches the coordinates of the blank areas in the background wallpapers with the coordinates of the characters in the pre-processed images, and generates target wallpapers.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for changing the photo background according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for replacing the photo background according to any one of claims 1 to 7 is implemented.