CN117764894A - Picture generation method and device - Google Patents

Picture generation method and device Download PDF

Info

Publication number
CN117764894A
CN117764894A CN202211116634.4A CN202211116634A CN117764894A CN 117764894 A CN117764894 A CN 117764894A CN 202211116634 A CN202211116634 A CN 202211116634A CN 117764894 A CN117764894 A CN 117764894A
Authority
CN
China
Prior art keywords
picture
target
background
color
processed
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202211116634.4A
Other languages
Chinese (zh)
Inventor
那志成
褚波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Bilibili Technology Co Ltd
Original Assignee
Shanghai Bilibili Technology Co Ltd
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 Shanghai Bilibili Technology Co Ltd filed Critical Shanghai Bilibili Technology Co Ltd
Priority to CN202211116634.4A priority Critical patent/CN117764894A/en
Publication of CN117764894A publication Critical patent/CN117764894A/en
Pending legal-status Critical Current

Links

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The application provides a picture generation method and a picture generation device, wherein the picture generation method comprises the following steps: acquiring a picture to be processed in a picture list; identifying a target object in the picture to be processed, and determining a background replacement color corresponding to the target object; generating a target background based on the background replacement color; and splicing the target object and the target background to obtain a target picture, wherein the target picture is used for being sent to a client and displayed in a target picture list. According to the picture generation method, the target object in the picture to be processed is determined, the target background is generated based on the determined target object, and the target picture corresponding to the picture to be processed is generated based on the target background and the target object, so that adjustment of the picture to be processed is completed; the generated target picture is used for being sent to the client so as to realize the display of the target picture obtained through adjustment.

Description

