Image generation method and apparatus, electronic device, and storage medium
By acquiring multiple single-channel images of the source image and generating a target function set based on the target scene, the problems of high cost of manually changing image colors and unstable training of artificial intelligence models in existing technologies are solved, thus achieving fast and low-cost image generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2021-11-12
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, manually changing the color of an image requires the operation of professional technicians, which is costly. On the other hand, using trained artificial intelligence models requires a large amount of paired data, which leads to unstable training and color deviations in the output images.
By acquiring multiple single-channel images of the source image, obtaining the target function set according to the target scene, and inputting the single-channel images into the target function to generate the target single-channel image, the target image is finally synthesized. This reduces the dependence on paired data and improves the stability and efficiency of training.
It enables the rapid generation of satisfactory images without collecting large amounts of data, reducing labor costs and improving the speed and performance of image generation.
Smart Images

Figure CN114078098B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and more particularly to computer vision and deep learning technologies. More specifically, this disclosure provides an image generation method, apparatus, electronic device, and storage medium. Background Technology
[0002] In related technologies, the colors of an image can be manually altered, such as by manually adjusting the colors using image editing tools. Alternatively, the image can be input into a trained artificial intelligence model to obtain a color-corrected image. This color-corrected image can correspond to a predetermined scene. Summary of the Invention
[0003] This disclosure provides an image generation method, apparatus, device, and storage medium.
[0004] According to the first aspect, an image generation method is provided, the method comprising: acquiring multiple single-channel images of a source image; acquiring a target function set according to a target scene, wherein the target function set includes at least one target function; inputting the multiple single-channel images into each target function for at least one target function in the target function set to obtain at least one target single-channel image; and generating a target image based on the at least one target single-channel image.
[0005] According to a second aspect, an image generation apparatus is provided, the apparatus comprising: a first acquisition module for acquiring multiple single-channel images of a source image; a second acquisition module for acquiring a target function set according to a target scene, wherein the target function set includes at least one target function; an acquisition module for inputting the multiple single-channel images into each target function for at least one target function in the target function set to obtain at least one target single-channel image; and a first generation module for generating a target image based on the at least one target single-channel image.
[0006] According to a third aspect, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a method provided according to the present disclosure.
[0007] According to a fourth aspect, a non-transitory computer-readable storage medium is provided that stores computer instructions for causing a computer to perform the methods provided in this disclosure.
[0008] According to a fifth aspect, a computer program product is provided, including a computer program that, when executed by a processor, implements the method provided in this disclosure.
[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0010] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0011] Figure 1 This is an exemplary system architecture diagram of an image generation method and apparatus applicable according to an embodiment of the present disclosure;
[0012] Figure 2 This is a flowchart of an image generation method according to an embodiment of the present disclosure;
[0013] Figure 3 This is a flowchart of an image generation method according to another embodiment of the present disclosure;
[0014] Figure 4A This is a schematic diagram of an image generation method according to an embodiment of the present disclosure;
[0015] Figure 4B This is a schematic diagram of an image generation method according to another embodiment of the present disclosure.
[0016] Figure 5A This is a schematic diagram of a source image according to an embodiment of the present disclosure;
[0017] Figure 5B This is a schematic diagram of a target image according to an embodiment of the present disclosure;
[0018] Figure 6 This is a block diagram of an image generation apparatus according to an embodiment of the present disclosure; and
[0019] Figure 7 This is a block diagram of an electronic device to which an image generation method can be applied according to an embodiment of the present disclosure. Detailed Implementation
[0020] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0021] In related technologies, manually changing the color of an image requires skilled personnel and is costly. Using trained artificial intelligence models can reduce manual costs. However, training these models requires a large amount of paired data (samples and corresponding labels), which is also costly. Using unpaired data to train the model leads to unstable training results and color deviations in the output images.
[0022] Figure 1 This is a schematic diagram of an exemplary system architecture for applying an image generation method and apparatus according to an embodiment of this disclosure. It should be noted that... Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.
[0023] like Figure 1 As shown, the system architecture 100 according to this embodiment may include multiple terminal devices 101, a network 102, and a server 103. The network 102 serves as a medium for providing a communication link between the terminal devices 101 and the server 103. The network 102 may include various connection types, such as wired and / or wireless communication links, etc.
[0024] Users can use terminal device 101 to interact with server 103 via network 102 to receive or send messages, etc. Terminal device 101 can be various electronic devices, including but not limited to smartphones, tablets, laptops, etc.
[0025] The image generation method provided in this disclosure can generally be executed by server 103. Correspondingly, the image generation apparatus provided in this disclosure can generally be located in server 103. The image generation method provided in this disclosure can also be executed by a server or server cluster that is different from server 103 and capable of communicating with terminal device 101 and / or server 103. Correspondingly, the image generation apparatus provided in this disclosure can also be located in a server or server cluster that is different from server 103 and capable of communicating with terminal device 101 and / or server 103.
[0026] Figure 2 This is a flowchart of an image generation method according to an embodiment of the present disclosure.
[0027] like Figure 2 As shown, the method 200 may include operations S210 to S240.
[0028] In operation S210, multiple single-channel images of the source image are acquired.
[0029] In this embodiment of the disclosure, multiple single-channel images may include three single-channel images.
[0030] For example, the original image can be an RGB image, in which each pixel contains three components: a first color component, a second color component, and a third color component.
[0031] The three single-channel images are the first single-channel image, the second single-channel image, and the third single-channel image. Each pixel in the first single-channel image contains a first color component, each pixel in the second single-channel image contains a second color component, and each pixel in the third single-channel image contains a third color component.
[0032] In one example, the first color component is the red component, the second color component is the green component, and the third color component is the blue component.
[0033] When operating S220, the target function set is obtained based on the target scenario.
[0034] In this embodiment of the disclosure, the target scenario may include a first target scenario.
[0035] For example, the scene corresponding to the source image could be a spring scene, and the first target scene could be an autumn scene. The source image contains multiple trees, and the leaves on the trees can be green. Correspondingly, in the first target scene, the leaves on the trees should be yellow.
[0036] In this embodiment of the disclosure, the target scenario may include a second target scenario.
[0037] For example, the scene corresponding to the source image could be a spring scene, and the second target scene could be a winter scene. The source image contains multiple trees, and the leaves on the trees can be green. Correspondingly, in the second target scene, the leaves on the trees should be white (the color of snow in winter).
[0038] It should be noted that the scene corresponding to the source image can be any one of spring, summer, autumn, and winter scenes, and the first target scene can also be any one of spring, summer, autumn, and winter scenes, as can the second target scene. The spring scene mentioned above as the scene corresponding to the source image is merely an example.
[0039] In this embodiment of the disclosure, a target function set can be obtained based on the target scene and the source image.
[0040] In this embodiment of the disclosure, the objective function set includes at least one objective function.
[0041] In this embodiment of the disclosure, the objective function set may include K objective functions, where K is a positive integer greater than or equal to 1.
[0042] In this embodiment of the disclosure, the k-th objective function among the K objective functions is implemented as follows:
[0043] T k =λ Gk *G+λ Rk *R+λ Bk *B (Formula 1)
[0044] k is a positive integer less than or equal to K, T k Let R be the single-channel image of the k-th target, G be the first single-channel image, and B be the third single-channel image; -0.5≤λ Rk ≤0, 0≤λ Gk ≤2, -0.7≤λ Bk ≤0.2.
[0045] For example, based on the first target scenario, a first set of target functions can be obtained. In one example, the first set of target functions includes M target functions, where M is a positive integer greater than or equal to 1.
[0046] For example, based on the second objective scenario, a second objective dataset can be obtained. In one example, the second objective function set includes N objective functions, where N is a positive integer greater than or equal to 1.
[0047] In operation S230, for at least one objective function in the objective function set, multiple single-channel images are input into each objective function to obtain at least one objective single-channel image.
[0048] For example, for M target functions in the first target function set obtained based on the first target scene, multiple single-channel images are input into each target function to obtain M first target single-channel images.
[0049] In one example, M = 1. The objective function in the first set of objective functions is implemented as follows:
[0050] T m =λ Gm *G+λ Rm *R+λ Bm *B (Formula 2)
[0051] T m For the first target single-channel image, λ Gm =2,λ Rm =-0.5, λ Bm = -0.7. T m Each pixel in the image can contain a red component.
[0052] When the scene corresponding to the source image is a spring scene and the first target scene is an autumn scene, the leaves of many trees in the source image are green. Therefore, it is necessary to change the green leaves to yellow leaves. A higher weight can be assigned to the second single-channel image to assign the values of the green components in the image to other channels. To prevent the color component values in the first target single-channel image from exceeding 255, weights (λ) for the first and second single-channel images are determined separately. Rm and λ Bm ).
[0053] For example, for N objective functions in the second objective function set, multiple single-channel images are input into each objective function to obtain N second objective single-channel images.
[0054] In one example, N = 3. The three objective functions in the second objective function set are implemented as follows:
[0055] T n1 =λ Gn1 *G+λ Rn1 *R+λ Bn1 *B (Formula 3)
[0056] T n2 =λ Gn2 *G+λ Rn2 *R+λ Bn2 *B (Formula 4)
[0057] T n3 =λ Gn3 *G+λ Rn3 *R+λ Bn3 *B (Formula 5)
[0058] T n1 For the first single-channel image of the second target, λ Gn1 =2,λ Rn1 =-0.2, λ Bn1 =0.2. T n1 Each pixel in the image can contain a red component.
[0059] T n2 For the second single-channel image of the second target, λ Gn2 =2,λ Rn2 =-0.2, λ Bn2 =0.2. T n2 Each pixel in the image can contain a green component.
[0060] T n3 For the third single-channel image of the second target, λ Gn3 =2,λ Rn3 =0,λ Bn3= -0.2. T n3 Each pixel in the image can contain a blue component.
[0061] When the scene corresponding to the source image is a spring scene and the second target scene is a winter scene, the leaves of many trees in the source image are green. The green leaves can be changed to white leaves.
[0062] In operation S240, a target image is generated based on at least one target single-channel image.
[0063] In this embodiment of the disclosure, the target image includes a first target image generated for a first target scene.
[0064] In this embodiment of the disclosure, a target image is generated based on multiple single-channel images and a first target single-channel image for a first target scene.
[0065] For example, the first target single-channel image (e.g., T) m Using the image as the red channel, the second single-channel image (e.g., G) of the source image as the green channel, and the third single-channel image (e.g., B) of the source image as the blue channel, an image can be generated, which can then be used as the first target image.
[0066] In this embodiment of the disclosure, the target image includes a second target image generated for a second target scene.
[0067] In this embodiment of the disclosure, a target image is generated based on multiple second target single-channel images for a second target scene.
[0068] For example, the first single-channel image of the second target (e.g., T) n1 The image is used as the red channel, and the second single-channel image of the second target (e.g., T) is used as the red channel image. n2 The image is used as the green channel, and the third single-channel image of the second target (e.g., T) is used as the green channel image. n3 An image using the blue channel can be used to generate an image, which can then be used as the second target image. If only one or two of the three second target single-channel images are used, while the remaining channel images are single-channel images of the source image, the generated image is prone to appearing greenish, reddish, or yellowish.
[0069] This embodiment eliminates the need to collect large amounts of data for model training. By adjusting single-channel images of different color channels based on the source image, satisfactory results can be achieved, far surpassing deep learning model methods in both speed and performance. It also saves significant labor costs.
[0070] Figure 3 This is a flowchart of an image generation method according to another embodiment of the present disclosure.
[0071] like Figure 3 As shown, this method can be used in, for example... Figure 2 The method is executed after operation S240, that is, after generating the target image based on at least one target single-channel image. The method includes operations S350 to S380.
[0072] In operation S350, the source image and the second target image are fused to obtain the third target image.
[0073] In this embodiment of the disclosure, the source image may be an image related to the target scene.
[0074] For example, when the second target scene is a winter scene, the source image can be a snowflake image.
[0075] In this embodiment of the disclosure, the source image and the second target image are fused using the following formula:
[0076]
[0077] For example, P target3 For the third target image, P target2 For the second target image, P material This is a source image.
[0078] Formula Six allows you to fuse source images with target images to obtain an image that more closely resembles the target scene. For example, when the second target scene is a winter scene, you can add snowflakes to the second target image, resulting in an image that more closely resembles a winter scene.
[0079] For example, different source images can be fused with a second target image to obtain multiple third target images. When the second target scene is a winter scene, fusion of different source images with the second target image can add snowflakes in different positions to the second target image, making the generated image scene more closely resemble a winter scene.
[0080] In operation S360, the image to be processed and the first target image are fused at least once to obtain at least one first gradient image.
[0081] In this embodiment of the disclosure, at least one first gradient image may include H first gradient images.
[0082] In this embodiment of the disclosure, the image to be processed and the first target image are fused for the h-th time using the following formula:
[0083] Output1 h =λ h *P penging +(1-λ h )*Ptarget1 (Formula 7)
[0084] h is a positive integer less than or equal to H, 0 < λ h <1, Output1 h For the h-th first gradient image, P penging For the image to be processed, P target1 This is the first target image.
[0085] In one example, the first target scene is an autumn scene, H=9, h=0.1, 0.2, ... 0.9.
[0086] Nine first gradient images can be obtained. From the first first gradient image to the ninth first gradient image, the scene in the image gradually changes to an autumn scene.
[0087] In operation S370, the first target image and the third target image are fused at least once to obtain at least one second gradient image.
[0088] In this embodiment of the disclosure, at least one second gradient image is J second gradient images.
[0089] In this embodiment of the disclosure, the first target image and the third target image are fused for the jth time using the following formula:
[0090] Output2 j =λ j *P target1 +(1-λ j )*P target3 (Formula 8)
[0091] j is a positive integer less than or equal to J, 0 < λ j <1, Output2 j For the j-th second gradient image, P target1 For the first target image, P target3 This is the third target image.
[0092] In one example, the second target scene can be a winter scene, J=9, j=0.1, 0.2, ... 0.9.
[0093] Nine second gradient images can be obtained. From the first second gradient image to the ninth second gradient image, the scene in the image gradually transforms into a winter scene.
[0094] In operation S380, a video is generated based on the source image, H first gradient images, a first target image, J second gradient images, and a third target image.
[0095] For example, by using the source image, H first gradient images, the first target image, J second gradient images, and the third target image as video frames, a video can be generated that transitions from a spring scene to an autumn scene, and then from an autumn scene to a winter scene.
[0096] Through the embodiments of this disclosure, a video about seasonal changes can be generated based on a source image provided by the user, thereby improving the user experience.
[0097] Figure 4A This is a schematic diagram of an image generation method according to an embodiment of the present disclosure.
[0098] like Figure 4A As shown, source image 401 can be an RGB image. The scene corresponding to source image 401 can be a spring scene. Multiple single-channel images of source image 401 can be obtained, namely, first single-channel image 402, second single-channel image 403, and third single-channel image 404.
[0099] Next, based on the target scenario, obtain the first objective function set 405. For example, the target scenario could be an autumn scenario. In one example, the first objective function set 405 could contain one objective function.
[0100] The input to one objective function in the first objective function set 405 can be the first single-channel image 402, the second single-channel image 403, and the third single-channel image 404, and the output can be the first objective single-channel image 406.
[0101] Based on the first target single-channel image 406, a target image 407 can be generated. For example, the first target single-channel image 406 can be used as the red channel image, the second single-channel image 403 as the green channel image, and the third single-channel image 404 as the blue channel image to generate the first target image 407. In one example, the scene corresponding to the target image 407 could be an autumn scene.
[0102] Figure 4B This is a schematic diagram of an image generation method according to an embodiment of the present disclosure.
[0103] like Figure 4B As shown, source image 401 can be an RGB image. The scene corresponding to source image 401 can be a spring scene. Multiple single-channel images of source image 401 can be obtained, namely, first single-channel image 402, second single-channel image 403, and third single-channel image 404.
[0104] Next, based on the target scenario, obtain the second objective function set 408. For example, the target scenario could be a winter scenario. In one example, objective function set 408 could contain three objective functions: the first objective function 4081, the second objective function 4082, and the third objective function 4083.
[0105] The input to each objective function in the second set of objective functions 408 can be a first single-channel image 402, a second single-channel image 403, and a third single-channel image 404. The first objective function 4081 can output a first second objective single-channel image 409, the second objective function 4082 can output a second second objective single-channel image 410, and the third objective function 4083 can output a third second objective single-channel image 411.
[0106] A second target image 412 can be generated from three single-channel images 406 of the second target. For example, the first single-channel image 409 of the second target can be used as the red channel image, the second single-channel image 410 of the second target can be used as the green channel image, and the third single-channel image 411 of the second target can be used as the blue channel image to generate the second target image 412. In one example, the scene corresponding to the second target image 412 could be a winter scene.
[0107] Figure 5A This is a schematic diagram of a source image according to an embodiment of the present disclosure.
[0108] like Figure 5A As shown, the scene corresponding to the source image 501 can be a spring scene.
[0109] Figure 5B This is a schematic diagram of a target image according to an embodiment of the present disclosure.
[0110] like Figure 5B As shown, the scene corresponding to the target image 502 can be a winter scene. In one example, the target image 502 can be based on, for example... Figure 3 The result is obtained from operation S350.
[0111] Figure 6 This is a block diagram of an image generation apparatus according to an embodiment of the present disclosure.
[0112] like Figure 6 As shown, the device 600 may include a first acquisition module 610, a second acquisition module 620, an acquisition module 630, and a first generation module 640.
[0113] The first acquisition module 610 is used to acquire multiple single-channel images of the source image.
[0114] The second acquisition module 620 is used to acquire a target function set according to the target scenario, wherein the target function set includes at least one target function.
[0115] The module 630 is used to input the multiple single-channel images into each objective function for at least one objective function in the above objective function set, so as to obtain at least one target single-channel image.
[0116] The first generation module 640 is used to generate a target image based on at least one target single-channel image.
[0117] In some embodiments, the above-mentioned set of objective functions includes K objective functions, where K is a positive integer greater than or equal to 1; the k-th objective function among the above K objective functions is implemented as follows:
[0118] T k =λ Gk *G+λ Rk *R+λ Bk *B
[0119] Where k is a positive integer less than or equal to K, T k Let R be the single-channel image of the k-th target, G be the first single-channel image, and B be the third single-channel image; -0.5≤λ Rk ≤0, 0≤λ Gk ≤2, -0.7≤λ Bk ≤0.2.
[0120] In some embodiments, the target scene includes a first target scene and a second target scene, and the target image includes at least one of the following: a first target image generated for the first target scene; and a second target image generated for the second target scene.
[0121] In some embodiments, the apparatus 600 further includes a first fusion module for fusing the source image and the second target image to obtain a third target image.
[0122] In some embodiments, the first fusion module is further configured to: fuse the source image and the second target image using the following formula:
[0123]
[0124] Among them, P target3 For the third target image mentioned above, P target2 For the second target image mentioned above, P material The above image is the source material.
[0125] In some embodiments, the device 600 further includes: a second fusion module for fusing the image to be processed and the first target image at least once to obtain at least one first gradient image; and a third fusion module for fusing the first target image and the third target image at least once to obtain at least one second gradient image.
[0126] In some embodiments, the at least one first gradient image comprises H first gradient images; the second fusion module is further configured to: perform a h-th fusion of the image to be processed and the first target image using the following formula:
[0127] Output1 h =λ h *P penging +(1-λh)*P target1
[0128] Where h is a positive integer less than or equal to H, and 0 < λ h <1, Output1 h For the h-th first gradient image, P penging For the above image to be processed, P target1 The first target image is as described above; the at least one second gradient image includes J second gradient images.
[0129] The aforementioned third fusion module is also used to: perform the j-th fusion of the first target image and the third target image using the following formula:
[0130] Output2 j =λ j *P target1 +(1-λ j )*P target3
[0131] Where j is a positive integer less than or equal to J, and 0 < λ j <1, Output2 j For the j-th second gradient image, P target1 For the first target image mentioned above, P target3 This refers to the image of the third target mentioned above.
[0132] In some embodiments, the apparatus 600 further includes a second generation module for generating a video based on the source image, the H first gradient images, the first target image, the J second gradient images, and the third target image.
[0133] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0134] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0135] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0136] like Figure 7 As shown, device 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 702 or a computer program loaded from storage unit 708 into random access memory (RAM) 703. RAM 703 may also store various programs and data required for the operation of device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via bus 704. Input / output (I / O) interface 705 is also connected to bus 704.
[0137] Multiple components in device 700 are connected to I / O interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 707, such as various types of monitors, speakers, etc.; storage unit 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0138] The computing unit 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as image generation methods. For example, in some embodiments, the image generation method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the image generation method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the image generation method by any other suitable means (e.g., by means of firmware).
[0139] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0140] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0141] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, 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 devices, magnetic storage devices, or any suitable combination of the foregoing.
[0142] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0143] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0144] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
[0145] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0146] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. An image generation method, comprising: Acquire three single-channel images of the source image, the three single-channel images including a first single-channel image with a red component, a second single-channel image with a green component, and a third single-channel image with a blue component, and the source image is an image of a spring scene; Based on the target scenario, a first set of target functions is obtained, wherein the target scenario includes an autumn scenario, and the first set of target functions includes one target function; The three single-channel images are input into the one target function to obtain a single target single-channel image. : in, The first single-channel image containing the red component. The second single-channel image containing the green component, The third single-channel image having the blue component; and Using the target single-channel image Replace the first single-channel image R with the red component, and generate a first target image with an autumn scene based on the target single-channel image T, the second single-channel image G with the green component, and the third single-channel image B with the blue component. The method further includes: The source image and the first target image are fused at least once to obtain at least one first gradient image; and A video is generated based on the source image, the at least one first gradient image, and the first target image. Wherein, the at least one first gradient image includes H first gradient images; the process of fusing the source image and the first target image at least once to obtain at least one first gradient image includes: The source image and the first target image are fused for the h-th time using the following formula: Where h is a positive integer less than or equal to H, 0 < <1, For the h-th first gradient image, For the source image, The first target image.
2. The method according to claim 1, wherein, The target scenarios also include winter scenarios. The method further includes: Based on the winter scenario, a second set of objective functions is obtained, which includes three objective functions: The three single-channel images are input into the three target functions to obtain three target single-channel images. , and ;as well as Using the three target single-channel images , and The first single-channel image with the red component, the second single-channel image with the green component, and the third single-channel image with the blue component are replaced respectively to generate a second target image with a winter scene.
3. The method according to claim 2, further comprising: The source image and the second target image are fused together to obtain the third target image.
4. The method according to claim 3, wherein, The step of fusing the source image and the second target image to obtain the third target image includes: The source image and the second target image are fused using the following formula: in, The third target image, The second target image, The image in question is the source image.
5. The method according to claim 3 or 4, further comprising: The first target image and the third target image are fused at least once to obtain at least one second gradient image.
6. The method according to claim 5, wherein, The at least one second gradient image includes J second gradient images; the process of fusing the first target image and the third target image at least once to obtain at least one second gradient image includes: The first target image and the third target image are fused for the j-th time using the following formula: Where j is a positive integer less than or equal to J, 0 < <1, For the j-th second gradient image, The first target image, The third target image.
7. The method according to claim 6, further comprising: A video is generated based on the source image, the H first gradient images, the first target image, the J second gradient images, and the third target image.
8. An image generation apparatus, comprising: The first acquisition module is used to acquire three single-channel images of the source image. The three single-channel images include a first single-channel image with a red component, a second single-channel image with a green component, and a third single-channel image with a blue component. The source image is an image of a spring scene. The second acquisition module is used to acquire a first set of target functions based on the target scene, wherein the target scene includes an autumn scene, and the set of target functions includes one target function; The three single-channel images are input into the target function to obtain a single target single-channel image. : in, The first single-channel image containing the red component, The second single-channel image containing the green component, The third single-channel image having the blue component; and The first generation module is used to generate the target single-channel image. Replace the first single-channel image R with the red component, and generate a first target image of the autumn scene based on the target single-channel image T, the second single-channel image G with the green component, and the third single-channel image B with the blue component. The device further includes: The second fusion module is configured to fuse the source image and the first target image at least once to obtain at least one first gradient image; and The second generation module is used to generate a video based on the source image, the at least one first gradient image, and the first target image. Wherein, the at least one first gradient image includes H first gradient images; the process of fusing the source image and the first target image at least once to obtain at least one first gradient image includes: The source image and the first target image are fused for the h-th time using the following formula: Where h is a positive integer less than or equal to H, 0 < <1, For the h-th first gradient image, For the source image, The first target image.
9. The apparatus according to claim 8, wherein, The target scenarios also include winter scenarios. The second acquisition module is further configured to: Based on the winter scenario, a second set of objective functions is obtained, which includes three objective functions: The three single-channel images are input into the three target functions to obtain three target single-channel images. , and ;as well as The first generation module is also used to: use the three target single-channel images , and The first single-channel image with the red component, the second single-channel image with the green component, and the third single-channel image with the blue component are replaced respectively to generate a second target image with a winter scene.
10. The apparatus according to claim 9, further comprising: The first fusion module is used to fuse the source image and the second target image to obtain the third target image.
11. The apparatus according to claim 10, wherein, The first fusion module is also used for: The source image and the second target image are fused using the following formula: in, The third target image, The second target image, The image in question is the source image.
12. The apparatus according to claim 10 or 11, further comprising: The third fusion module is used to fuse the first target image and the third target image at least once to obtain at least one second gradient image.
13. The apparatus according to claim 12, wherein, The at least one second gradient image includes J second gradient images; the third fusion module is further configured to: The first target image and the third target image are fused for the j-th time using the following formula: Where j is a positive integer less than or equal to J, 0 < <1, For the j-th second gradient image, The first target image, The third target image.
14. The apparatus of claim 13, further comprising: The second generation module is used to generate a video based on the source image, the H first gradient images, the first target image, the J second gradient images, and the third target image.
15. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 7.
16. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 7.
17. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Image restoration method and system, readable storage medium and computer equipment
CN109919872A