Image processing method, apparatus, medium and electronic device
By changing the color channel sequence of images and using image processing models for stylization, the problems of large performance overhead and high labor costs when changing face special effects colors in the prior art are solved, and efficient and low-cost regional color transformation is achieved.
Patent Information
- Application Number
- PCT/CN2024/113867
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-25
- Filing Date
- 2024-08-22
- Publication Date
- 2025-03-06
AI Technical Summary
When changing the face color of the face special effects of the prior art, it is necessary to add a new face segmentation model, resulting in large performance overhead, increased labor costs, and is not applicable to non-face special effects.
By receiving the image to be processed, changing its original color channel order to the target color channel order, using the image processing model to stylize the target area, and finally restoring the color channel order to achieve the generation of the target image.
It reduces performance overhead and labor costs, improves the efficiency of area color change, and is suitable for non-face special effects.
Smart Images

Figure CN2024113867_06032025_PF_FP_ABST
Abstract
Description
Image processing method, device, medium and electronic device
[0001] This application claims priority to Chinese Patent Application No. 2023110885640 filed on August 25, 2023, and the contents of the above-mentioned Chinese patent application disclosure are hereby incorporated by reference in their entirety as a part of this application. Technical Field
[0002] Embodiments of the present disclosure relate to an image processing method, apparatus, medium, and electronic device. Background Art
[0003] The common practice for changing the facial color of face effects is as follows: first, a face segmentation model is added to the sticker pack, and the algorithm runs in real time to obtain a face mask for each frame; then, the designer designs a filter and adds it to the sticker pack to adjust the facial color, and uses the segmented face mask to avoid changes in the user's background color.
[0004] The above-mentioned face color changing method has the following problems: (1) It requires a new face segmentation model, which has a high performance overhead, directly affecting the model classification and coverage of special effects, and ultimately affecting the launch of props; (2) Even if the effect loss can be accepted to maintain performance, the face segmentation model is used. However, for some non-face special effects, ordinary face segmentation models cannot accurately segment the mask, resulting in unacceptable final effects; (3) Designers are required to design filters, which increases certain labor costs.
[0005] Summary of the Invention
[0006] This summary is provided to briefly introduce concepts that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0007] The present disclosure provides an image processing method, comprising: receiving an image to be processed, the image to be processed including a target area whose color needs to be changed; transforming an original color channel sequence of the image to be processed into a target color channel sequence to obtain a first intermediate image; performing stylized processing on an area corresponding to the target area in the first intermediate image using an image processing model to obtain a second intermediate image, wherein the color of the area corresponding to the target area in the second intermediate image is different from the color corresponding to the target color channel sequence; and restoring the color channel sequence of the second intermediate image to the original color channel sequence to obtain a target image, wherein the color of the area corresponding to the target area in the target image is different from the color of the target area in the image to be processed.
[0008] The present disclosure provides an image processing device, comprising: a receiving module configured to receive an image to be processed, the image to be processed including a target area whose color needs to be changed; a channel conversion module configured to convert an original color channel sequence of the image to be processed into a target color channel sequence to obtain a first intermediate image; a stylization module configured to perform stylization processing on an area corresponding to the target area in the first intermediate image using an image processing model to obtain a second intermediate image, wherein the color of the area corresponding to the target area in the second intermediate image is different from the color corresponding to the target color channel sequence; and a channel restoration module configured to restore the color channel sequence of the second intermediate image to the original color channel sequence to obtain a target image, wherein the color of the area corresponding to the target area in the target image is different from the color of the target area in the image to be processed.
[0009] The present disclosure provides a computer-readable medium having a computer program stored thereon, which implements the steps of any method described in the present disclosure when the program is executed by a processing device.
[0010] The present disclosure provides an electronic device, comprising: a storage device storing a computer program; and a processing device configured to execute the computer program in the storage device to implement the steps of any method described in the present disclosure.
[0011] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The above and other features, advantages and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale. In the drawings:
[0013] FIG1 is a flowchart of an image processing method according to an embodiment of the present disclosure.
[0014] FIG2 is a flowchart of performing stylized processing on an area corresponding to a target area in a first intermediate image using an image processing model according to an embodiment of the present disclosure.
[0015] FIG3 is a flowchart of acquiring an image processing model according to an embodiment of the present disclosure.
[0016] FIG4 is another flowchart of acquiring an image processing model according to an embodiment of the present disclosure.
[0017] 5a and 5b are schematic diagrams of stylized processing effects of an image processing model according to an embodiment of the present disclosure.
[0018] 6a to 6d are schematic diagrams of image processing effects of the image processing method according to an embodiment of the present disclosure.
[0019] FIG7 is a schematic block diagram of an image processing apparatus according to an embodiment of the present disclosure.
[0020] FIG8 shows a schematic structural diagram of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION
[0021] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0022] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0023] As used herein, the term "including" and its variations are open-ended, i.e., "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." Other terms are defined in the following description.
[0024] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0025] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0026] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0027] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0028] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.
[0029] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0030] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0031] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) must comply with the requirements of relevant laws, regulations and relevant provisions.
[0032] Figure 1 is a flow chart of an image processing method according to an embodiment of the present disclosure. As shown in Figure 1 , the image processing method includes the following steps S11 to S14.
[0033] In step S11 , an image to be processed is received, where the image to be processed includes a target area whose color needs to be changed.
[0034] For example, if the image to be processed contains a face and the color of the face needs to be changed, then the target area mentioned above refers to the face area.
[0035] In step S12, the original color channel order of the image to be processed is transformed into the target color channel order to obtain a first intermediate image.
[0036] In some embodiments, the original color channel order and the target color channel order are respectively one of the following color channel orders and are different from each other: RGB, RBG, GRB, GBR, BRG, BGR. For example, the original color channel order is RGB and the target color channel order is RBG.
[0037] In step S13, an image processing model is used to perform stylization processing on the area corresponding to the target area in the first intermediate image to obtain a second intermediate image, wherein the color of the area corresponding to the target area in the second intermediate image is different from the color corresponding to the target color channel sequence.
[0038] Taking an image to be processed containing a face as an example, the face is the target area that needs to change color. After the color channel sequence transformation in step S12, the overall color of the image to be processed becomes the first color, that is, the overall color of the first intermediate image is the first color. After using the image processing model to perform stylized processing on the area corresponding to the face area in the first intermediate image, the face area in the first intermediate image becomes the second color, that is, the color of the face area in the second intermediate image is the second color, while the color of the area outside the face area in the second intermediate image remains the first color.
[0039] In some embodiments, the image processing model involved in the present disclosure may be an image processing model using a generative adversarial network (GAN), or may be other image processing models, such as an image processing model based on a neural network.
[0040] In some embodiments, when performing stylization, the image processing model may only change the color of the region corresponding to the target area in the first intermediate image, or may simultaneously change the appearance and color of the region corresponding to the target area in the first intermediate image. In other words, stylization may include both deformation and color changes.
[0041] 2 is a flow chart of performing stylization processing on a region corresponding to a target region in a first intermediate image using an image processing model according to an embodiment of the present disclosure. The flow includes steps S131 to S134.
[0042] In step S131 , an area corresponding to the target area in the first intermediate image is identified.
[0043] In step S132 , the identified area is converted into image data.
[0044] In step S133, the image data is stylized using the image processing model to obtain a region image, wherein the color of the region image is different from the color corresponding to the target color channel sequence.
[0045] In step S134, the region of the first intermediate image other than the region corresponding to the target region and the region image are processed to obtain the second intermediate image. For example, the region of the first intermediate image other than the region corresponding to the target region and the region image may be fused.
[0046] In addition, it should be noted that, in addition to first transforming the color channel order of the image to be processed received in step S11, and then using the image processing model to perform stylized processing on the area corresponding to the target area in the image to be processed after the color channel order transformation, it is also possible to first identify the target area in the image to be processed received in step S11 to obtain data of the target area, and then convert the data of the target area into image data, and then transform the color channel order of the image data into the target color channel order, and then input the image data with the color channel order as the target color channel order into the image processing model for stylized processing to obtain a second intermediate image.
[0047] In step S14, the color channel order of the second intermediate image is restored to the original color channel order, resulting in a target image. The color of the area corresponding to the target region in the target image is different from the color of the target region in the image to be processed. That is, after the color channel order transformation process in step S12 and the stylization process using the image processing model in step S13, the color of the area corresponding to the target region in the resulting second intermediate image is normal, while the colors of other areas are abnormal. By restoring the color channel order in step S14, the colors of the areas outside the target region in the second intermediate image are restored to the colors of the areas outside the target region in the image to be processed, while the colors of the areas corresponding to the target region in the second intermediate image are changed to colors different from the colors of the target region in the image to be processed. That is, the colors of the areas corresponding to the target region in the resulting target image are different from the colors of the target region in the image to be processed, while the colors of the areas outside the areas corresponding to the target region in the resulting target image are the same as the colors of the areas outside the target region in the image to be processed.
[0048] For example, if the original color channel order of the image to be processed received in step S11 is RGB, then in step S14 the color channel order of the second intermediate image will be restored to RGB.
[0049] By adopting the above technical solution, the original color channel order of the image to be processed can be transformed into the target color channel order to obtain a first intermediate image. The image processing model is used to perform stylized processing on the area corresponding to the target area in the first intermediate image to obtain a second intermediate image, wherein the color of the area corresponding to the target area in the second intermediate image is different from the color corresponding to the target color channel order. The color channel order of the second intermediate image is then restored to the original color channel order to obtain the target image, and the color of the area corresponding to the target area in the target image is different from the color of the target area in the image to be processed. In this way, by combining the image processing model capable of stylized processing with the transformation and restoration of the color channel order, the color change of the target area in the image to be processed is achieved at a low cost. Since the image processing method according to the embodiment of the present disclosure does not require a segmentation model, it greatly reduces performance overhead, does not affect the model grading and coverage of special effects, does not affect the online props, and improves the efficiency of regional color change. Since no designer participation is required, for example, no designer is required to design filters, labor costs are greatly reduced.
[0050] In some embodiments, when the image processing model performs stylization processing on the region corresponding to the target region in the first intermediate image, it converts the color channel order of the region corresponding to the target region in the first intermediate image to the original color channel order of the image to be processed. For example, after the color channel order conversion in step S12, the color channel order of the first intermediate image obtained is the target color channel order. Then, in step S13, the stylization processing by the image processing model can convert the color channel order of the region corresponding to the target region in the first intermediate image from the target color channel order to the original color channel order of the image to be processed, while the color channel order of the region outside the region corresponding to the target region in the first intermediate image remains at the target color channel order, thereby obtaining a second intermediate image. Then, after the color channel order restoration processing in step S14, the color channel order of the region outside the region corresponding to the target region in the second intermediate image is restored from the target color channel order to the original color channel order of the image to be processed, while the color channel order of the region corresponding to the target region in the second intermediate image remains at the target color channel order, thereby achieving the purpose of changing the color of only the target region in the image to be processed.
[0051] FIG3 is a flowchart of acquiring an image processing model according to an embodiment of the present disclosure.
[0052] As shown in Figure 3, first, in step S31, a mask of the area to be stylized of the data sample in the paired data is obtained. The paired data includes the data sample and a real sample, and the real sample includes a stylized reference area. The stylized reference area serves as a reference for the area to be stylized of the data sample. In other words, the trained image processing model can stylize the area to be stylized of the data sample to the same appearance as the stylized deformation reference area.
[0053] Then, in step S32, the image processing model is trained in combination with the mask of the area to be stylized and the stylized reference area to obtain the image processing model.
[0054] During the training process, the image processing model can stylize the mask of the area to be stylized, and then compare the stylized processing result with the stylized reference area in the real sample to determine the authenticity of the stylized processing result. Based on the judgment result, the parameters of the image processing model are corrected. This process is repeated repeatedly to complete the training of the image processing model.
[0055] By adopting the above technical solution, it is possible to obtain an image processing model capable of stylizing an image, such as an image processing model based on a GAN network.
[0056] FIG4 is another flowchart of acquiring an image processing model according to an embodiment of the present disclosure.
[0057] As shown in FIG4 , first, in step S41 , the color channel order of the data samples in the paired data is changed, wherein the paired data includes the data samples and real samples, and the real samples include the stylized reference area.
[0058] In some embodiments, the order of the color channels of the data samples may be randomly disrupted.
[0059] Then, in step S42 , a mask of the area to be stylized of the data sample after the color channel sequence is changed is obtained.
[0060] Then, in step S43, the image processing model is trained in combination with the mask of the area to be stylized and the stylized reference area to obtain the image processing model.
[0061] During the training process, the image processing model can stylize the mask of the area to be stylized, and then compare the stylized processing result with the stylized reference area in the real sample to determine the authenticity of the stylized processing result. Based on the judgment result, the parameters of the image processing model are corrected. This process is repeated repeatedly to complete the training of the image processing model.
[0062] By employing the above technical solution, it is possible to obtain an image processing model capable of stylizing images, such as one based on a GAN network. Furthermore, by disrupting the color channel order of the data samples during training, the training process ensures that the color remains constant. This means that regardless of how the background color of the data samples changes, the trained image processing model will always output the target color for the target area.
[0063] Figures 5a and 5b are schematic diagrams illustrating the stylized processing effects of an image processing model according to an embodiment of the present disclosure. As shown in Figures 5a and 5b, after a real-life female face is stylized by the image processing model, the output image of the face is transformed into the stylized reference area. Similarly, after a real-life male face is stylized by the image processing model, the output image of the face is transformed into the stylized reference area. In other words, after the stylized processing by the image processing model, both the male and female faces are transformed into the same stylized reference area.
[0064] Figures 6a to 6d are schematic diagrams of the image processing effects of the image processing method according to an embodiment of the present disclosure. Figure 6a is an image to be processed. Figure 6b is a first image obtained after performing color channel sequential transformation processing on the image to be processed in Figure 6a. The facial color and background color of the first image are both changed to the first color. Figure 6c is a second image obtained after stylizing the facial area of the first image using an image processing model. The background color of the second image remains the first color, while the facial color of the second image is changed to the second color. Figure 6d is a third image obtained after performing color channel sequential restoration on the second image. The background color of the third image is restored to the original background color of the image to be processed, that is, the background color in Figure 6a, while the facial color of the third image is changed to a third color different from the facial color in Figure 6a.
[0065] FIG7 is a schematic block diagram of an image processing apparatus according to an embodiment of the present disclosure. As shown in FIG7 , the image processing apparatus includes: a receiving module 71 configured to receive an image to be processed, the image to be processed including a target region to be color-changed; a channel conversion module 72 configured to convert the original color channel sequence of the image to be processed into a target color channel sequence to obtain a first intermediate image; a stylization module 73 configured to perform stylization processing on a region corresponding to the target region in the first intermediate image using an image processing model to obtain a second intermediate image, wherein the color of the region corresponding to the target region in the second intermediate image is different from the color corresponding to the target color channel sequence; and a channel restoration module 74 configured to restore the color channel sequence of the second intermediate image to the original color channel sequence to obtain a target image, wherein the color of the region corresponding to the target region in the target image is different from the color of the target region in the image to be processed.
[0066] By adopting the above technical solution, the original color channel order of the image to be processed can be transformed into the target color channel order to obtain a first intermediate image. The image processing model is used to perform stylized processing on the area corresponding to the target area in the first intermediate image to obtain a second intermediate image, wherein the color of the area corresponding to the target area in the second intermediate image is different from the color corresponding to the target color channel order. The color channel order of the second intermediate image is then restored to the original color channel order to obtain the target image, and the color of the area corresponding to the target area in the target image is different from the color of the target area in the image to be processed. In this way, by combining the image processing model capable of stylized processing with the transformation and restoration of the color channel order, the color change of the target area in the image to be processed is achieved at a low cost. Since the image processing method according to the embodiment of the present disclosure does not require a segmentation model, it greatly reduces performance overhead, does not affect the model grading and coverage of special effects, does not affect the online props, and improves the efficiency of regional color change. Since no designer participation is required, for example, no designer is required to design filters, labor costs are greatly reduced.
[0067] Optionally, the original color channel order and the target color channel order are respectively one of the following color channel orders and are different from each other: RGB, RBG, GRB, GBR, BRG, BGR.
[0068] Optionally, the stylization module 73 uses an image processing model to perform stylization processing on the area corresponding to the target area in the first intermediate image to obtain a second intermediate image, including: identifying the area corresponding to the target area in the first intermediate image; converting the identified area into image data; performing stylization processing on the image data using the image processing model to obtain a regional image, wherein the color of the regional image is different from the color corresponding to the target color channel sequence; and processing the area other than the area corresponding to the target area in the first intermediate image and the regional image to obtain the second intermediate image.
[0069] Optionally, the stylization module 73 processes the area outside the area corresponding to the target area in the first intermediate image and the regional image, including: fusing the area outside the area corresponding to the target area in the first intermediate image and the regional image.
[0070] Optionally, the image processing device further includes a model acquisition module configured to acquire an image processing model in the following manner: acquiring a mask of an area to be stylized of a data sample in paired data, wherein the paired data includes the data sample and a real sample, and the real sample includes a stylized reference area; and training the image processing model in combination with the mask of the area to be stylized and the stylized reference area to obtain the image processing model.
[0071] Optionally, the model acquisition module is further configured to: change the color channel order of the data sample before obtaining the mask of the area to be stylized of the data sample in the paired data; then, the model acquisition module obtains the mask of the area to be stylized of the data sample in the paired data, including: obtaining the mask of the area to be stylized of the data sample after the color channel order is changed.
[0072] Optionally, the model acquisition module changes the color channel order of the data sample, including: randomly disrupting the color channel order of the data sample.
[0073] The specific implementation of the operations performed by each module in the image processing device according to the embodiment of the present disclosure has been described in detail in the relevant method and will not be repeated here.
[0074] The present disclosure also provides a computer-readable medium having a computer program stored thereon, which implements the steps of any method described in the present disclosure when the program is executed by a processing device.
[0075] The present disclosure further provides an electronic device, comprising: a storage device on which a computer program is stored; and a processing device configured to execute the computer program in the storage device to implement the steps of any method described in the present disclosure.
[0076] Reference is now made to FIG8 , which illustrates a schematic diagram of the structure of an electronic device 600 suitable for implementing embodiments of the present disclosure. Terminal devices in embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. The electronic device illustrated in FIG8 is merely an example and should not limit the functionality or scope of use of embodiments of the present disclosure.
[0077] As shown in Figure 8, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the electronic device 600 are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0078] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although FIG8 shows the electronic device 600 with various devices, it should be understood that not all of the devices shown are required to be implemented or present. More or fewer devices may be implemented or present instead.
[0079] For example, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0080] It should be noted that 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 two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of 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 transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0081] In some embodiments, the client and server can communicate using any currently known or later developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or later developed network.
[0082] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0083] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: receives an image to be processed, wherein the image to be processed includes a target area whose color needs to be changed; transforms the original color channel order of the image to be processed into a target color channel order to obtain a first intermediate image; uses an image processing model to perform stylization processing on the area corresponding to the target area in the first intermediate image to obtain a second intermediate image, wherein the color of the area corresponding to the target area in the second intermediate image is different from the color corresponding to the target color channel order; restores the color channel order of the second intermediate image to the original color channel order to obtain a target image, wherein the color of the area corresponding to the target area in the target image is different from the color of the target area in the image to be processed.
[0084] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0085] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0086] The modules described in the embodiments of the present disclosure may be implemented in software or hardware. In some cases, the name of a module does not necessarily limit the module itself. For example, a receiving module may also be described as a "module for receiving an image to be processed."
[0087] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0088] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0089] According to one or more embodiments of the present disclosure, Example 1 provides an image processing method, including: receiving an image to be processed, the image to be processed including a target area whose color needs to be changed; transforming the original color channel order of the image to be processed into a target color channel order to obtain a first intermediate image; using an image processing model to perform stylization processing on the area corresponding to the target area in the first intermediate image to obtain a second intermediate image, wherein the color of the area corresponding to the target area in the second intermediate image is different from the color corresponding to the target color channel order; restoring the color channel order of the second intermediate image to the original color channel order to obtain a target image, wherein the color of the area corresponding to the target area in the target image is different from the color of the target area in the image to be processed.
[0090] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, wherein the original color channel order and the target color channel order are respectively one of the following color channel orders and are different from each other: RGB, RBG, GRB, GBR, BRG, BGR.
[0091] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 1, wherein the image processing model is used to perform stylized processing on the area corresponding to the target area in the first intermediate image to obtain a second intermediate image, including: identifying the area corresponding to the target area in the first intermediate image; converting the identified area into image data; performing stylized processing on the image data using the image processing model to obtain a regional image, wherein the color of the regional image is different from the color corresponding to the target color channel sequence; and processing the area outside the area corresponding to the target area in the first intermediate image and the regional image to obtain the second intermediate image.
[0092] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 3, wherein the processing of the area outside the area corresponding to the target area in the first intermediate image and the area image includes: fusing the area outside the area corresponding to the target area in the first intermediate image and the area image.
[0093] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 1, wherein the image processing model is obtained in the following manner: obtaining a mask of an area to be stylized of a data sample in paired data, wherein the paired data includes the data sample and a real sample, and the real sample includes a stylized reference area; and training the image processing model in combination with the mask of the area to be stylized and the stylized reference area to obtain the image processing model.
[0094] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 5, wherein the method further comprises: before obtaining a mask of a region to be stylized of the data sample in the paired data, changing the color channel order of the data sample;
[0095] The obtaining of the mask of the region to be stylized of the data sample in the paired data includes: obtaining the mask of the region to be stylized of the data sample after the color channel sequence is changed.
[0096] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 6, wherein changing the color channel order of the data samples includes randomly disrupting the color channel order of the data samples.
[0097] According to one or more embodiments of the present disclosure, Example 8 provides an image processing device, including: a receiving module for receiving an image to be processed, wherein the image to be processed includes a target area whose color needs to be changed; a channel transformation module for transforming the original color channel order of the image to be processed into a target color channel order to obtain a first intermediate image; a stylization module for stylizing the area corresponding to the target area in the first intermediate image using an image processing model to obtain a second intermediate image, wherein the color of the area corresponding to the target area in the second intermediate image is different from the color corresponding to the target color channel order; a channel restoration module for restoring the color channel order of the second intermediate image to the original color channel order to obtain a target image, wherein the color of the area corresponding to the target area in the target image is different from the color of the target area in the image to be processed.
[0098] According to one or more embodiments of the present disclosure, Example 9 provides a computer-readable medium having a computer program stored thereon, which implements the steps of the method described in any one of Examples 1-7 when executed by a processing device.
[0099] According to one or more embodiments of the present disclosure, Example 10 provides an electronic device, comprising: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of any one of the methods described in Examples 1-7.
[0100] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0101] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0102] Although the subject matter has been described using language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims. Regarding the apparatus in the above-described embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method and will not be elaborated upon here.
Claims
1. An image processing method, comprising: Receiving an image to be processed, wherein the image to be processed includes a target area that needs to change color; Converting the original color channel order of the image to be processed into the target color channel order to obtain a first intermediate image; Using an image processing model to perform stylization processing on a region in the first intermediate image corresponding to the target region to obtain a second intermediate image, wherein a color of the region in the second intermediate image corresponding to the target region is different from a color corresponding to a sequence of the target color channels; and The color channel order of the second intermediate image is restored to the original color channel order to obtain a target image, wherein the color of the area corresponding to the target area in the target image is different from the color of the target area in the image to be processed.
2. The method according to claim 1, wherein: The original color channel order and the target color channel order are respectively one of the following color channel orders and are different from each other: RGB, RBG, GRB, GBR, BRG, BGR.
3. The method according to claim 1 or 2, wherein: The step of using the image processing model to perform stylization processing on the area corresponding to the target area in the first intermediate image to obtain a second intermediate image includes: identifying an area in the first intermediate image corresponding to the target area; Convert the identified area into image data; Using the image processing model to perform stylized processing on the image data to obtain a regional image, wherein the color of the regional image is different from the color corresponding to the target color channel sequence; and The area other than the area corresponding to the target area in the first intermediate image and the regional image are processed to obtain the second intermediate image.
4. The method according to claim 3, wherein: The processing of the area outside the area corresponding to the target area in the first intermediate image and the regional image includes: The region image is fused with a region other than a region corresponding to the target region in the first intermediate image.
5. The method according to any one of claims 1 to 4, wherein: The image processing model is obtained in the following way: Obtaining a mask of a region to be stylized of a data sample in paired data, wherein the paired data includes the data sample and a real sample, and the real sample includes a stylized reference region; and The image processing model is trained in combination with the mask of the area to be stylized and the stylized reference area to obtain the image processing model.
6. The method according to claim 5, wherein: The method further comprises: before obtaining a mask of a region of the data sample to be stylized in the paired data, changing the color channel order of the data sample; The obtaining of the mask of the region to be stylized of the data sample in the paired data includes: obtaining the mask of the region to be stylized of the data sample after the color channel sequence is changed.
7. The method according to claim 6, wherein: The changing the color channel order of the data sample comprises: The color channel order of the data samples is randomly shuffled.
8. An image processing device, comprising: A receiving module is configured to receive an image to be processed, wherein the image to be processed includes a target area that needs to change color; A channel conversion module is configured to convert the original color channel order of the image to be processed into a target color channel order to obtain a first intermediate image; a stylization module configured to perform stylization processing on the region corresponding to the target region in the first intermediate image using an image processing model to obtain a second intermediate image, wherein a color of the region corresponding to the target region in the second intermediate image is different from a color corresponding to a sequence of the target color channels; and The channel restoration module is configured to restore the color channel order of the second intermediate image to the original color channel order to obtain a target image, wherein the color of the area in the target image corresponding to the target area is different from the color of the target area in the image to be processed.
9. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 7 are implemented.
10. An electronic device comprising: a storage device having a computer program stored thereon; A processing device is configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Face image composition method and device
CN106156730A
Portrait cartooning method and device
CN111046763A
Face changing method and device and electronic equipment
CN111627076A
Image processing method, device and equipment and storage medium
CN111666788A
Facial image style conversion method and device, storage medium and electronic equipment
CN112419477A