Picture generation method and device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method for generating a picture. The present application also relates to a picture generation apparatus, a computing device, and a computer-readable storage medium.
Background
With the continued development of computer technology, users can view content of interest by browsing web pages, videos, and the like.
In order to make the content such as video, characters and the like released on the network easier to attract users to view, the users can set cover pictures by themselves when displaying the content such as a host, a content publisher, an virtual image list and the like; however, there is often a large difference between the form and the background of the custom picture, and consistency of the picture display effect in the picture list cannot be ensured.
Therefore, how to improve the consistency of the display effect of the custom picture list is a technical problem to be solved by those skilled in the art.
Disclosure of Invention
In view of this, an embodiment of the present application provides a method for generating a picture. The application relates to a picture generation device, a computing device and a computer readable storage medium, so as to solve the problem that picture display effects in a picture list in the prior art are inconsistent.
According to a first aspect of an embodiment of the present application, there is provided a picture generation method, including:
acquiring a picture to be processed in a picture list;
identifying a target object in the picture to be processed, and determining a background replacement color corresponding to the target object;
Generating a target background based on the background replacement color;
and splicing the target object and the target background to obtain a target picture, wherein the target picture is used for being sent to a client and displayed in a target picture list.
According to a second aspect of embodiments of the present application, there is provided a picture generation apparatus, including:
the acquisition module is configured to acquire the pictures to be processed in the picture list;
the identification module is configured to identify a target object in the picture to be processed and determine a background replacement color corresponding to the target object;
a generation module configured to generate a target background based on the background replacement color;
and the splicing module is configured to splice the target object and the target background to obtain a target picture, wherein the target picture is used for being sent to a client and displayed in a target picture list.
According to a third aspect of embodiments of the present application, there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the picture generation method when executing the computer instructions.
According to a fourth aspect of embodiments of the present application, there is provided a computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the picture generation method.
According to the picture generation method, the pictures to be processed in the picture list are obtained; identifying a target object in the picture to be processed, and determining a background replacement color corresponding to the target object; generating a target background based on the background replacement color; and splicing the target object and the target background to obtain a target picture, wherein the target picture is used for being sent to a client and displayed in a target picture list.
According to the embodiment of the application, the target object in the picture to be processed is determined, the target background is generated based on the determined target object, and the target picture corresponding to the picture to be processed is generated based on the target background and the target object, so that the adjustment of the picture to be processed is completed; the generated target picture is used for being sent to the client so as to realize the display of the target picture obtained through adjustment.
Drawings
Fig. 1 is a schematic view of a scene of a picture generation method according to an embodiment of the present application;
fig. 2 is a flowchart of a picture generation method according to an embodiment of the present application;
FIG. 3 is a schematic view of projection object stitching according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of contour stitching provided in an embodiment of the present application;
Fig. 5 is a process flow diagram of a picture generation method applied to an avatar picture according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a picture generation device according to an embodiment of the present application;
FIG. 7 is a block diagram of a computing device according to one embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is, however, susceptible of embodiment in many other ways than those herein described and similar generalizations can be made by those skilled in the art without departing from the spirit of the application and the application is therefore not limited to the specific embodiments disclosed below.
The terminology used in one or more embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the application. As used in this application in one or more embodiments and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to any or all possible combinations including one or more of the associated listed items.
It should be understood that, although the terms first, second, etc. may be used in one or more embodiments of the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, a first may also be referred to as a second, and similarly, a second may also be referred to as a first, without departing from the scope of one or more embodiments of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
First, terms related to one or more embodiments of the present application will be explained.
Color quantization algorithm: the color quantization utilizes the inertia of human eyes to the color, combines similar colors in the original image into one color, reduces the color in the image, and minimizes the knowledge error of the images before and after quantization to the human eyes, namely the quantization error. Color quantization is one of the basic technologies of digital image processing, and the traditional quantization algorithm includes segmentation method and clustering method.
MMCQ: a median cut color quantization algorithm (Modified Median Cut Quantization) that can more quickly obtain reasonable color quantization results. The image color is regarded as cuboid (VBox) in the color space, the longest side of RGB is cut into two from the median of color statistics from the initial whole image as one cuboid, the number of pixels contained in the two obtained cuboids is the same, and the steps are repeated until the number of cuboids obtained by final cutting is equal to the number of theme colors, so that the method can be used for extracting the theme colors of the picture.
Currently, in a list page for displaying a host, a content publisher, and an avatar, a user is often required to separately set a cover picture to obtain a better avatar display effect. Because of the diversity of the picture content uploaded by the user, highly customized cover uploading is difficult to ensure the consistency of the finally displayed image list effect. According to the scheme, in the process of setting the image cover by the user, the user is required to upload the transparent background image picture, the color quantization algorithm is used for extracting the theme color, the transparent background image picture is used for drawing the shadow outline in the display scene, the transparent background picture and the theme color are combined, the display effect with consistent style is obtained, and the cost of designing the image cover by the user is reduced.
In the present application, a picture generation method is provided, and the present application relates to a picture generation apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments one by one.
Fig. 1 is a schematic diagram of a system architecture of a picture generation method according to an embodiment of the present application;
after receiving a picture uploading request of a user, the client determines a picture to be processed, uploads the picture to be processed to a server, and generates a picture list in the server; determining a picture 1 to be processed in a picture list, determining a target object in the picture 1 to be processed, and further identifying a theme color corresponding to the target object, wherein the theme color comprises theme colors 1 to 5; selecting a target theme color from theme colors as a background replacement color, for example, selecting color 3 as the background replacement color, or determining a complementary color or a contrast color corresponding to each theme color, and taking the complementary color or the contrast color corresponding to the target theme color as the background replacement color; after the background replacement color is determined, creating a target background of the background replacement color based on the background replacement color, such as creating a target background based on color 3; splicing the target object and the target background to obtain a target picture 1; similarly, other pictures to be processed in the picture list can be determined, and a target picture corresponding to each picture to be processed is generated, for example, the picture to be processed 2 is determined, and the target picture 2 with the background color of 9 is generated; and under the condition that the server receives the display request for the pictures to be processed, which is sent by the client, the target pictures are sent to the client, and each target picture is displayed in the form of a target picture list by the client.
Fig. 2 shows a flowchart of a picture generation method according to an embodiment of the present application, which specifically includes the following steps:
step 202: and obtaining the picture to be processed in the picture list.
The to-be-processed picture is a picture which is uploaded to the server and contains a target object, wherein the target object can be an object which can be displayed in the picture as a main body, such as a character, a text, a landscape and the like; the picture list refers to a picture list formed based on the pictures to be processed uploaded to the server, for example, each picture to be processed is sorted and stored according to the time point of uploading to the server, so as to obtain the picture list in the server.
Further, before obtaining the to-be-processed picture in the picture list, the method for generating the picture list may include:
receiving a picture uploading request;
analyzing the picture uploading request and determining at least one picture to be processed;
a picture list is generated based on each of the pending pictures.
Specifically, the server receives a picture uploading request sent by the client, for example, if the user a designs a picture of an image corresponding to a new virtual image, the client may receive the picture uploading request generated by triggering an uploading button by the user a; analyzing the picture uploading request to obtain picture identifications, and determining the pictures to be processed corresponding to each picture identification; and forming a picture list by each determined picture to be processed.
Before the pictures to be processed in the picture list are acquired, the picture list is generated so as to determine any pictures to be processed in the picture list later and further process the pictures.
In a specific embodiment of the present application, taking an avatar sharing platform as an example, an avatar designed by a designer may be uploaded to the avatar sharing platform, so that a user may download a desired avatar on the platform; in order that a user can quickly find a required avatar in the avatar sharing platform, a designer can upload an avatar picture corresponding to the avatar; the server receives a picture uploading request sent by the client and stores the virtual image picture based on the picture uploading request to obtain a picture list; each avatar picture in the picture list may be determined as a picture to be processed.
And obtaining the picture to be processed in the picture list in the server so as to further process the picture to be processed later.
Step 204: and identifying the target object in the picture to be processed, and determining the background replacement color corresponding to the target object.
After the picture to be processed is determined in the picture list, the picture to be processed can be further processed; the method comprises the following steps: and identifying the target object in each picture to be processed, and determining the background replacement color corresponding to the target object.
The target object refers to a main object identified in the picture to be processed; the background replacement color refers to a replacement color for replacing the background color of the picture to be processed.
Specifically, after determining the to-be-processed picture, further determining a picture background of the to-be-processed picture is required; under the condition that the picture to be processed does not have a background, namely the picture to be processed which is uploaded by a user and is a transparent background, the background replacement color corresponding to the target object is directly determined, and the target object is not required to be identified in the picture to be processed; and under the condition that the picture background of the picture to be processed is not transparent, the target object in the picture to be processed needs to be identified based on a preset object identification mode.
Further, the method for identifying the target object in the to-be-processed picture can comprise the following steps:
inputting the picture to be processed into an object recognition model;
and acquiring a target object output by the object identification model based on the picture to be processed.
The object recognition model is a model capable of recognizing a main object in a picture; in practical application, training an initial model based on a sample picture set carrying a main body label to obtain an object identification model capable of identifying a target object in a picture; inputting the determined picture to be processed into an object recognition model, and acquiring a recognition result output by the object recognition model based on the picture to be processed; and determining a target object in the picture to be processed based on the identification result.
In one embodiment of the application, a character picture to be processed is determined, and the character picture is input into an object recognition model; and acquiring the character object corresponding to the character picture output by the object recognition model.
In practical application, besides the object recognition model for recognizing the target object in the to-be-processed picture, other ways of determining the target object in the to-be-processed picture are available, and the application is not limited specifically.
It should be noted that, in order to ensure the recognition accuracy of the target object, a user may be set to upload the image to be processed of the transparent background or the image to be processed of the single color background, so as to ensure the recognition accuracy of the target object.
After determining a target object of the picture to be processed, further determining a background replacement color corresponding to the target object; specifically, the method for determining the background replacement color corresponding to the target object may include:
extracting color information of the target object, and mapping the color information to a color space to obtain a chromatographic cuboid of the target object;
dividing the chromatographic cuboid based on the number of preset theme colors to obtain a chromatographic sub-cuboid;
and determining the background replacement color corresponding to the target object according to each chromatographic sub-cuboid.
The color information refers to RGB values extracted from the target object, for example, the RGB values extracted from the clothing object include: red (255, 0), green (0, 255, 0), blue (0, 255); the color space refers to a three-dimensional space for drawing a chromatographic cuboid; the color spectrum cuboid refers to a cuboid drawn in a color space based on color information; the number of preset theme colors refers to the number of theme colors corresponding to a preset target object, for example, the number of preset theme colors is 5, that is, 5 theme colors are determined in the target object; the chromatographic sub-cuboid is obtained by cutting the chromatographic cuboid based on the number of preset theme colors.
Specifically, extracting color information of a target object, for example, extracting RGB values corresponding to a character object; mapping the color information to a color space, so that the color information is displayed in the form of a chromatographic cuboid; determining the number of preset theme colors, for example, setting the number of theme colors of a table object to be 7, and splitting the color spectrum cuboid according to the number of preset theme colors, namely splitting the color spectrum cuboid into color spectrum sub-cuboids of the number of theme colors, wherein a specific splitting method can be a median splitting color quantization algorithm, namely, the longest RGB value can be split into two from the median of colors so as to obtain two sub-cuboids with the same number of pixels, and splitting the sub-cuboids further based on the mode until the number of the sub-cuboids is equal to the number of the preset theme colors; after each color spectrum sub-cuboid is obtained, determining the color corresponding to each color spectrum sub-cuboid, wherein the color corresponding to each color spectrum sub-cuboid is the theme color extracted from the target object and is used for determining the background replacement color corresponding to the target object.
In practical application, the method for determining the background replacement color corresponding to the target object according to each chromatographic sub-cuboid may include:
determining a cuboid color corresponding to each chromatographic sub-cuboid, and taking a target cuboid color in each cuboid color as a background replacement color; or (b)
And determining a reference color corresponding to each cuboid color, and taking the target reference color corresponding to the target cuboid color as a background replacement color.
The color of the cuboid refers to the color corresponding to the color spectrum sub-cuboid, for example, the color of the cuboid corresponding to the color spectrum sub-cuboid B is red; the target cuboid colors refer to cuboid colors selected from each cuboid color, the selection of the target cuboid colors can be determined by default of a server in sequence or can be selected by a user uploading a picture to be processed, and the method and the device are not particularly limited; the reference color refers to a color related to a rectangular parallelepiped color, such as a complementary color of the rectangular parallelepiped color, a contrast color of the rectangular parallelepiped color, and the like; the target reference color refers to a reference color selected from the reference colors corresponding to the rectangular parallelepiped colors. In practical application, the RGB value of each cuboid color can be determined and converted into a 16-system color number for storage, so that the background replacement color can be displayed later by acquiring the 16-system color number.
Specifically, after each chromatographic sub-cuboid corresponding to the target object is determined, determining a cuboid color corresponding to each chromatographic sub-cuboid; selecting a target cuboid color from each cuboid color as a background replacement color at will; or after determining each cuboid color, further determining a reference color corresponding to each cuboid color; and selecting a target reference color from each reference color as a background replacement color.
In one embodiment of the application, determining a chromatographic sub-cuboid 1, a chromatographic sub-cuboid 2 and a chromatographic sub-cuboid 3 corresponding to the person object; further determining the cuboid color corresponding to each chromatographic sub-cuboid, specifically: the chromatographic sub-cuboid 1 is red, the chromatographic sub-cuboid 2 is yellow and the chromatographic sub-cuboid 3 is orange; the rectangular parallelepiped color yellow is selected as a background replacement color corresponding to the target object based on the user.
In another specific embodiment of the present application, following the above example, after determining the cuboid color corresponding to each color spectrum sub-cuboid, further determining the complementary color corresponding to each cuboid color is specifically: the complementary color corresponding to the cuboid color of the chromatographic sub-cuboid 1 is determined to be green, the complementary color corresponding to the cuboid color of the chromatographic sub-cuboid 2 is determined to be purple, and the complementary color corresponding to the cuboid color of the chromatographic sub-cuboid 3 is determined to be blue; in each complementary color, purple is taken as a background substitute color corresponding to the target object according to the order in which the complementary colors are determined.
And determining a target object in the picture to be processed, and determining a background replacement color corresponding to the target object so as to further process the picture to be processed based on the background replacement color.
Step 206: and generating a target background based on the background replacement color.
After determining the background replacement color, a new background corresponding to the target object, namely, a target background, can be generated based on the background replacement color; wherein, the target background refers to the background of the target object generated based on the background replacement color.
In practical applications, the method for generating the target background based on the background replacement color may include:
determining object size information corresponding to the target object, and determining background size information based on the object size information;
creating a target background based on the background size information and the background replacement color.
Wherein, the object size information refers to the size information of the target object; the background size information refers to size information of the object background.
Specifically, the user can upload a to-be-processed picture of a transparent background or a non-transparent background; in the case that the picture to be processed is a transparent background, determining object size information of a target object, and determining background size information of the target background based on the object size information, namely determining the size of the target background according to the size of the target object, so as to obtain a target background capable of completely displaying the target object; and under the condition that the picture to be processed is a non-transparent background, replacing the original background color of the picture to be processed based on the background replacement color, thereby obtaining the picture to be processed containing the target background.
That is, in the case where the background of the picture to be processed is a non-transparent background, the method of generating the target background based on the background replacement color may include:
determining an initial background of the picture to be processed, and determining an initial background color corresponding to the initial background;
and replacing the initial background color based on the background replacement color to obtain a target background.
The initial background refers to a background contained in the image to be processed, for example, a character image uploaded by the user G contains a character and a blue background; the initial background color refers to a color corresponding to the initial background.
Specifically, under the condition that the background of the picture to be processed is a non-transparent background, determining an initial background in the picture to be processed according to the determined target object, namely subtracting the target object in the picture to be processed to obtain the initial background; and determining the background color corresponding to the initial background, wherein in practical application, the initial background possibly contains a plurality of background colors, so that each color can be replaced by a background replacement color to obtain a picture to be processed containing the target background.
In a specific embodiment of the present application, if it is determined that the image M to be processed has a transparent background, determining object size information of a target object in the image M to be processed, and determining background size information based on the object size information; and creating a target background corresponding to the target object based on the background size information and the background replacement color.
In another specific embodiment of the application, if the non-transparent background exists in the to-be-processed picture N, identifying a target object in the to-be-processed picture N, so as to determine the initial background of the to-be-processed picture N; and replacing the initial background color of the initial background based on the background replacement color to obtain the picture to be processed containing the target background.
The target background is generated based on the background replacement color by determining the background replacement color so as to obtain a target picture based on the target background later.
Step 208: and splicing the target object and the target background to obtain a target picture, wherein the target picture is used for being sent to a client and displayed in a target picture list.
In practical application, if the image to be processed contains a non-transparent background, replacing the background color of the initial background in the image to be processed based on the background replacement color to obtain a target image containing a target background; if the to-be-processed picture contains the transparent background, after the target background is created, the target background and the target object are required to be fused, and the target picture is obtained.
The target picture is a picture containing a target object and a target background; the target picture list refers to a list generated by the client based on the display requirement, for example, if the user searches for a game host, the target picture list is composed of the pictures of the cover of the host of the game host.
Specifically, the method for obtaining the target picture by splicing the target object and the target background may include:
determining the position information of the target object in the background picture;
and splicing the target object and the target background based on the position information to obtain a target picture.
The position information refers to the position coordinates of the target object in the target background; the position information may be determined based on a preset stitching rule, for example, the preset stitching rule is that a center coordinate of the target object coincides with a center coordinate of the target background; and after the position information is determined, the target background and the target object can be spliced based on the position information to obtain the target picture.
Further, in order to make the display effect of the target picture in the target picture list more consistent, the target object may be spliced with the target background, and meanwhile, an object display effect may be added to the target object, where the object display effect may be projection, contour line, and the like.
Specifically, the method for splicing the target object and the target background based on the position information to obtain the target picture may include:
creating a projection object of the target object and determining an offset value of the projection object;
Splicing the projection object and the target object based on the offset value to obtain an object to be displayed;
and splicing the object to be displayed and the target background according to the position information to obtain a target picture.
Wherein, the projection object is an object with the same size as the target object and black color; in practical application, after identifying a target object in a picture to be processed, determining all colors of the target object, and uniformly replacing all colors with black to obtain a projection object; the offset value refers to an offset value when the projection objects are spliced, and since the sizes of the target object and the projection objects are completely consistent, the target object and the projection objects are overlapped when displayed at the same position, so that the offset value for the projection objects needs to be preset, and the display effect of the subsequent projection objects is ensured.
Specifically, a projection object is created based on a target object, and a preset offset value corresponding to the projection object is determined; splicing the projection object and the target object based on the offset value to obtain an object to be displayed; and then splicing the object to be displayed and the target background based on the position information, so that the target picture can be obtained.
In a specific implementation manner of the present application, as shown in fig. 3, fig. 3 is a schematic view of projection object stitching provided in an embodiment of the present application, a projection object is created based on a determined target object H, and an offset value is determined; splicing the target object H and the projection object based on the offset value to obtain an object H' to be displayed; and determining position information based on a preset splicing rule, and splicing the object H' to be displayed and the target background according to the position information to obtain a target picture.
By creating the projection objects of the target objects and generating the target pictures based on the projection objects, the corresponding projection objects are contained in each target picture, and the consistency of the display effect among each target picture is ensured when the target pictures are displayed in the target picture list later.
The process of generating the target picture based on the projection object corresponding to the target object is described above, and other object display effects, such as adding a contour line to each target object, may be added in addition to the projection object.
Specifically, after the target object is determined, an object contour line of the target object is further determined; generating a contour line corresponding to the target object based on the contour line of the object and style information such as preset contour line color, width and the like; splicing the contour line with the target object to obtain an object to be displayed; and then splicing the object to be displayed and the target background based on the position information to obtain a target picture.
In a specific embodiment of the present application, as shown in fig. 4, fig. 4 is a schematic diagram of contour line stitching provided in an embodiment of the present application, and a contour line is created based on an object contour line of a determined target object K; splicing the contour line with the target object to obtain an object K' to be displayed; and determining position information based on a preset splicing rule, and splicing the object K' to be displayed and the target background according to the position information to obtain a target picture.
By splicing the object display effects such as the projection objects and the contour lines in the process of generating the target pictures, the consistency among the target pictures is further improved, and the consistency of the display effect when the target pictures are displayed in the target picture list is further ensured.
Further, the generating the target picture needs to be sent to the client to realize the presentation of the client, that is, after the target object and the target background are spliced to obtain the target picture, the method may further include:
receiving a picture display request for a picture to be processed;
and responding to the picture display request, and sending the target picture to a client.
The picture display request refers to a display request of a picture to be processed, which is uploaded by a user; determining a picture identification based on the picture display request, and determining a picture to be displayed based on the picture identification; and determining a target picture corresponding to the picture to be displayed, and sending the target picture to the client, so that the client can display the target picture.
The server processes the picture to be processed to obtain the target picture, and after the picture display request is received subsequently, the target picture obtained by the server is displayed, so that the consistency of the display effect of the target picture in the picture list is ensured.
According to the picture generation method, pictures to be processed in a picture list are obtained; identifying a target object in the picture to be processed, and determining a background replacement color corresponding to the target object; generating a target background based on the background replacement color; and splicing the target object and the target background to obtain a target picture, wherein the target picture is used for being sent to a client and displayed in a target picture list. The adjustment of the picture to be processed is completed by determining a target object in the picture to be processed, generating a target background based on the determined target object, and generating a target picture corresponding to the picture to be processed based on the target background and the target object; the generated target picture is used for being sent to the client so as to realize the display of the target picture obtained through adjustment.
The following describes, with reference to fig. 5, an example of application of the picture generation method provided in the present application to an avatar picture, where the picture generation method is further described. Fig. 5 shows a process flow chart of a picture generation method applied to an avatar picture according to an embodiment of the present application, which specifically includes the following steps:
step 502: the user enters the avatar setting page and determines a target avatar in the avatar picture.
Specifically, a user can open an image setting page in the client and select an image to be processed; the avatar picture may be a transparent background or a non-transparent background; if the picture is a non-transparent background, identifying a target virtual image in the virtual image picture; specifically, the client can identify the avatar picture, or upload the avatar picture to the server, and then identify the target avatar.
Step 504: and extracting the theme color of the target avatar.
Specifically, after the target avatar is determined, extracting a theme color in the target avatar; the process of extracting the theme colors can be set at the client, namely, after the client recognizes the theme colors, the color numbers corresponding to the theme colors are uploaded to the server; or in the case of uploading the avatar picture to the server, the server recognizes the theme colors and returns to the client so that the user can select among a plurality of theme colors.
Step 506: and displaying the avatar picture with the transparent background and the theme color list.
Specifically, a theme color list in the server and an avatar picture of a transparent background contained in the client or an avatar picture of a transparent background pulled from the server are pulled; and displaying each theme color in the avatar image and the theme color list of each transparent background.
Step 508: and determining an object background replacement color, and generating an object background based on the object background replacement color.
Specifically, a user selects a target theme color from a theme color list as a target background replacement color; and creating a target background for the target avatar based on the target background replacement color.
Step 510: and generating a projection object based on the target virtual image, and splicing the projection object and the target virtual image according to a preset offset value to obtain the object to be displayed.
Specifically, the server or the client creates a projection object based on the determined target avatar, and splices the target avatar and the projection object based on a preset offset value to obtain an object to be displayed.
Step 512: and splicing the object to be displayed and the target background to obtain a target picture.
Specifically, the client or the server splices the generated object to be displayed and the target picture of the object to obtain a target picture corresponding to the target virtual image picture.
Step 514: and receiving a picture display request aiming at the target virtual image picture, and displaying the target picture in a target picture list.
According to the picture generation method, pictures to be processed in a picture list are obtained; identifying a target object in the picture to be processed, and determining a background replacement color corresponding to the target object; generating a target background based on the background replacement color; and splicing the target object and the target background to obtain a target picture, wherein the target picture is used for being sent to a client and displayed in a target picture list. The adjustment of the picture to be processed is completed by determining a target object in the picture to be processed, generating a target background based on the determined target object, and generating a target picture corresponding to the picture to be processed based on the target background and the target object; the generated target picture is used for being sent to the client so as to realize the display of the target picture obtained through adjustment.
Corresponding to the method embodiment, the present application further provides an embodiment of a picture generation device, and fig. 6 shows a schematic structural diagram of the picture generation device according to an embodiment of the present application. As shown in fig. 6, the apparatus includes:
an obtaining module 602 configured to obtain a picture to be processed in a picture list;
the identifying module 604 is configured to identify a target object in the to-be-processed picture and determine a background replacement color corresponding to the target object;
a generation module 606 configured to generate a target background based on the background replacement color;
and the splicing module 608 is configured to splice the target object and the target background to obtain a target picture, wherein the target picture is used for being sent to a client and displayed in a target picture list.
Optionally, the obtaining module 602 is further configured to:
receiving a picture uploading request;
analyzing the picture uploading request and determining at least one picture to be processed;
a picture list is generated based on each of the pending pictures.
Optionally, the identification module 604 is further configured to:
inputting the picture to be processed into an object recognition model;
and acquiring a target object output by the object identification model based on the picture to be processed.
Optionally, the identification module 604 is further configured to:
extracting color information of the target object, and mapping the color information to a color space to obtain a chromatographic cuboid of the target object;
dividing the chromatographic cuboid based on the number of preset theme colors to obtain a chromatographic sub-cuboid;
and determining the background replacement color corresponding to the target object according to each chromatographic sub-cuboid.
Optionally, the identification module 604 is further configured to:
determining a cuboid color corresponding to each chromatographic sub-cuboid, and taking a target cuboid color in each cuboid color as a background replacement color; or (b)
And determining a reference color corresponding to each cuboid color, and taking the target reference color corresponding to the target cuboid color as a background replacement color.
Optionally, the generating module 606 is further configured to:
determining object size information corresponding to the target object, and determining background size information based on the object size information;
creating a target background based on the background size information and the background replacement color.
Optionally, the stitching module is further configured to:
determining the position information of the target object in the background picture;
And splicing the target object and the target background based on the position information to obtain a target picture.
Optionally, the stitching module is further configured to:
creating a projection object of the target object and determining an offset value of the projection object;
splicing the projection object and the target object based on the offset value to obtain an object to be displayed;
and splicing the object to be displayed and the target background according to the position information to obtain a target picture.
Optionally, the generating module 606 is further configured to:
determining an initial background of the picture to be processed, and determining an initial background color corresponding to the initial background;
and replacing the initial background color based on the background replacement color to obtain a target background.
Optionally, the apparatus further comprises a transmitting module configured to:
receiving a picture display request for a picture to be processed;
and responding to the picture display request, and sending the target picture to a client.
The image generation device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is configured to acquire an image to be processed in an image list; the identification module is configured to identify a target object in the picture to be processed and determine a background replacement color corresponding to the target object; a generation module configured to generate a target background based on the background replacement color; and the splicing module is configured to splice the target object and the target background to obtain a target picture, wherein the target picture is used for being sent to a client and displayed in a target picture list. The picture generation device of the application realizes that the adjustment of the picture to be processed is completed by determining the target object in the picture to be processed, generating the target background based on the determined target object, and generating the target picture corresponding to the picture to be processed based on the target background and the target object; the generated target picture is used for being sent to the client so as to realize the display of the target picture obtained through adjustment.
The above is a schematic scheme of a picture generation device of the present embodiment. It should be noted that, the technical solution of the image generating apparatus and the technical solution of the image generating method belong to the same concept, and details of the technical solution of the image generating apparatus, which are not described in detail, can be referred to the description of the technical solution of the image generating method.
Fig. 7 illustrates a block diagram of a computing device 700 provided in accordance with an embodiment of the present application. The components of computing device 700 include, but are not limited to, memory 710 and processor 720. Processor 720 is coupled to memory 710 via bus 730, and database 750 is used to store data.
Computing device 700 also includes access device 740, access device 740 enabling computing device 700 to communicate via one or more networks 760. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The access device 740 may include one or more of any type of network interface, wired or wireless (e.g., a Network Interface Card (NIC)), such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present application, the above-described components of computing device 700, as well as other components not shown in FIG. 7, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device illustrated in FIG. 7 is for exemplary purposes only and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as desired.
Computing device 700 may be any type of stationary or mobile computing device including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smart phone), wearable computing device (e.g., smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 700 may also be a mobile or stationary server.
Wherein the processor 720 implements the steps of the picture generation method when executing the computer instructions.
The foregoing is a schematic illustration of a computing device of this embodiment. It should be noted that, the technical solution of the computing device and the technical solution of the above-mentioned picture generation method belong to the same concept, and the details of the technical solution of the computing device, which are not described in detail, can be referred to the description of the technical solution of the above-mentioned picture generation method.
An embodiment of the present application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the picture generation method as described above.
The above is an exemplary version of a computer-readable storage medium of the present embodiment. It should be noted that, the technical solution of the storage medium and the technical solution of the above-mentioned picture generation method belong to the same concept, and details of the technical solution of the storage medium which are not described in detail can be referred to the description of the technical solution of the above-mentioned picture generation method.
The foregoing describes specific embodiments of the present application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The computer instructions include computer program code that may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
It should be noted that, for the sake of simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily all necessary for the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The above-disclosed preferred embodiments of the present application are provided only as an aid to the elucidation of the present application. Alternative embodiments are not intended to be exhaustive or to limit the invention to the precise form disclosed. Obviously, many modifications and variations are possible in light of the teaching of this application. The embodiments were chosen and described in order to best explain the principles of the invention and the practical application, to thereby enable others skilled in the art to best understand and utilize the invention. This application is to be limited only by the claims and the full scope and equivalents thereof.

Claims (13)

1. A picture generation method, characterized by comprising:
acquiring a picture to be processed in a picture list;
identifying a target object in the picture to be processed, and determining a background replacement color corresponding to the target object;
generating a target background based on the background replacement color;
and splicing the target object and the target background to obtain a target picture, wherein the target picture is used for being sent to a client and displayed in a target picture list.
2. The method of claim 1, further comprising, prior to obtaining the picture to be processed in the picture list:
receiving a picture uploading request;
analyzing the picture uploading request and determining at least one picture to be processed;
a picture list is generated based on each of the pending pictures.
3. The method of claim 1, wherein identifying a target object in the picture to be processed comprises:
inputting the picture to be processed into an object recognition model;
and acquiring a target object output by the object identification model based on the picture to be processed.
4. The method of claim 1, wherein determining the background replacement color for the target object comprises:
Extracting color information of the target object, and mapping the color information to a color space to obtain a chromatographic cuboid of the target object;
dividing the chromatographic cuboid based on the number of preset theme colors to obtain a chromatographic sub-cuboid;
and determining the background replacement color corresponding to the target object according to each chromatographic sub-cuboid.
5. The method of claim 4, wherein determining the corresponding background replacement color for the target object from each color spectrum sub-cuboid comprises:
determining a cuboid color corresponding to each chromatographic sub-cuboid, and taking a target cuboid color in each cuboid color as a background replacement color; or (b)
And determining a reference color corresponding to each cuboid color, and taking the target reference color corresponding to the target cuboid color as a background replacement color.
6. The method of claim 1, wherein generating a target background based on the background replacement color comprises:
determining object size information corresponding to the target object, and determining background size information based on the object size information;
creating a target background based on the background size information and the background replacement color.
7. The method of claim 1, wherein stitching the target object and the target background to obtain a target picture comprises:
determining the position information of the target object in the background picture;
and splicing the target object and the target background based on the position information to obtain a target picture.
8. The method of claim 7, wherein stitching the target object and the target background based on the location information to obtain a target picture comprises:
creating a projection object of the target object and determining an offset value of the projection object;
splicing the projection object and the target object based on the offset value to obtain an object to be displayed;
and splicing the object to be displayed and the target background according to the position information to obtain a target picture.
9. The method of claim 1, wherein generating a target background based on the background replacement color comprises:
determining an initial background of the picture to be processed, and determining an initial background color corresponding to the initial background;
and replacing the initial background color based on the background replacement color to obtain a target background.
10. The method of claim 1, wherein after stitching the target object and the target background to obtain a target picture, further comprising:
receiving a picture display request for a picture to be processed;
and responding to the picture display request, and sending the target picture to a client.
11. A picture generation apparatus, comprising:
the acquisition module is configured to acquire the pictures to be processed in the picture list;
the identification module is configured to identify a target object in the picture to be processed and determine a background replacement color corresponding to the target object;
a generation module configured to generate a target background based on the background replacement color;
and the splicing module is configured to splice the target object and the target background to obtain a target picture, wherein the target picture is used for being sent to a client and displayed in a target picture list.
12. A computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor, when executing the computer instructions, performs the steps of the method of any one of claims 1-10.
13. A computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the method of any one of claims 1-10.
CN202211116634.4A 2022-09-14 2022-09-14 Picture generation method and device Pending CN117764894A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211116634.4A CN117764894A (en) 2022-09-14 2022-09-14 Picture generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211116634.4A CN117764894A (en) 2022-09-14 2022-09-14 Picture generation method and device

Publications (1)

Publication Number Publication Date
CN117764894A true CN117764894A (en) 2024-03-26

Family

ID=90309073

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211116634.4A Pending CN117764894A (en) 2022-09-14 2022-09-14 Picture generation method and device

Country Status (1)

Country Link
CN (1) CN117764894A (en)

Similar Documents

Publication Publication Date Title
US9811894B2 (en) Image processing method and apparatus
US8553045B2 (en) System and method for image color transfer based on target concepts
CN108600632B (en) Photographing prompting method, intelligent glasses and computer readable storage medium
US20120050305A1 (en) Apparatus and method for providing augmented reality (ar) using a marker
CN113254683B (en) Data processing method and device, and tag identification method and device
CN112562019A (en) Image color adjusting method and device, computer readable medium and electronic equipment
CN112069341A (en) Background picture generation and search result display method, device, equipment and medium
CN113870133B (en) Multimedia display and matching method, device, equipment and medium
CN112102422B (en) Image processing method and device
CN112328345A (en) Method and device for determining theme color, electronic equipment and readable storage medium
CN105981360A (en) Image processing apparatus, image processing system, image processing method and recording medium
CN108701355A (en) GPU optimizes and the skin possibility predication based on single Gauss online
CN113965773A (en) Live broadcast display method and device, storage medium and electronic equipment
CN113127126B (en) Object display method and device
CN111161377B (en) Method and device for adding characters in picture, electronic equipment and storage medium
CN110177216B (en) Image processing method, image processing device, mobile terminal and storage medium
EP4207075A1 (en) Image processing method and apparatus, and computer device and storage medium
CN113453027A (en) Live video and virtual makeup image processing method and device and electronic equipment
CN117764894A (en) Picture generation method and device
CN111383289A (en) Image processing method, image processing device, terminal equipment and computer readable storage medium
CN115601479A (en) Virtual human head generation method and device
KR101738896B1 (en) Fitting virtual system using pattern copy and method therefor
CN114565707A (en) 3D object rendering method and device
CN112604279A (en) Special effect display method and device
US20200092429A1 (en) Image processing apparatus, image processing method, program, and recording medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination