WO2023207779A1 - 图像处理方法、装置、设备及介质 - Google Patents

图像处理方法、装置、设备及介质 Download PDF

Info

Publication number
WO2023207779A1
WO2023207779A1 PCT/CN2023/089724 CN2023089724W WO2023207779A1 WO 2023207779 A1 WO2023207779 A1 WO 2023207779A1 CN 2023089724 W CN2023089724 W CN 2023089724W WO 2023207779 A1 WO2023207779 A1 WO 2023207779A1
Authority
WO
WIPO (PCT)
Prior art keywords
color
image
initial
target
coloring
Prior art date
Application number
PCT/CN2023/089724
Other languages
English (en)
French (fr)
Inventor
丁飞
刘玮
Original Assignee
北京字跳网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字跳网络技术有限公司 filed Critical 北京字跳网络技术有限公司
Publication of WO2023207779A1 publication Critical patent/WO2023207779A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Definitions

  • the present disclosure relates to the field of computer application technology, and in particular, to an image processing method, device, equipment and medium.
  • Coloring line drawing images is a common image processing method. For example, when creating a two-dimensional character in a game, coloring a two-dimensional character is a common requirement for creating game characters.
  • the present disclosure provides an image processing method, device, equipment and medium.
  • An embodiment of the present disclosure provides an image processing method.
  • the method includes: obtaining a line drawing and initial color prompt information from a user; coloring the line drawing based on the initial color prompt information to generate the line drawing. an initial coloring image of the manuscript; obtaining color modification information associated with the initial coloring image from the user; generating target color prompt information based on the initial color prompt information, the color modification information and the initial coloring image; and based on The target color prompt information is used to color the line draft drawing to generate a target coloring image of the line draft drawing.
  • Embodiments of the present disclosure also provide an image processing device.
  • the device includes: a first acquisition module for acquiring line drawings and initial color prompt information from the user; a first generation module for obtaining the initial color prompt information based on the initial color prompt information. The information is used to color the line draft drawing and generate an initial coloring image of the line draft drawing; a second acquisition module is used to obtain color modification information associated with the initial coloring image from the user; the second generation A module for generating target color prompt information based on the initial color prompt information, the color modification information and the initial coloring image; and a third generation module for coloring the line drawing based on the target color prompt information, Generate a target colored image of the line drawing.
  • An embodiment of the present disclosure also provides an electronic device.
  • the electronic device includes: a processor; and a memory for storing executable instructions by the processor, and the executable instructions are executed by the processor to implement the following: Image processing method according to embodiments of the present disclosure.
  • Embodiments of the present disclosure also provide a computer-readable storage medium, the storage medium stores a computer program, The computer program is executed by a processor for implementing the image processing method according to the embodiments of the present disclosure.
  • An embodiment of the present disclosure also provides a computer program product, the computer program product includes a computer program/instructions, and the computer program/instructions are executed by the processor for implementing the image processing method according to the embodiment of the present disclosure.
  • An embodiment of the present disclosure also provides a computer program, the computer program includes program code, and the program code is executed by the processor for implementing the image processing method according to the embodiment of the present disclosure.
  • Figure 1 is a schematic flowchart of an image processing method according to an embodiment of the present disclosure
  • Figure 2 is a schematic diagram of an image processing scene according to an embodiment of the present disclosure
  • Figure 3 is a schematic diagram of another image processing scenario according to an embodiment of the present disclosure.
  • Figure 4 is a schematic diagram of another image processing scenario according to an embodiment of the present disclosure.
  • Figure 5 is a schematic diagram of another image processing scenario according to an embodiment of the present disclosure.
  • Figure 6 is a schematic flowchart of another image processing method according to an embodiment of the present disclosure.
  • Figure 7 is a schematic diagram of another image processing scenario according to an embodiment of the present disclosure.
  • Figure 8 is a schematic diagram of another image processing scenario according to an embodiment of the present disclosure.
  • Figure 9 is a schematic diagram of another image processing scenario according to an embodiment of the present disclosure.
  • Figure 10 is a schematic flowchart of another image processing method according to an embodiment of the present disclosure.
  • Figure 11 is a schematic flowchart of another image processing method according to an embodiment of the present disclosure.
  • Figure 12 is a schematic structural diagram of an image processing device according to an embodiment of the present disclosure.
  • FIG. 13 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • the term “include” and its variations are open-ended, ie, “including but not limited to.”
  • the term “based on” means “based at least in part on.”
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one additional embodiment”; and the term “some embodiments” means “at least some embodiments”. Relevant definitions of other terms will be given in the description below.
  • embodiments of the present disclosure provide an image processing method.
  • the user only needs to provide simple color prompt information to generate vibrant line drawing coloring results, and at the same time, the coloring image can be Performing fine color modifications not only provides intelligent coloring processing, but also supports refined color modifications, meeting the user's personalized coloring needs and improving coloring efficiency while ensuring the coloring effect.
  • FIG. 1 is a schematic flowchart of an image processing method according to an embodiment of the present disclosure.
  • the method can be executed by an image processing device, where the device can be implemented using software and/or hardware, and can generally be integrated in electronic equipment.
  • the method includes:
  • Step 101 Obtain line drawing and initial color prompt information from the user.
  • the line drawing can be understood as a line drawing that only contains outline information, and the line drawing does not include color filling.
  • the initial color prompt information is used to instruct the coloring of line drawings.
  • the initial color prompt information The display information is different, examples are as follows:
  • the initial color prompt information indicates one or more initial areas in the line drawing specified by the user, and the corresponding initial color to color the one or more areas, wherein, as shown in Figure 2
  • the initial instruction information in this embodiment is in the form of an image.
  • the size of the image is the same as the line drawing.
  • Multiple color identification blocks are distributed in the image (different colors are identified by different grayscale values in the image).
  • the line drawing can be semantically segmented, the initial line drawing is divided into different areas according to the semantic recognition results, the corresponding color identification block in the image corresponding to the initial indication information is identified for each area, and the corresponding The color of the color identifier block is used as the initial color for coloring the area.
  • each part name of the line drawing can be obtained based on semantic recognition, a part name list containing all parts is displayed, and the initial color prompt information input by the user according to the part name list is obtained, wherein the initial The color prompt information can be in the form of text or a selected color block.
  • the displayed part names are “hair”, “cheek”, “eyes” and “mouth”, etc.
  • the user can select a color block or enter text. and other forms to determine the initial colors of parts such as "hair”, “cheeks”, “eyes” and "mouth”.
  • the user can directly select a color reference picture without understanding the name of each color, perform semantic recognition on the color reference picture, identify the reference color of each part, and compare the color reference picture with The line drawing is semantically matched, and the reference color of the successfully matched color reference picture is used as the initial color of the corresponding part of the line drawing.
  • Step 102 Color the line draft drawing based on the initial color prompt information to generate an initial colored image of the line draft drawing.
  • the initial color prompt information reflects the user's personalized initial coloring needs.
  • the line drawing is colored based on the initial color prompt information to generate an initial coloring image of the line drawing.
  • the initial coloring image is filled with color according to the initial color prompt information.
  • the line drawing is colored based on the initial color prompt information, and the initial coloring image of the line drawing is generated in different ways, which are explained as follows:
  • the initial color prompt information indicates one or more initial areas in the line drawing specified by the user and the corresponding initial color to color the one or more areas
  • one or more An initial area and the corresponding initial color and line drawing are input into the first model, where the first model can be understood as a pre-trained model for coloring, and then, the initial coloring image of the line drawing is obtained to obtain the line drawing.
  • An initial colored image of the draft wherein the color of one or more initial areas in the initial colored image is consistent with the initial color.
  • the initial color prompt message The information indicates the initial color of the eye area in the line drawing specified by the user, then the initial color of the eye area and the line drawing are input into the first model, and the eye area in the obtained initial colored image is consistent with the initial color.
  • the pixel area where each area is located is identified based on the semantic recognition segmentation algorithm, and the corresponding pixel area is changed according to the corresponding initial color. The color value of the pixel point to obtain the initial colored image.
  • the initial color prompt information indicates the initial color of the eye area in the line drawing specified by the user, then the eye area in the line drawing is identified, and the color of the pixels in the eye area is modified to the corresponding The initial color to obtain the initial coloring image, where the color of the eye area of the initial coloring image is the corresponding initial color.
  • image areas not included in the initial color prompt information can be skipped, or the color can be automatically filled in by a pre-learned model.
  • Step 103 Obtain color modification information associated with the initial colored image from the user.
  • the color of the initial coloring image can also be modified according to the user's needs to meet the needs of the user.
  • color modification information associated with the initial coloring image is obtained from the user, where the associated color modification information may correspond to a specific one or more areas in the initial coloring image.
  • Step 104 Generate target color prompt information based on the initial color prompt information, color modification information and initial coloring image.
  • target color prompt information is generated based on the initial color prompt information, color modification information and initial coloring image.
  • the target color prompt information reflects the user's behavior in the current scene.
  • the modified area and the modified color indicates one or more target areas in the line drawing specified by the user and the corresponding target color to color the one or more areas.
  • target color prompt information based on the initial color prompt information, color modification information and the initial coloring image will be described in subsequent embodiments and will not be described in detail here.
  • Step 105 Color the line draft drawing based on the target color prompt information to generate a target colored image of the line draft drawing.
  • the line drawing is colored based on the target color prompt information, and a target coloring image of the line drawing is generated.
  • the color of the target area specified by the user in the target coloring image and the target color prompt information are included in the target coloring image.
  • One or more areas are painted with the same target color as the corresponding target.
  • the display form of the target color prompt information may also be an image form, text form, etc. corresponding to the above-mentioned initial color prompt information.
  • the original fill color in the initial colored image is maintained.
  • one or more target areas and corresponding target colors and line drawings can also be input into the first model to obtain a target coloring image of the line drawing, where in the target coloring image The color of one or more target areas matches the target color.
  • the image processing method of the embodiment of the present disclosure is divided into two stages.
  • the first stage referring to Figure 5, in this embodiment, when the line drawing and the initial color prompt information A1 are obtained from the user, the The line drawing is colored according to A1 to obtain the initial colored image C1, and C1 is fully colored, which improves the coloring efficiency.
  • the second stage is entered to obtain the color modification information associated with the initial coloring image from the user.
  • the color modification information is local modification information.
  • the modification is the color of the hair part
  • the target color prompt information A2 is generated.
  • the target color prompt information is used to indicate the target color of the hair part modification, and the line drawing is updated based on the target color prompt information A2. Color, the target coloring image C2 of the line drawing is generated, in which the color of the hair part of C2 is partially modified, thereby meeting the user's refined local color requirements.
  • the image processing method of the embodiment of the present disclosure combines the line drawing and initial color information provided by the user, first performs preliminary coloring on the line drawing to obtain an initial coloring image, and then obtains the associated color modification information.
  • the color modification information and the initial color prompt information generate target color prompt information.
  • the line draft is colored based on the target color prompt information to generate a target colored image of the line draft.
  • the line drawing is automatically colored according to the color prompt information provided by the user. If the user modifies the coloring effect, the line drawing can be further recolored according to the user's modification, which satisfies the user's personalization. The coloring requirement is achieved while ensuring the coloring effect and improving the coloring efficiency.
  • the following illustrates how to obtain the color modification information associated with the initial coloring image with reference to specific embodiments.
  • obtaining color modification information associated with the initial colored image includes:
  • Step 601 In response to the color modification request, the initial coloring image is color-blocked to generate an initial color-block image of the initial coloring image, where the color-block image includes a plurality of color-block areas.
  • the color modification request in response to a color modification request, can be triggered by the user's voice, or by triggering a preset modification control, etc.
  • the initial coloring image is color-blocked to generate an initial color-block image of the initial coloring image, where the color-block image Includes multiple color block areas.
  • the initial coloring image can be input into a second model, which is trained in advance based on a large amount of sample data.
  • the second model can obtain multiple color block areas based on the input initial coloring image and The corresponding area boundary, and then, based on the area boundary, obtain the color mean value of the pixels in the corresponding color block area from the initial coloring image, and use the corresponding color mean value to fill the corresponding area in the multiple color block areas to obtain the initial color block image, thus,
  • the initial coloring image is processed into color block granularity, which facilitates the user's subsequent local modification of the color based on the color block.
  • T1 is input into the corresponding second model to obtain a color block initial color block image T2.
  • T1 is processed into a color block dimension to facilitate subsequent local color modification.
  • semantic recognition can be performed on the initial coloring image to obtain the area where each part is located in the initial coloring image, and all the accompanying single points of the pixels in the area where each part is located are averaged. value, and use the obtained average value as the fill color to fill the area where the corresponding part is located to obtain the initial color block image.
  • Step 602 Obtain color modification information associated with one or more color block areas among multiple color block areas.
  • color modification information associated with one or more color block areas among the plurality of color block areas is obtained, and the color modification information corresponds to the color modification of the part area in the initial color block image.
  • the user can trigger one or more color block areas among multiple color block areas, and enter the modified color of the triggered color block area, or use other colors to paint the corresponding color block area to achieve associated colors. Determination of modified information, etc.
  • target color prompt information is generated based on the initial color prompt information, the color modification information and the initial coloring image.
  • the target color prompt information is generated in different ways. Examples are as follows:
  • the color modification information is used to obtain the target color patch image from the initial color patch image, and the target color patch image includes multiple color patches.
  • the target color patch image is a color patch image after the user has modified the color.
  • Generate target color prompt information based on the target color block image. For example, if the target color prompt information is an image containing a color block logo, the center area and boundary area of the target color block image can be determined, and the pixel values of the center area and boundary area can be determined. Sampling is performed to obtain sampling values of multiple pixels, and target color prompt information is generated based on the average of the sampling values of multiple pixels.
  • the color patch area corresponding to the human eye is modified based on the color corresponding to the color modification information, and we obtain
  • the target color prompt information S is obtained based on the sampling value of the pixel point of each color patch in the target color patch image T6, where S includes the color identification of each color patch in the target color patch image T6.
  • the line drawing can be colored to obtain the target colored image T7. For example, one or more target areas and corresponding target colors and the line drawing are input into the first model to obtain a target coloring image of the line drawing, where the one or more target areas in the target coloring image are The color is consistent with the target color.
  • the pixel area where each color block area of the initial color block image is located is identified based on the semantic recognition segmentation algorithm, based on the The color modification information associated with one or more color block areas in the color block area changes the color value of the pixel point in the corresponding pixel area to obtain the target color block image. Identify the color of each color block in the target color block image according to the preset deep learning model to obtain target color prompt information.
  • the color modification information associated with the initial colored image is flexibly obtained according to the needs of the scene, and the line drawing is processed according to the target color prompt information obtained based on the color modification information. Coloring generates the target coloring image of the line drawing, which greatly improves the flexibility of coloring processing.
  • the first model before using the first model to perform coloring processing, the first model needs to be trained, where the first model can be regarded as a coloring model.
  • the coloring prompt model is trained through the following steps:
  • Step 1001 Obtain the first sample line drawing corresponding to the first sample image.
  • the first sample image may be a color-filled image.
  • the outline of the first sample image may be identified through an outline recognition algorithm or the like to obtain the first sample line drawing.
  • Step 1002 Obtain initial sample color prompt information from the first sample image.
  • the initial sample color prompt information is obtained directly from the first sample image, where the initial sample This color information is used to indicate the initial color of each sample area in the first sample image.
  • Step 1003 Color the first sample line drawing based on the initial sample color prompt information according to the first model to be trained, and generate an initial sample coloring image of the first sample line drawing.
  • the first model to be trained is built in advance, and the first sample line drawing is colored based on the initial sample color prompt information according to the first model to be trained, and the initial sample line drawing of the first sample is generated.
  • a swatch shading image where the initial swatch shading image contains a fill color.
  • Step 1004 Generate a first target loss function based on the initial sample coloring image and the first sample image.
  • the algorithms for calculating the first target loss function are different.
  • one or more of the following algorithms can be used to calculate the first target loss function:
  • the average absolute error of the pixel color between each pixel in the initial sample colored image and each pixel in the first sample image is calculated to obtain the reconstruction loss function.
  • the mean absolute error of all pixels can be used as the reconstruction loss function, etc.
  • the mean square error of the color value of the pixel between each pixel in the initial sample color image and each pixel in the first sample color image is calculated to obtain the style loss function.
  • the average mean square error of all pixels can be used as the style loss function, etc.
  • the initial sample color image and the first sample color image are processed according to a preset discriminator model to obtain an adversarial loss function.
  • the discriminator model can be a generative adversarial network (GAN).
  • GAN generative adversarial network
  • the discriminator module in Adversarial Networks), etc.
  • Step 1005 according to the initial sample coloring image and the first sample image, and based on the back propagation of the first target loss function, train the parameters of the first model, wherein the parameters can be used to generate the coloring as the first model Prompt model.
  • the parameters of the first model are trained to generate the coloring prompt model.
  • the first model obtains When the loss value of the first target loss function is less than the preset loss threshold, the training of the model parameters is completed.
  • the second model is an image segmentation model. As shown in Figure 11, the image segmentation model is trained through the following steps:
  • Step 1101 Obtain the second sample image.
  • the second sample image may be a color filled image, etc.
  • Step 1102 Perform area segmentation on the second sample image, and mark multiple sample color block areas and corresponding area boundaries of the second sample image.
  • region segmentation is performed on the second sample image, and multiple sample color block regions and corresponding region boundaries of the second sample image are marked.
  • the second sample image can be segmented based on a pre-trained region segmentation model. For segmentation, you can also perform semantic analysis on the second sample image, and divide the same part into a sample color block area based on the semantic recognition results.
  • Step 1103 Process the second sample image according to the second model to be trained to generate a reference color patch area and corresponding area boundaries.
  • a second model for color block segmentation is constructed in advance, the second sample image is processed according to the second model to be trained, and a reference color block area and corresponding area boundaries are generated.
  • Step 1104 Generate a second target loss function based on the reference color block area and corresponding area boundaries and the sample color block area and corresponding area boundaries.
  • the second target loss function is generated based on the reference color block area and corresponding area boundaries and the sample color block area and corresponding area boundaries.
  • the algorithms for calculating the second target loss function are different.
  • one or more of the following algorithms can be used to calculate the second target loss function:
  • calculate the average absolute error of pixel color between each pixel in the reference color patch area and each pixel in the corresponding sample color patch area obtain the first reconstruction loss function, and calculate the reference color patch area
  • the average absolute error between the position information of each pixel at the corresponding area boundary and the position information at each pixel at the corresponding area boundary of the sample color block area is used to obtain the second reconstruction loss function, based on the first reconstruction loss function and the third
  • the second reconstruction loss function obtains the reconstruction loss function between corresponding color block areas. For example, the reconstruction loss function between corresponding color block areas is obtained based on the mean value of the first reconstruction loss function and the reconstruction loss function.
  • calculate the mean square error of pixel color between each pixel in the reference color patch area and each pixel in the corresponding sample color patch area obtain the first style loss function, and calculate the reference color patch area between the position information of each pixel point at the corresponding area boundary of the sample color block area and the position information of each pixel point at the corresponding area boundary of the sample color block area mean square error, obtain the second style loss function, and obtain the second style loss function between the corresponding color block areas based on the first style loss function and the second style loss function, for example, based on the first style loss function and the second style
  • the mean value of the loss function obtains the style loss function between the corresponding color patch areas.
  • the reference color block area, the sample color block area and the corresponding area boundaries are processed according to a preset discriminator model to obtain an adversarial loss function.
  • the discriminator model can be a discriminator in a generative adversarial network. processor module, etc.
  • Step 1105 according to the reference color patch area and the sample color patch area, and based on the back propagation of the second target loss function, train the parameters of the second model, where the parameters can be used to generate an image segmentation model as the second model.
  • the parameters of the second model are trained for generating the image block model.
  • the second model obtains
  • the loss value of the second target loss function is less than the preset loss threshold
  • the training of the model parameters is completed.
  • the preset loss threshold can be set in various appropriate ways, such as inferring based on historical data, or setting based on experience, etc., which will not be described in detail here.
  • the training process of the first model and the second model may be performed in various appropriate ways, in particular, in an iterative or cyclic manner.
  • iterations/loops of model training may be performed in any suitable manner.
  • the processing results of the model can be analyzed during the training process in each iteration/loop, and if the processing results meet specific conditions, the training process is terminated to obtain the target object flow model.
  • the training process in each iteration or loop can be performed as described above, and after the training process in each iteration/loop is executed, it can be judged whether the target loss function is less than the preset threshold, and if it is less, the iteration is stopped. or loop to complete model training. Otherwise, if it is not less than, continue the iteration or loop.
  • the training process can be terminated after a specific number of cycles to obtain the target object flow model.
  • the loop/iteration may stop.
  • the number of training processes can also be set in an appropriate manner in the art, which will not be described in detail here.
  • the image processing method of the embodiment of the present disclosure trains the first model and the second model based on model training, so as to perform coloring processing according to the first model and perform image block processing according to the second model without manual participation. , reducing the cost of coloring and improving coloring efficiency.
  • model training process/model training stage described above especially the training process of the first model and the second model, is optional for the solution of the present disclosure.
  • a model training process/model training phase can
  • the information included in the image processing method of the present disclosure may also be located outside the image processing method of the present disclosure, and be acquired and applied by the image processing method of the present disclosure. It should be noted that even if the model training process/model training stage is not included, the image processing method of the present disclosure is still complete and can achieve advantageous technical effects.
  • the present disclosure also provides an image processing device.
  • Figure 12 is a schematic structural diagram of an image processing device according to an embodiment of the present disclosure.
  • the device can be implemented by software and/or hardware, and can generally be integrated in electronic equipment.
  • the device includes: a first acquisition module 1210, a first generation module 1220, a second acquisition module 1230, a second generation module 1240, and a third generation module 1250, wherein,
  • the first acquisition module 1210 is used to acquire line drawings and initial color prompt information from the user;
  • the first generation module 1220 is used to color the line drawing based on the initial color prompt information and generate an initial coloring image of the line drawing;
  • the second acquisition module 1230 is used to acquire color modification information associated with the initial coloring image from the user;
  • the second generation module 1240 is used to generate target color prompt information based on the initial color prompt information, color modification information and initial coloring image;
  • the third generation module 1250 is used to color the line drawing based on the target color prompt information and generate a target coloring image of the line drawing.
  • the image processing device provided by the embodiments of the present disclosure can execute the image processing method provided by any embodiment of the present disclosure, and has functional modules and beneficial effects corresponding to the execution method.
  • modules are only logical modules divided according to the specific functions they implement, and are not used to limit specific implementation methods. For example, they can be implemented in software, hardware, or a combination of software and hardware. In actual implementation, each of the above modules may be implemented as an independent physical entity, or may be implemented by a single entity (for example, a processor (CPU or DSP, etc.), an integrated circuit, etc.). In addition, the various modules mentioned above are shown with dotted lines in the drawings to indicate that these modules may not actually exist, and the operations/functions they implement may be implemented by the device or processing circuit itself.
  • the device may also include a memory that may store various information generated by the operation of the device, various modules included in the device, programs and data for operations, data to be sent by the communication unit, etc. .
  • the memory may be volatile memory and/or non-volatile memory.
  • memory may include, but is not limited to, random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), read only memory (ROM), and flash memory.
  • RAM random access memory
  • DRAM dynamic random access memory
  • SRAM static random access memory
  • ROM read only memory
  • flash memory any type of the device may also be located external to the device.
  • the image processing device of the embodiment of the present disclosure combined with the line drawing and initial color information provided by the user, first performs preliminary coloring on the line drawing to obtain an initial coloring image, and then obtains the associated color modification information.
  • the color Modify the information and initial color prompt information to generate target color prompt information.
  • color the line draft drawing based on the target color prompt information to generate a target coloring image of the line draft drawing.
  • the line drawing is automatically colored according to the color prompt information provided by the user. If the user modifies the coloring effect, the line drawing can be further recolored according to the user's modification, which satisfies the user's personalization. The coloring requirement is achieved while ensuring the coloring effect and improving the coloring efficiency.
  • the present disclosure also proposes a computer program product, which includes a computer program/instruction.
  • a computer program product which includes a computer program/instruction.
  • the image processing method described in the embodiment of the present disclosure is implemented.
  • a data processing device including: a memory and a processor, wherein a computer program is stored on the memory, and when executed by the processor, the computer program can implement the implementation of the present disclosure.
  • a computer program is stored on the memory, and when executed by the processor, the computer program can implement the implementation of the present disclosure.
  • a computer program is also provided.
  • the computer program includes program code, and when executed by a processor, the program code implements the image processing method described in the embodiment of the present disclosure.
  • FIG. 13 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • the electronic device 1300 in the embodiment of the present disclosure may include, but is not limited to, mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablets), PMPs (portable multimedia players), vehicle-mounted terminals ( Mobile terminals such as car navigation terminals) and fixed terminals such as digital TVs, desktop computers, etc.
  • the electronic device shown in FIG. 13 is only an example and should not bring any limitations to the functions and scope of use of the embodiments of the present disclosure.
  • the electronic device 1300 may include a processing device (eg, central processing unit, graphics processor, etc.) 1301, which may be loaded into a random access device according to a program stored in a read-only memory (ROM) 1302 or from a storage device 1308.
  • the program in the memory (RAM) 1303 executes various appropriate actions and processes.
  • various programs and data required for the operation of the electronic device 1300 are also stored.
  • the processing device 1301, ROM 1302 and RAM 1303 are connected to each other via a bus 1304.
  • An input/output (I/O) interface 1305 is also connected to bus 1304.
  • the following devices may be connected to the I/O interface 1305: input devices 1306 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibration An output device 1307 such as a computer; a storage device 1308 including a magnetic tape, a hard disk, etc.; and a communication device 1309.
  • the communication device 1309 may allow the electronic device 1300 to communicate wirelessly or wiredly with other devices to exchange data.
  • FIG. 13 illustrates electronic device 1300 with various means, it should be understood that implementation is not required. or with all the means shown. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product including a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart.
  • the computer program may be downloaded and installed from the network via communication device 1309, or from storage device 1308, or from ROM 1302.
  • the processing device 1301 When the computer program is executed by the processing device 1301, the above-mentioned functions defined in the image processing method of the embodiment of the present disclosure are performed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium may be, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any combination thereof. More specific examples of computer readable storage media may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard drive, random access memory (RAM), read only memory (ROM), removable Programmd read-only memory (EPROM or flash memory), fiber optics, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wire, optical cable, RF (radio frequency), etc., or any suitable combination of the above.
  • the client and server can communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can communicate with digital data in any form or medium.
  • Communications e.g., communications network
  • communications networks include local area networks (“LAN”), wide area networks (“WAN”), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or developed in the future network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; it may also exist independently without being assembled into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs.
  • the electronic device When the above-mentioned one or more programs are executed by the electronic device, the electronic device: combines the line drawing and initial color information provided by the user, first performs the line drawing drawing The initial coloring image is obtained through preliminary coloring, and then the associated color modification information is obtained, and the target color prompt information is generated based on the color modification information and the initial color prompt information. Secondly, the line draft is colored based on the target color prompt information to generate Line drawing target coloring image. As a result, the line drawing is automatically colored according to the color prompt information provided by the user. If the user modifies the coloring effect, the line drawing can be further recolored according to the user's modification, which satisfies the user's personalization. The coloring requirement is achieved while ensuring the coloring effect and improving the coloring efficiency.
  • Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages—such as "C” or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as an Internet service provider through Internet connection).
  • LAN local area network
  • WAN wide area network
  • Internet service provider such as an Internet service provider through Internet connection
  • each block in the flowchart or block diagram may represent a module, segment, or portion of code that contains one or more logic functions that implement the specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown one after another may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved.
  • each block of the block diagram and/or flowchart illustration, and combinations of blocks in the block diagram and/or flowchart illustration can be implemented by special purpose hardware-based systems that perform the specified functions or operations. , or can be implemented using a combination of specialized hardware and computer instructions.
  • the units involved in the embodiments of the present disclosure can be implemented in software or hardware. Among them, the name of a unit does not constitute a limitation on the unit itself under certain circumstances.
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSPs Application Specific Standard Products
  • SOCs Systems on Chips
  • CPLD Complex Programmable Logical device
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with an instruction execution system, apparatus, or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, laptop disks, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM portable compact disk read-only memory
  • magnetic storage device or any suitable combination of the above.
  • the present disclosure provides an image processing method, including: obtaining a line drawing and initial color prompt information from a user;
  • the line drawing is colored based on the target color prompt information to generate a target colored image of the line drawing.
  • the initial color prompt information indicates one or more initial areas in the line drawing specified by the user and the information to be processed. The corresponding initial color to color one or more areas.
  • coloring the line drawing based on the initial color prompt information and generating an initial coloring image of the line drawing includes:
  • the one or more initial areas and the corresponding initial colors and the line drawing are input into the first model to obtain an initial colored image of the line drawing, wherein the one or more initial colored images
  • the color of each initial area is consistent with the initial color.
  • obtaining color modification information associated with an initial colored image includes:
  • Color modification information associated with one or more color patch areas among the plurality of color patch areas is obtained.
  • color blocking the initial coloring image and generating an initial color block image of the initial coloring image includes:
  • Corresponding areas of the plurality of color patch areas are filled with corresponding color averages to obtain an initial color patch image.
  • generating target color prompt information based on the initial color prompt information, the color modification information and the initial coloring image includes:
  • Target color prompt information is generated based on the target color block image.
  • the target color prompt information indicates one or more target areas in the line drawing specified by the user and the area to be colored in the one or more areas. Corresponding target color.
  • coloring the line drawing based on target color prompt information and generating a target coloring image of the line drawing includes:
  • the one or more target areas and the corresponding target colors and the line drawing are input into the first model to obtain a target coloring image of the line drawing, wherein the one of the target coloring images
  • the color of the or multiple target areas is consistent with the target color.
  • the first model is a coloring prompt model
  • the coloring prompt model is trained through the following steps:
  • parameters of the first model are trained to generate the coloring hint model.
  • the second model is an image segmentation model
  • the image segmentation model It is trained through the following steps:
  • the parameters of the second model are trained to generate the image block model.
  • the present disclosure provides an image processing device, including: a first acquisition module, configured to acquire line drawings and initial color prompt information from a user;
  • a first generation module configured to color the line draft drawing based on the initial color prompt information and generate an initial coloring image of the line draft drawing
  • a second acquisition module configured to acquire color modification information associated with the initial colored image from the user
  • a second generation module configured to generate target color prompt information based on the initial color prompt information, the color modification information and the initial coloring image
  • the third generation module is used to color the line draft drawing based on the target color prompt information and generate a target coloring image of the line draft drawing.
  • the initial color prompt information indicates one or more initial areas in the line drawing specified by the user and the area to be colored in the one or more areas. Corresponding initial color.
  • the first generation module is specifically used to:
  • the one or more initial areas and the corresponding initial colors and the line drawing are input into the first model to obtain an initial colored image of the line drawing, wherein the one or more initial colored images
  • the color of each initial area is consistent with the initial color.
  • the second acquisition module is specifically used to:
  • Color modification information associated with one or more color patch areas among the plurality of color patch areas is obtained.
  • the second acquisition module is specifically configured to: input the initial coloring image into the second model, determine the multiple color patch areas of the initial coloring image and corresponding area boundaries;
  • Corresponding areas of the plurality of color patch areas are filled with corresponding color averages to obtain an initial color patch image.
  • the second acquisition module is specifically configured to: based on the color modification information associated with the one or more color patch areas among the multiple color patch areas, obtain from The initial color patch image acquires a target color patch image, where the target color patch image includes a plurality of color patches;
  • Target color prompt information is generated based on the target color block image.
  • the target color prompt information indicates one or more target areas in the line drawing specified by the user and the area to be colored in the one or more areas. Corresponding target color.
  • the third generation module is specifically used to:
  • the one or more target areas and the corresponding target colors and the line drawing are input into the first model to obtain a target coloring image of the line drawing, wherein the one of the target coloring images
  • the color of the or multiple target areas is consistent with the target color.
  • the first model is a coloring prompt model
  • the device further includes: a first training module, used for:
  • parameters of the first model are trained to generate the coloring hint model.
  • the second model is an image block model
  • the device further includes: a second training module, used for:
  • the second sample image is processed according to the second model to be trained, and a reference color block area and corresponding area are generated. domain boundaries;
  • the parameters of the second model are trained to generate the image block model.
  • the present disclosure provides an electronic device, including:
  • memory for storing instructions executable by the processor
  • the processor is configured to read the executable instructions from the memory and execute the instructions to implement any of the image processing methods provided by this disclosure.
  • the present disclosure provides a computer-readable storage medium, the storage medium stores a computer program, the computer program is used to execute any one of the images provided by the present disclosure. Approach.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Processing Or Creating Images (AREA)
  • Image Generation (AREA)

Abstract

本公开实施例涉及图像处理方法、装置、设备及介质,其中该方法包括:从用户获取线稿图和初始颜色提示信息;基于初始颜色提示信息对线稿图进行上色,生成线稿图的初始上色图像;从用户获取与初始上色图像相关联的颜色修改信息;基于初始颜色提示信息、颜色修改信息和初始上色图像,生成目标颜色提示信息;以及基于目标颜色提示信息对线稿图进行上色,生成线稿图的目标上色图像。

Description

图像处理方法、装置、设备及介质
相关申请的交叉引用
本申请是以申请号为202210443514.9、申请日为2022年4月25日的中国申请为基础,并主张其优先权,该中国申请的公开内容在此作为整体引入本申请中。
技术领域
本公开涉及计算机应用技术领域,尤其涉及一种图像处理方法、装置、设备及介质。
背景技术
对线稿图像进行上色处理是一种常见的图像处理手段,比如,在创建游戏中的二次元角色时,对二次元角色进行上色处理等,属于创建游戏角色的常见需求。
发明内容
为了解决上述技术问题或者至少部分地解决上述技术问题,本公开提供了一种图像处理方法、装置、设备及介质。
本公开实施例提供了一种图像处理方法,所述方法包括:从用户获取线稿图和初始颜色提示信息;基于所述初始颜色提示信息对所述线稿图进行上色,生成所述线稿图的初始上色图像;从所述用户获取与初始上色图像相关联的颜色修改信息;基于初始颜色提示信息、所述颜色修改信息和初始上色图像,生成目标颜色提示信息;以及基于目标颜色提示信息对所述线稿图进行上色,生成所述线稿图的目标上色图像。
本公开实施例还提供了一种图像处理装置,所述装置包括:第一获取模块,用于从用户获取线稿图和初始颜色提示信息;第一生成模块,用于基于所述初始颜色提示信息对所述线稿图进行上色,生成所述线稿图的初始上色图像;第二获取模块,用于从所述用户获取与初始上色图像相关联的颜色修改信息;第二生成模块,用于基于初始颜色提示信息、所述颜色修改信息和初始上色图像,生成目标颜色提示信息;以及第三生成模块,用于基于目标颜色提示信息对所述线稿图进行上色,生成所述线稿图的目标上色图像。
本公开实施例还提供了一种电子设备,所述电子设备包括:处理器;用于存储所述处理器可执行指令的存储器,所述可执行指令由所述处理器执行以用于实现如本公开实施例的图像处理方法。
本公开实施例还提供了一种计算机可读存储介质,所述存储介质存储有计算机程序, 所述计算机程序由处理器执行以用于实现如本公开实施例的图像处理方法。
本公开实施例还提供了一种计算机程序产品,所述计算机程序产品包括计算机程序/指令,所述计算机程序/指令由所述处理器执行以用于实现如本公开实施例的图像处理方法。
本公开实施例还提供了一种计算机程序,所述计算机程序包括程序代码,所述程序代码由所述处理器执行以用于实现如本公开实施例的图像处理方法。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。
图1为本公开实施例的一种图像处理方法的流程示意图;
图2为本公开实施例的一种图像处理场景示意图;
图3为本公开实施例的另一种图像处理场景示意图;
图4为本公开实施例的另一种图像处理场景示意图;
图5为本公开实施例的另一种图像处理场景示意图;
图6为本公开实施例的另一种图像处理方法的流程示意图;
图7为本公开实施例的另一种图像处理场景示意图;
图8为本公开实施例的另一种图像处理场景示意图;
图9为本公开实施例的另一种图像处理场景示意图;
图10为本公开实施例的另一种图像处理方法的流程示意图;
图11为本公开实施例的另一种图像处理方法的流程示意图;
图12为本公开实施例的一种图像处理装置的结构示意图;
图13为本公开实施例的一种电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
在对线稿图像进行上色处理的相关技术中,由相关技术人员在拿到线稿图像后,基于个人的经验以及上色需求文档,采用有关应用的上色功能进行上色处理。若是用户对上色结果不满意,需要擦除对应的颜色重新进行上色。然而,上述对线稿上色的处理过程中,依赖于用户的人工上色,对线稿上色不满意时,依赖于用户的人工修改,导致上色的效率较低。
为了解决上述问题,本公开实施例提供了一种图像处理方法,在该方法中,用户仅仅需要提供简单的颜色提示信息,就可生成精美的线稿上色结果,同时还可对上色图像进行精细的颜色修改,不仅提供智能的上色处理,还支持精细化颜色的修改,满足了用户的个性化上色需求,实现了在保证上色效果的基础上,提升了上色效率。
下面结合具体的实施例对该方法进行介绍。
图1为本公开实施例的一种图像处理方法的流程示意图,该方法可以由图像处理装置执行,其中该装置可以采用软件和/或硬件实现,一般可集成在电子设备中。如图1所示,该方法包括:
步骤101,从用户获取线稿图和初始颜色提示信息。
其中,线稿图可以理解为仅仅包含轮廓信息的线条图,线稿图不包含颜色填充。
另外,初始颜色提示信息用于指示线稿图的上色,在不同的应用场景中,初始颜色提 示信息不同,示例如下:
在本公开的一个实施例中,初始颜色提示信息指示用户指定的线稿图中的一个或多个初始区域、以及要对一个或多个区域进行上色的相应初始颜色,其中,如图2所示,本实施例中的初始指示信息为图像形式,该图像的尺寸和线稿图相同,在该图像中分布多个颜色标识块(图中以灰度值的不同标识不同的颜色),在实际应用时,可以对线稿图进行语义分割,根据语义识别结果将初始线稿切分为不同的区域,识别每个区域在初始指示信息对应的图像中对应的颜色标识块,将对应的颜色标识块的颜色作为该区域上色的初始颜色。
在本公开的另一个实施例中,可以根据语义识别得到线稿图的每个部位名称,显示包含所有部位的部位名称列表,获取用户根据部位名称列表输入的初始颜色提示信息,其中,该初始颜色提示信息可以是文字形式,也可以是选择的颜色色块等,比如,显示的部位名称为“头发”、“脸颊”、“眼睛”和“嘴巴”等,用户通过选择色块或者输入文字等形式确定“头发”、“脸颊”、“眼睛”和“嘴巴”等部位的初始颜色。
在本公开的另一个实施例中,用户可以无需理解每个颜色的名称等,直接选择一个彩色参考图,通过对彩色参考图进行语义识别,识别每个部位的参考颜色,将彩色参考图与线稿图进行语义匹配,将匹配成功的彩色参考图的参考颜色作为线稿图对应部位的初始颜色。
步骤102,基于初始颜色提示信息对线稿图进行上色,生成线稿图的初始上色图像。
容易理解的是,初始颜色提示信息体现了用户的初始上色个性化需求,此时,基于初始颜色提示信息对线稿图进行上色,生成线稿图的初始上色图像。其中,初始上色图像中根据初始颜色提示信息进行了颜色填充。
其中,在不同的应用场景中,基于初始颜色提示信息对线稿图进行上色,生成线稿图的初始上色图像的方式不同,说明如下:
在本公开的一个实施例中,当初始颜色提示信息指示用户指定的线稿图中的一个或多个初始区域以及要对一个或多个区域进行上色的相应初始颜色时,将一个或多个初始区域以及相应的初始颜色和线稿图输入第一模型,其中,第一模型可以理解为预先训练的用于上色的模型,进而,获取线稿图的初始上色图像,以获取线稿图的初始上色图像,其中,初始上色图像中一个或多个初始区域的颜色与初始颜色一致。
举例而言,如图3所示(图中仅示出被指示的区域的颜色的变化),初始颜色提示信 息指示用户指定的线稿图中的眼睛区域的初始颜色,则将眼睛区域的初始颜色和线稿图输入第一模型,得到的初始上色图像中的眼睛区域和初始颜色一致。
在本公开的另一个实施例中,当初始颜色提示信息包含与每个区域对应的初始颜色时,则基于语义识别分割算法识别每个区域所在的像素区域,根据对应的初始颜色更改对应像素区域的像素点的颜色值,以得到的初始上色图像。
举例而言,如图4所示,初始颜色提示信息指示用户指定的线稿图中的眼睛区域的初始颜色,则识别线稿图中的眼睛区域,将眼睛区域的像素点的颜色修改为对应的初始颜色,以得到初始上色图像,其中,初始上色图像的眼睛区域的颜色为对应的初始颜色。
其中,对于初始颜色提示信息不包含的图像区域,可以跳过,也可由预先学习得到的模型自动填充颜色。
步骤103,从用户获取与初始上色图像相关联的颜色修改信息。
在实际执行过程中,可能用户对初始上色图像并不满意,在本实施例中,为了更好的满足用户的个性化需求,还可以针对用户需求对初始上色图像进行颜色修改,以满足用户的局部精细化修改需求,进一步提升了上色的灵活性。
在本实施例中,从用户获取与初始上色图像相关联的颜色修改信息,其中,该相关联的颜色修改信息可以与初始上色图像中的具体的某一个或者多个区域对应等。
步骤104,基于初始颜色提示信息、颜色修改信息和初始上色图像,生成目标颜色提示信息。
在本公开的一个实施例中,在获取初始颜色提示信息后,根据初始颜色提示信息、颜色修改信息和初始上色图像,生成目标颜色提示信息,该目标颜色提示信息体现了用户在当前场景下修改的区域以及修改的颜色。目标颜色提示信息指示用户指定的线稿图中的一个或多个目标区域以及要对一个或多个区域进行上色的相应目标颜色。
其中,基于初始颜色提示信息、颜色修改信息和初始上色图像,生成目标颜色提示信息将在后续实施例进行说明,在此不再赘述。
步骤105,基于目标颜色提示信息对线稿图进行上色,生成线稿图的目标上色图像。
在本实施例中,基于目标颜色提示信息对线稿图进行上色,生成线稿图的目标上色图像,该目标上色图像中用户指定的目标区域的颜色和目标颜色提示信息中包含的对一个或多个区域进行上色的相应目标颜色一致。其中,目标颜色提示信息的显示形式,也可以为上述提到的初始颜色提示信息对应的图像形式、文字形式等。
其中,对于目标颜色提示信息不包含的图像区域,保持初始上色图像中原有的填充颜色。
同样的,在本实施例中,也可以将一个或多个目标区域以及相应的目标颜色和线稿图输入第一模型,以获取线稿图的目标上色图像,其中,目标上色图像中一个或多个目标区域的颜色与目标颜色一致。
由此,本公开实施例的图像处理方法分为两个阶段,举例而言,第一阶段,参照图5,在本实施例中,从用户获取线稿图和初始颜色提示信息A1时,对线稿图根据A1上色得到初始上色图像C1,C1得到了全部上色,提升了上色效率。
若是用户对C1的上色效果不满意,则进入第二阶段,从用户获取与初始上色图像相关联的颜色修改信息,该颜色修改信息为局部修改信息,若是修改的为头发部分的颜色,基于初始颜色提示信息、颜色修改信息和初始上色图像,生成目标颜色提示信息A2,该目标颜色提示信息中用于指示头发部位修改的目标颜色,基于目标颜色提示信息A2对线稿图进行上色,生成线稿图的目标上色图像C2,其中,C2头发部位的颜色得到了局部修改,由此,满足了用户的精细化的局部颜色需求的需求。
综上,本公开实施例的图像处理方法,结合用户提供的线稿图和初始颜色信息,首先对线稿图进行初步上色得到初始上色图像,进而,获取关联的颜色修改信息,根据该颜色修改信息、初始颜色提示信息生成目标颜色提示信息,其次,基于目标颜色提示信息对线稿图进行上色,生成线稿图的目标上色图像。由此,根据用户提供的颜色提示信息对线稿图进行自动的上色处理,用户若是对上色效果修改,则可以进一步根据用户的修改对线稿重新上色处理,满足了用户的个性化上色需求,实现了在保证上色效果的基础上,提升了上色效率。
下面结合具体实施例示例性说明,如何获取与初始上色图像相关联的颜色修改信息。
在本公开的一个实施例中,如图6所示,获取与初始上色图像相关联的颜色修改信息,包括:
步骤601,响应于颜色修改请求,对初始上色图像进行色块化,生成初始上色图像的初始色块图像,其中,色块图像包括多个色块区域。
在本实施例中,响应于颜色修改请求,该颜色修改请求可以是用户语音触发的,也可以是通过触发预设的修改控件等触发的等,为了便于用户进行局部精细化修改,在本实施例中,对初始上色图像进行色块化,生成初始上色图像的初始色块图像,其中,色块图像 包括多个色块区域。
在一些可能的实施例中,可以将初始上色图像输入第二模型,该第二模型预先根据大量样本数据训练得到,第二模型可以根据输入的初始上色图像,得到多个色块区域以及相应区域边界,进而,基于区域边界从初始上色图像获取相应色块区域内的像素的颜色均值,使用相应颜色均值填充多个色块区域中的相应区域,以获取初始色块图像,从而,将初始上色图像处理为色块粒度,便于用户后续基于色块进行颜色的局部修改。
举例而言,如图7所示(图中以灰度值的不同的标识不同的色块区域,且以不包含线条轮廓标识的色块组成的区域标识对应的色块区域),在得到的初始上色图像为T1时,将T1输入对应的第二模型,得到色块化的初始色块图像T2,由此,将T1处理为色块维度,便于进行后续的局部颜色修改。
在本公开的一个实施例中,可以对初始上色图像进行语义识别,以得到初始上色图像中每个部位所在的区域,将每个部位所在的区域的像素点的所有相随单取平均值,将得到的平均值作为填充颜色填充对应部位所在的区域,以得到初始色块图像。
举例而言,如图8所示(图中以灰度值的不同的标识不同的色块区域,且以不包含线条轮廓标识的色块组成的区域标识对应的色块区域),在得到的初始上色图像为T3时,将T3进行语义识别,得到该T3中对应的部位为“眼睛”、“嘴巴”、“头发”等,对每个部位所在区域色块化得到初始色块图像T4,由此,将T3处理为色块维度,便于进行后续的局部颜色修改。
步骤602,获取与多个色块区域中的一个或多个色块区域相关联的颜色修改信息。
在得到初始色块图像后,获取与多个色块区域中的一个或多个色块区域相关联的颜色修改信息,该颜色修改信息对应于对初始色块图像中部位区域的颜色修改。
其中,用户可以通过触发多个色块区域中的一个或多个色块区域,并通过输入触发的色块区域的修改颜色,或者是采用其他颜色涂抹对应的色块区域,以实现关联的颜色修改信息的确定等。
进一步地,在获取颜色修改信息后,基于初始颜色提示信息、所述颜色修改信息和初始上色图像,生成目标颜色提示信息。
其中,在不同的应用场景中,基于初始颜色提示信息、颜色修改信息和初始上色图像,生成目标颜色提示信息的方式不同,示例如下:
在本公开的一个实施例中,基于与多个色块区域中的一个或多个色块区域相关联的颜 色修改信息,从初始色块图像获取目标色块图像,目标色块图像包括多个色块。该目标色块图像是用户修改颜色后的色块图像。基于目标色块图像生成目标颜色提示信息,比如,若是该目标颜色提示信息为包含色块标识的图像,则可以确定目标色块图像的中心区域和边界区域,对中心区域和边界区域的像素值进行采样,获取欧多个像素的采样值,根据多个像素的采样值的平均值生成目标颜色提示信息。
举例而言,如图9所示,基于与初始色块图像T5的颜色修改信息,对于与人眼对应的色块区域,则基于颜色修改信息对应的颜色修改人眼对应的色块区域,得到目标色块图像T6,基于对目标色块图像T6中每个色块的像素点的采样值,得到目标颜色提示信息S,其中,S包含目标色块图像T6中每个色块的颜色标识。进而,根据S可以对线稿图上色处理得到目标上色图像T7。比如,将一个或多个目标区域以及相应的目标颜色和所述线稿图输入第一模型,以获取线稿图的目标上色图像,其中,目标上色图像中一个或多个目标区域的颜色与所述目标颜色一致。
在本公开的另一个实施例中,当初始颜色提示信息包含与每个区域对应的初始颜色时,则基于语义识别分割算法识别初始色块图像每个色块区域所在的像素区域,基于与多个色块区域中的一个或多个色块区域相关联的颜色修改信息,更改对应像素区域的像素点的颜色值,以得到目标色块图像。根据预设的深度学习模型识别目标色块图像中每个色块的颜色以得到目标颜色提示信息。
综上,本公开实施例的图像处理方法中,根据场景需要灵活的获取与初始上色图像相关联的颜色修改信息,以及根据基于颜色修改信息得到的目标颜色提示信息对所述线稿图进行上色,生成所述线稿图的目标上色图像,大大提升了上色处理的灵活性。
根据本公开的实施例,在采用第一模型进行上色处理之前,需要对第一模型进行训练,其中,第一模型可以看作为上色模型。
在本公开的一个实施例中,如图10所示,若是第一模型为上色提示模型,则上色提示模型通过以下步骤训练得到:
步骤1001,获取与第一样本图像对应的第一样本线稿图。
在本实施例中,第一样本图像可以为颜色填充的图像,在本实施例中,可以通过轮廓识别算法等识别第一样本图像的轮廓,以得到第一样本线稿图。
步骤1002,从第一样本图像中获取初始样本颜色提示信息。
在本实施例中,直接从第一样本图像中获取初始样本颜色提示信息,其中,该初始样 本颜色信息用于指示第一样本图像中各个样本区域的初始颜色。
步骤1003,根据待训练的第一模型基于初始样本颜色提示信息对第一样本线稿图进行上色,生成第一样本线稿图的初始样本上色图像。
在本实施例中,预先搭建待训练的第一模型,根据待训练的第一模型基于初始样本颜色提示信息对第一样本线稿图进行上色,生成第一样本线稿图的初始样本上色图像,其中,初始样本上色图像中包含了填充颜色。
步骤1004,根据初始样本上色图像和第一样本图像生成第一目标损失函数。
应当理解的是,初始样本上色图像理论上的上色效果应该和第一样本图像一致,因此,为了判断待训练的第一模型的模型参数是否训练完毕,根据初始样本上色图像和第一样本图像生成第一目标损失函数。
其中,在不同的应用场景中,计算第一目标损失函数的算法不同,比如,可以使用如下的算法中的一个或多个来计算第一目标损失函数:
在一些可能的实施例中,计算初始样本上色图像中每个像素和第一样本图像中每个像素之间的像素颜色的平均绝对误差,获取重建损失函数。比如,可以将所有像素的平均绝对误差的均值作为重建损失函数等。
在一些可能的实施例中,计算初始样本上色图像中每个像素和第一样本彩色图像中每个像素之间像素的颜色值的均方误差,获取风格损失函数。比如,可以将所有像素的平均均方误差作为风格损失函数等。
在一些可能的实施例中,根据预设的判别器模型对初始样本上色图像和第一样本彩色图像进行处理,获取对抗损失函数,该判别器模型可以为生成式对抗网络(GAN,Generative Adversarial Networks)中的判别器模块等。
步骤1005,根据初始样本上色图像和第一样本图像,并基于第一目标损失函数的反向传播,训练第一模型的参数,其中该参数可被用于生成作为第一模型的上色提示模型。
在本实施例中,根据初始样本上色图像和第一样本图像,并基于第一目标损失函数的反向传播,训练第一模型的参数,以便生成上色提示模型,当第一模型得到的第一目标损失函数的损失值小于预设损失阈值时,完成对模型参数的训练。
同样的,在采用第二模型进行色块化处理之前,还需要对第二模型进行训练。在本公开的一个实施例中,第二模型为图像分块模型,如图11所示,图像分块模型通过以下步骤训练得到:
步骤1101,获取第二样本图像。
其中,第二样本图像可以为颜色填充的彩色图像等。
步骤1102,对第二样本图像进行区域分割,标注第二样本图像的多个样本色块区域以及相应区域边界。
在本实施例中,对第二样本图像进行区域分割,标注第二样本图像的多个样本色块区域以及相应区域边界,其中,可以基于预先训练的区域分割模型来对第二样本图像进行区域分割,也可以对第二样本图像进行语义分析,根据语义识别结果将同一个部位的区域化分为一个样本色块区域等。
步骤1103,根据待训练的第二模型对第二样本图像进行处理,生成参考色块区域以及相应区域边界。
在本实施例中,预先构建用于色块分割的第二模型,根据待训练的第二模型对第二样本图像进行处理,生成参考色块区域以及相应区域边界。
步骤1104,根据参考色块区域以及相应区域边界和样本色块区域以及相应区域边界生成第二目标损失函数。
容易理解的是,理论上得到的参考色块区域应当和样本色块区域以及对应的区域边界是一致的,因为,参考色块区域也是来源于第二样本图像,为了判断第二模型的模型参数是否训练完成,在本实施例中,根据参考色块区域以及相应区域边界和样本色块区域以及相应区域边界生成第二目标损失函数。
其中,在不同的应用场景中,计算第二目标损失函数的算法不同,比如,可以使用如下的算法中的一个或多个来计算第二目标损失函数:
在一些可能的实施例中,计算参考色块区域中每个像素和对应的样本色块区域中每个像素之间的像素颜色的平均绝对误差,获取第一重建损失函数,计算参考色块区域的相应区域边界每个像素点的位置信息,和样本色块区域的相应区域边界每个像素点的位置信息之间的平均绝对误差,获取第二重建损失函数,基于第一重建损失函数和第二重建损失函数获取相应色块区域之间的重建损失函数,比如,基于第一重建损失函数和重建损失函数的均值获取相应色块区域之间的重建损失函数。
在一些可能的实施例中,计算参考色块区域中每个像素和对应的样本色块区域中每个像素之间的像素颜色的均方误差,获取第一风格损失函数,计算参考色块区域的相应区域边界每个像素点的位置信息,和样本色块区域的相应区域边界每个像素点的位置信息之间 的均方误差,获取第二风格损失函数,基于第一风格损失函数和第二风格损失函数获取相应色块区域之间的第二风格损失函数,比如,基于第一风格损失函数和第二风格损失函数的均值获取相应色块区域之间的风格损失函数。
在一些可能的实施例中,根据预设的判别器模型对参考色块区域以及样本色块区域以及相应区域边界进行处理,获取对抗损失函数,该判别器模型可以为生成式对抗网络中的判别器模块等。
步骤1105,根据参考色块区域和样本色块区域,并基于第二目标损失函数的反向传播,训练第二模型的参数,其中该参数可被用于生成作为第二模型的图像分块模型。
在本实施例中,根据参考色块区域和样本色块区域,并基于第二目标损失函数的反向传播,训练第二模型的参数,以用于生成图像分块模型,当第二模型得到的第二目标损失函数的损失值小于预设损失阈值时,完成对模型参数的训练。该预设损失阈值可被以各种适当方式来设定,例如根据历史数据推知,或者根据经验设定等等,这里将不再详细描述。
应指出,第一模型和第二模型的训练过程可以是采用各种适当的方式来执行,特别地,以迭代或循环的方式来执行。
根据本公开的实施例,模型训练的迭代/循环可被以任何适当方式执行。在一个实施例中,可以在每次迭代/循环中的训练过程中分析该模型的处理结果,并且在处理结果满足特定条件的情况下,终止训练过程,得到目标对象流动模型。作为示例,每次迭代或循环中的训练过程可如上所述地进行,并且在每次迭代/循环中的训练过程执行之后,可以判断目标损失函数是否小于预设阈值,如果小于,则停止迭代或循环,完成了模型训练。反之,如果不小于,则继续进行迭代或循环。在另一实施例中,可以在循环特定次数之后,终止训练过程,得到目标对象流动模型。在还另一实施例中,如果在连续特定次数的循环/迭代过程中模型的处理结果的变化不显著,例如保持在阈值范围内,诸如损失函数的损失值没有显著变化,则循环/迭代可停止。训练过程的次数还可被以本领域适当的方式来设定,这里将不再详细描述。
综上,本公开实施例的图像处理方法,基于模型训练的方式训练第一模型和第二模型,以便于根据第一模型进行上色处理,根据第二模型进行图像分块处理,无需人工参与,降低了上色的成本,提高了上色效率。
应指出,前文所述的模型训练过程/模型训练阶段,尤其是第一模型和第二模型的训练过程,对于本公开的方案而言是可选的。特别地,这样的模型训练过程/模型训练阶段可以 被包含在本公开的图像处理方法中,也可位于本公开的图像处理方法之外,并且被本公开的图像处理方法获取并应用。应指出,即使不包含模型训练过程/模型训练阶段,本公开的图像处理方法仍是完整的,并且能够实现有利的技术效果。
根据本公开的实施例,本公开还提出了一种图像处理装置。图12为本公开实施例的一种图像处理装置的结构示意图,该装置可由软件和/或硬件实现,一般可集成在电子设备中。如图12所示,该装置包括:第一获取模块1210、第一生成模块1220、第二获取模块1230、第二生成模块1240、第三生成模块1250,其中,
第一获取模块1210,用于从用户获取线稿图和初始颜色提示信息;
第一生成模块1220,用于基于初始颜色提示信息对线稿图进行上色,生成线稿图的初始上色图像;
第二获取模块1230,用于从用户获取与初始上色图像相关联的颜色修改信息;
第二生成模块1240,用于基于初始颜色提示信息、颜色修改信息和初始上色图像,生成目标颜色提示信息;以及
第三生成模块1250,用于基于目标颜色提示信息对线稿图进行上色,生成线稿图的目标上色图像。
本公开实施例所提供的图像处理装置可执行本公开任意实施例所提供的图像处理方法,具备执行方法相应的功能模块和有益效果。
应注意,上述各个模块仅是根据其所实现的具体功能划分的逻辑模块,而不是用于限制具体的实现方式,例如可以以软件、硬件或者软硬件结合的方式来实现。在实际实现时,上述各个模块可被实现为独立的物理实体,或者也可由单个实体(例如,处理器(CPU或DSP等)、集成电路等)来实现。此外,上述各个模块在附图中用虚线示出指示这些模块可以并不实际存在,而它们所实现的操作/功能可由装置或处理电路本身来实现。
此外,尽管未示出,该装置也可以包括存储器,其可以存储由装置、装置所包含的各个模块在操作中产生的各种信息、用于操作的程序和数据、将由通信单元发送的数据等。存储器可以是易失性存储器和/或非易失性存储器。例如,存储器可以包括但不限于随机存储存储器(RAM)、动态随机存储存储器(DRAM)、静态随机存取存储器(SRAM)、只读存储器(ROM)、闪存存储器。当然,存储器可也位于该装置之外。
综上,本公开实施例的图像处理装置,结合用户提供的线稿图和初始颜色信息,首先对线稿图进行初步上色得到初始上色图像,进而,获取关联的颜色修改信息,根据该颜色 修改信息、初始颜色提示信息生成目标颜色提示信息,其次,基于目标颜色提示信息对线稿图进行上色,生成线稿图的目标上色图像。由此,根据用户提供的颜色提示信息对线稿图进行自动的上色处理,用户若是对上色效果修改,则可以进一步根据用户的修改对线稿重新上色处理,满足了用户的个性化上色需求,实现了在保证上色效果的基础上,提升了上色效率。
根据本公开的实施例,本公开还提出一种计算机程序产品,包括计算机程序/指令,该计算机程序/指令被处理器执行时实现本公开实施例所述的图像处理方法。
根据本公开实施例,还提供了一种数据处理设备,包括:存储器,处理器,其中在所述存储器上存储有计算机程序,所述计算机程序在被所述处理器执行时可实现本公开实施例所述的图像处理方法。
根据本公开实施例,还提供了一种计算机程序,所述计算机程序包括程序代码,所述程序代码在被处理器执行时实现本公开实施例所述的图像处理方法。
图13为本公开实施例的一种电子设备的结构示意图。
下面具体参考图13,其示出了适于用来实现本公开实施例中的电子设备1300的结构示意图。本公开实施例中的电子设备1300可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图13示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图13所示,电子设备1300可以包括处理装置(例如中央处理器、图形处理器等)1301,其可以根据存储在只读存储器(ROM)1302中的程序或者从存储装置1308加载到随机访问存储器(RAM)1303中的程序而执行各种适当的动作和处理。在RAM 1303中,还存储有电子设备1300操作所需的各种程序和数据。处理装置1301、ROM 1302以及RAM1303通过总线1304彼此相连。输入/输出(I/O)接口1305也连接至总线1304。
通常,以下装置可以连接至I/O接口1305:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置1306;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置1307;包括例如磁带、硬盘等的存储装置1308;以及通信装置1309。通信装置1309可以允许电子设备1300与其他设备进行无线或有线通信以交换数据。虽然图13示出了具有各种装置的电子设备1300,但是应理解的是,并不要求实施 或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置1309从网络上被下载和安装,或者从存储装置1308被安装,或者从ROM 1302被安装。在该计算机程序被处理装置1301执行时,执行本公开实施例的图像处理方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:结合用户提供的线稿图和初始颜色信息,首先对线稿图进行初步上色得到初始上色图像,进而,获取关联的颜色修改信息,根据该颜色修改信息、初始颜色提示信息生成目标颜色提示信息,其次,基于目标颜色提示信息对线稿图进行上色,生成线稿图的目标上色图像。由此,根据用户提供的颜色提示信息对线稿图进行自动的上色处理,用户若是对上色效果修改,则可以进一步根据用户的修改对线稿重新上色处理,满足了用户的个性化上色需求,实现了在保证上色效果的基础上,提升了上色效率。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD) 等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,本公开提供了一种图像处理方法,包括:从用户获取线稿图和初始颜色提示信息;
基于所述初始颜色提示信息对所述线稿图进行上色,生成所述线稿图的初始上色图像;
从所述用户获取与初始上色图像相关联的颜色修改信息;
基于初始颜色提示信息、所述颜色修改信息和初始上色图像,生成目标颜色提示信息;以及
基于目标颜色提示信息对所述线稿图进行上色,生成所述线稿图的目标上色图像。
根据本公开的一个或多个实施例,本公开提供的图像处理方法中,所述初始颜色提示信息指示所述用户指定的所述线稿图中的一个或多个初始区域以及要对所述一个或多个区域进行上色的相应初始颜色。
根据本公开的一个或多个实施例,所述基于所述初始颜色提示信息对所述线稿图进行上色,生成所述线稿图的初始上色图像,包括:
将所述一个或多个初始区域以及相应的初始颜色和所述线稿图输入第一模型,以获取所述线稿图的初始上色图像,其中,初始上色图像中所述一个或多个初始区域的颜色与所述初始颜色一致。
根据本公开的一个或多个实施例,所述获取与初始上色图像相关联的颜色修改信息,包括:
响应于颜色修改请求,对所述初始上色图像进行色块化,生成初始上色图像的初始色块图像,其中,所述色块图像包括多个色块区域;
获取与所述多个色块区域中的一个或多个色块区域相关联的颜色修改信息。
根据本公开的一个或多个实施例,所述响应于颜色修改请求,对所述初始上色图像进行色块化,生成初始上色图像的初始色块图像,包括:
将所述初始上色图像输入第二模型,确定所述初始上色图像的所述多个色块区域以及相应区域边界;
基于所述区域边界从所述初始上色图像获取相应色块区域内的像素的颜色均值;
使用相应颜色均值填充所述多个色块区域中的相应区域,以获取初始色块图像。
根据本公开的一个或多个实施例,所述基于初始颜色提示信息、所述颜色修改信息和初始上色图像,生成目标颜色提示信息,包括:
基于与所述多个色块区域中的所述一个或多个色块区域相关联的颜色修改信息,从初始色块图像获取目标色块图像,所述目标色块图像包括多个色块;
基于所述目标色块图像生成目标颜色提示信息。
根据本公开的一个或多个实施例,所述目标颜色提示信息指示所述用户指定的所述线稿图中的一个或多个目标区域以及要对所述一个或多个区域进行上色的相应目标颜色。
根据本公开的一个或多个实施例,所述基于目标颜色提示信息对所述线稿图进行上色,生成所述线稿图的目标上色图像,包括:
将所述一个或多个目标区域以及相应的目标颜色和所述线稿图输入所述第一模型,以获取所述线稿图的目标上色图像,其中,目标上色图像中所述一个或多个目标区域的颜色与所述目标颜色一致。
根据本公开的一个或多个实施例,所述第一模型为上色提示模型,所述上色提示模型通过以下步骤训练得到:
获取与第一样本图像对应的第一样本线稿图;
从所述第一样本图像中获取初始样本颜色提示信息;
根据待训练的第一模型基于所述初始样本颜色提示信息对所述第一样本线稿图进行上色,生成所述第一样本线稿图的初始样本上色图像;
根据所述初始样本上色图像和所述第一样本图像生成第一目标损失函数;以及
根据所述初始样本上色图像和所述第一样本图像,并基于所述第一目标损失函数的反向传播,训练所述第一模型的参数生成所述上色提示模型。
根据本公开的一个或多个实施例,所述第二模型为图像分块模型,所述图像分块模型 通过以下步骤训练得到:
获取第二样本图像;
对所述第二样本图像进行区域分割,标注所述第二样本图像的多个样本色块区域以及相应区域边界;
根据待训练的第二模型对所述第二样本图像进行处理,生成参考色块区域以及相应区域边界;
根据所述参考色块区域以及相应区域边界和所述样本色块区域以及相应区域边界生成第二目标损失函数;以及
根据所述参考色块区域和所述样本色块区域,并基于所述第二目标损失函数的反向传播,训练所述第二模型的参数生成所述图像分块模型。
根据本公开的一个或多个实施例,本公开提供了一种图像处理装置,包括:第一获取模块,用于从用户获取线稿图和初始颜色提示信息;
第一生成模块,用于基于所述初始颜色提示信息对所述线稿图进行上色,生成所述线稿图的初始上色图像;
第二获取模块,用于从所述用户获取与初始上色图像相关联的颜色修改信息;
第二生成模块,用于基于初始颜色提示信息、所述颜色修改信息和初始上色图像,生成目标颜色提示信息;以及
第三生成模块,用于基于目标颜色提示信息对所述线稿图进行上色,生成所述线稿图的目标上色图像。
根据本公开的一个或多个实施例,所述初始颜色提示信息指示所述用户指定的所述线稿图中的一个或多个初始区域以及要对所述一个或多个区域进行上色的相应初始颜色。
根据本公开的一个或多个实施例,所述第一生成模块,具体用于:
将所述一个或多个初始区域以及相应的初始颜色和所述线稿图输入第一模型,以获取所述线稿图的初始上色图像,其中,初始上色图像中所述一个或多个初始区域的颜色与所述初始颜色一致。
根据本公开的一个或多个实施例,所述第二获取模块,具体用于:
响应于颜色修改请求,对所述初始上色图像进行色块化,生成初始上色图像的初始色块图像,其中,所述色块图像包括多个色块区域;
获取与所述多个色块区域中的一个或多个色块区域相关联的颜色修改信息。
根据本公开的一个或多个实施例,所述第二获取模块,具体用于:将所述初始上色图像输入第二模型,确定所述初始上色图像的所述多个色块区域以及相应区域边界;
基于所述区域边界从所述初始上色图像获取相应色块区域内的像素的颜色均值;
使用相应颜色均值填充所述多个色块区域中的相应区域,以获取初始色块图像。
根据本公开的一个或多个实施例,所述第二获取模块,具体用于:基于与所述多个色块区域中的所述一个或多个色块区域相关联的颜色修改信息,从初始色块图像获取目标色块图像,所述目标色块图像包括多个色块;
基于所述目标色块图像生成目标颜色提示信息。
根据本公开的一个或多个实施例,所述目标颜色提示信息指示所述用户指定的所述线稿图中的一个或多个目标区域以及要对所述一个或多个区域进行上色的相应目标颜色。
根据本公开的一个或多个实施例,所述第三生成模块,具体用于:
将所述一个或多个目标区域以及相应的目标颜色和所述线稿图输入所述第一模型,以获取所述线稿图的目标上色图像,其中,目标上色图像中所述一个或多个目标区域的颜色与所述目标颜色一致。
根据本公开的一个或多个实施例,所述第一模型为上色提示模型,所述装置还包括:第一训练模块,用于:
获取与第一样本图像对应的第一样本线稿图;
从所述第一样本图像中获取初始样本颜色提示信息;
根据待训练的第一模型基于所述初始样本颜色提示信息对所述第一样本线稿图进行上色,生成所述第一样本线稿图的初始样本上色图像;
根据所述初始样本上色图像和所述第一样本图像生成第一目标损失函数;以及
根据所述初始样本上色图像和所述第一样本图像,并基于所述第一目标损失函数的反向传播,训练所述第一模型的参数生成所述上色提示模型。
根据本公开的一个或多个实施例,所述第二模型为图像分块模型,所述装置还包括:第二训练模块,用于:
获取第二样本图像;
对所述第二样本图像进行区域分割,标注所述第二样本图像的多个样本色块区域以及相应区域边界;
根据待训练的第二模型对所述第二样本图像进行处理,生成参考色块区域以及相应区 域边界;
根据所述参考色块区域以及相应区域边界和所述样本色块区域以及相应区域边界生成第二目标损失函数;以及
根据所述参考色块区域和所述样本色块区域,并基于所述第二目标损失函数的反向传播,训练所述第二模型的参数生成所述图像分块模型。
根据本公开的一个或多个实施例,本公开提供了一种电子设备,包括:
处理器;
用于存储所述处理器可执行指令的存储器;
所述处理器,用于从所述存储器中读取所述可执行指令,并执行所述指令以实现如本公开提供的任一所述的图像处理方法。
根据本公开的一个或多个实施例,本公开提供了一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序用于执行如本公开提供的任一所述的图像处理方法。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。

Claims (17)

  1. 一种图像处理方法,包括:
    从用户获取线稿图和初始颜色提示信息;
    基于所述初始颜色提示信息对所述线稿图进行上色,生成所述线稿图的初始上色图像;
    从所述用户获取与初始上色图像相关联的颜色修改信息;
    基于初始颜色提示信息、所述颜色修改信息和初始上色图像,生成目标颜色提示信息;以及
    基于目标颜色提示信息对所述线稿图进行上色,生成所述线稿图的目标上色图像。
  2. 根据权利要求1所述的方法,其中,
    所述初始颜色提示信息指示所述用户指定的所述线稿图中的一个或多个初始区域以及要对所述一个或多个区域进行上色的相应初始颜色。
  3. 根据权利要求2所述的方法,其中,所述基于所述初始颜色提示信息对所述线稿图进行上色,生成所述线稿图的初始上色图像,包括:
    将所述一个或多个初始区域以及相应的初始颜色和所述线稿图输入第一模型,以获取所述线稿图的初始上色图像,其中,初始上色图像中所述一个或多个初始区域的颜色与所述初始颜色一致。
  4. 根据权利要求2所述的方法,其中,所述获取与初始上色图像相关联的颜色修改信息,包括:
    响应于颜色修改请求,对所述初始上色图像进行色块化,生成初始上色图像的初始色块图像,其中,所述色块图像包括多个色块区域;
    获取与所述多个色块区域中的一个或多个色块区域相关联的颜色修改信息。
  5. 根据权利要求4所述的方法,其中,所述响应于颜色修改请求,对所述初始上色图像进行色块化,生成初始上色图像的初始色块图像,包括:
    将所述初始上色图像输入第二模型,确定所述初始上色图像的所述多个色块区域以及相应区域边界;
    基于所述区域边界从所述初始上色图像获取相应色块区域内的像素的颜色均值;
    使用相应颜色均值填充所述多个色块区域中的相应区域,以获取初始色块图像。
  6. 根据权利要求4所述的方法,其中,所述基于初始颜色提示信息、所述颜色修改信息和初始上色图像,生成目标颜色提示信息,包括:
    基于与所述多个色块区域中的所述一个或多个色块区域相关联的颜色修改信息,从初始色块图像获取目标色块图像,所述目标色块图像包括多个色块;
    基于所述目标色块图像生成目标颜色提示信息。
  7. 根据权利要求6所述的方法,其中,所述目标颜色提示信息指示所述用户指定的所述线稿图中的一个或多个目标区域以及要对所述一个或多个区域进行上色的相应目标颜色。
  8. 根据权利要求7所述的方法,其中,所述基于目标颜色提示信息对所述线稿图进行上色,生成所述线稿图的目标上色图像,包括:
    将所述一个或多个目标区域以及相应的目标颜色和所述线稿图输入所述第一模型,以获取所述线稿图的目标上色图像,其中,目标上色图像中所述一个或多个目标区域的颜色与所述目标颜色一致。
  9. 根据权利要求3-8中任一项所述的方法,其中,所述第一模型为上色提示模型,所述上色提示模型通过以下步骤训练得到:
    获取与第一样本图像对应的第一样本线稿图;
    从所述第一样本图像中获取初始样本颜色提示信息;
    根据待训练的第一模型基于所述初始样本颜色提示信息对所述第一样本线稿图进行上色,生成所述第一样本线稿图的初始样本上色图像;
    根据所述初始样本上色图像和所述第一样本图像生成第一目标损失函数;以及
    根据所述初始样本上色图像和所述第一样本图像,并基于所述第一目标损失函数的反向传播,训练所述第一模型的参数生成所述上色提示模型。
  10. 根据权利要求9所述的方法,其中,当基于所述第一模型得到的第一目标损失函数的损失值小于预设损失阈值时,完成对所述第一模型的参数的训练。
  11. 根据权利要求5-8中任一项所述的方法,其中,所述第二模型为图像分块模型,所述图像分块模型通过以下步骤训练得到:
    获取第二样本图像;
    对所述第二样本图像进行区域分割,标注所述第二样本图像的多个样本色块区域以及相应区域边界;
    根据待训练的第二模型对所述第二样本图像进行处理,生成参考色块区域以及相应区域边界;
    根据所述参考色块区域以及相应区域边界和所述样本色块区域以及相应区域边界生成第二目标损失函数;以及
    根据所述参考色块区域和所述样本色块区域,并基于所述第二目标损失函数的反向传播,训练所述第二模型的参数生成所述图像分块模型。
  12. 根据权利要求11所述的方法,其中,当基于所述第二模型得到的第二目标损失函数的损失值小于预设损失阈值时,完成对所述第二模型的参数的训练。
  13. 一种图像处理装置,包括:
    第一获取模块,用于从用户获取线稿图和初始颜色提示信息;
    第一生成模块,用于基于所述初始颜色提示信息对所述线稿图进行上色,生成所述线稿图的初始上色图像;
    第二获取模块,用于从所述用户获取与初始上色图像相关联的颜色修改信息;
    第二生成模块,用于基于初始颜色提示信息、所述颜色修改信息和初始上色图像,生成目标颜色提示信息;以及
    第三生成模块,用于基于目标颜色提示信息对所述线稿图进行上色,生成所述线稿图的目标上色图像。
  14. 一种电子设备,所述电子设备包括:
    处理器;以及
    用于存储所述处理器可执行指令的存储器,
    其中,所述可执行指令由所述处理器执行以用于实现根据权利要求1-12中任一所述的图像处理方法。
  15. 一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序由处理器执行以用于实现根据权利要求1-12中任一所述的图像处理方法。
  16. 一种计算机程序产品,所述计算机程序产品包括计算机程序/指令,所述计算机程序/指令由处理器执行以用于实现根据权利要求1-12中任一项所述的图像处理方法。
  17. 一种计算机程序,所述计算机程序包括程序代码,所述程序代码由处理器执行以用于实现根据权利要求1-12中任一项所述的图像处理方法。
PCT/CN2023/089724 2022-04-25 2023-04-21 图像处理方法、装置、设备及介质 WO2023207779A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210443514.9 2022-04-25
CN202210443514.9A CN115937356A (zh) 2022-04-25 2022-04-25 图像处理方法、装置、设备及介质

Publications (1)

Publication Number Publication Date
WO2023207779A1 true WO2023207779A1 (zh) 2023-11-02

Family

ID=86654685

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/089724 WO2023207779A1 (zh) 2022-04-25 2023-04-21 图像处理方法、装置、设备及介质

Country Status (2)

Country Link
CN (1) CN115937356A (zh)
WO (1) WO2023207779A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115937356A (zh) * 2022-04-25 2023-04-07 北京字跳网络技术有限公司 图像处理方法、装置、设备及介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050008193A1 (en) * 2000-06-13 2005-01-13 Microsoft Corporation System and process for bootstrap initialization of nonparametric color models
CN109147003A (zh) * 2018-08-01 2019-01-04 北京东方畅享科技有限公司 对线稿图像进行上色的方法、设备以及存储介质
CN111080746A (zh) * 2019-12-10 2020-04-28 中国科学院计算技术研究所 图像处理方法、装置、电子设备和存储介质
CN114387365A (zh) * 2021-12-30 2022-04-22 北京科技大学 一种线稿上色方法及装置
CN115937356A (zh) * 2022-04-25 2023-04-07 北京字跳网络技术有限公司 图像处理方法、装置、设备及介质

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6768488B1 (en) * 1999-05-25 2004-07-27 Nippon Telegraph And Telephone Corporation Image filling method, apparatus and computer readable medium for reducing filling process in processing animation
GB2378111B (en) * 1999-05-25 2003-09-03 Nippon Telegraph & Telephone Image filling method,apparatus and computer readable medium for reducing filling process in producing animation
CN107918944B (zh) * 2016-10-09 2021-08-31 北京奇虎科技有限公司 一种图片色彩填充方法及装置
CN108615252A (zh) * 2018-05-03 2018-10-02 苏州大学 基于参考图像的线稿上色模型的训练方法以及装置
CN108830913B (zh) * 2018-05-25 2022-05-17 大连理工大学 基于用户颜色引导的语义级别线稿上色方法
CN109801346B (zh) * 2018-12-20 2023-06-30 武汉西山艺创文化有限公司 一种基于神经网络的原画辅助上色方法和装置
CN111161378B (zh) * 2019-12-27 2023-10-17 北京金山安全软件有限公司 一种填色方法、装置及电子设备
CN111553961B (zh) * 2020-04-27 2023-09-08 北京奇艺世纪科技有限公司 线稿对应色图的获取方法和装置、存储介质和电子装置
CN113129409B (zh) * 2021-04-30 2023-07-25 华南农业大学 一种基于深度学习的漫画线稿上色方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050008193A1 (en) * 2000-06-13 2005-01-13 Microsoft Corporation System and process for bootstrap initialization of nonparametric color models
CN109147003A (zh) * 2018-08-01 2019-01-04 北京东方畅享科技有限公司 对线稿图像进行上色的方法、设备以及存储介质
CN111080746A (zh) * 2019-12-10 2020-04-28 中国科学院计算技术研究所 图像处理方法、装置、电子设备和存储介质
CN114387365A (zh) * 2021-12-30 2022-04-22 北京科技大学 一种线稿上色方法及装置
CN115937356A (zh) * 2022-04-25 2023-04-07 北京字跳网络技术有限公司 图像处理方法、装置、设备及介质

Also Published As

Publication number Publication date
CN115937356A (zh) 2023-04-07

Similar Documents

Publication Publication Date Title
CN111476871B (zh) 用于生成视频的方法和装置
US20230326248A1 (en) Expression transformation method and apparatus, electronic device, and computer readable medium
WO2023125374A1 (zh) 图像处理方法、装置、电子设备及存储介质
CN109981787B (zh) 用于展示信息的方法和装置
JP2023547917A (ja) 画像分割方法、装置、機器および記憶媒体
WO2023160513A1 (zh) 3d素材的渲染方法、装置、设备及存储介质
CN110796721A (zh) 虚拟形象的颜色渲染方法、装置、终端及存储介质
US11257217B2 (en) Image segmentation using neural networks
WO2023207779A1 (zh) 图像处理方法、装置、设备及介质
WO2023232056A1 (zh) 图像处理方法、装置、存储介质及电子设备
CN110069191B (zh) 基于终端的图像拖拽变形实现方法和装置
WO2023138498A1 (zh) 生成风格化图像的方法、装置、电子设备及存储介质
WO2023185391A1 (zh) 交互式分割模型训练方法、标注数据生成方法及设备
CN111833242A (zh) 人脸变换方法、装置、电子设备和计算机可读介质
WO2023072015A1 (zh) 人物风格形象图的生成方法、装置、设备及存储介质
WO2023273697A1 (zh) 图像处理方法、模型训练方法、装置、电子设备及介质
CN112434620A (zh) 场景文字识别方法、装置、设备和计算机可读介质
CN110472558B (zh) 图像处理方法和装置
WO2024037556A1 (zh) 图像处理方法、装置、设备及存储介质
WO2023221941A1 (zh) 图像处理方法、装置、设备及存储介质
CN109949213B (zh) 用于生成图像的方法和装置
CN111260756B (zh) 用于发送信息的方法和装置
CN110059739B (zh) 图像合成方法、装置、电子设备和计算机可读存储介质
CN115953597B (zh) 图像处理方法、装置、设备及介质
WO2023143118A1 (zh) 图像处理方法、装置、设备及介质

Legal Events

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

Ref document number: 23795212

Country of ref document: EP

Kind code of ref document: A1