Image color adjustment method and device, computer readable storage medium, and electronic device
By obtaining the statistical characteristics of the image to be processed and the reference image, the target mapping relationship is dynamically generated, which solves the problem of lack of pertinence of the LUT table in the existing technology and achieves high-accuracy image coloring processing.
Patent Information
- Application Number
- CN202110505184.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-10
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-05-10
AI Technical Summary
When using static LUT tables for image color grading in the prior art, there is a lack of pertinence, resulting in poor color grading effects.
By obtaining the statistical characteristics of the image to be processed and the reference image, the target mapping relationship is dynamically generated, and the image to be processed is color-adjusted based on the relationship, thereby improving the accuracy of the color-adjusting process.
It achieves highly targeted image coloring processing, improves the coloring effect, and ensures the accuracy and effect of image processing.
Smart Images

Figure CN113240599B
Abstract
Description
Background Art
[0002] With the development of image processing technology, it is possible to adjust multiple styles for an image, so that images with the same content can be transformed into multiple styles.
[0003] In the prior art, a LUT table is often used for color adjustment, but the LUT table is manually made by designers, usually one LUT table is made for one style, and different images to be processed use the same LUT table for color adjustment. The method of using a static LUT table for color adjustment in the prior art is not targeted and has a poor color adjustment effect. Summary of the invention
[0004] The purpose of the present disclosure is to provide an image color adjustment method, an image color adjustment device, a computer-readable storage medium and an electronic device, thereby at least to a certain extent solving the problem of low specificity in the prior art.
[0005] According to a first aspect of the present disclosure, there is provided an image color adjustment method, comprising: obtaining statistical features of an image to be processed and obtaining statistical features of a reference image; generating a target mapping relationship corresponding to the image to be processed according to the statistical features of the image to be processed and the statistical features of the reference image; and performing color adjustment on the image to be processed according to the target mapping relationship.
[0006] According to a second aspect of the present disclosure, an image color adjustment device is provided, comprising: a feature acquisition module, used to obtain statistical features of an image to be processed and statistical features of a reference image; a mapping generation module, used to generate a target mapping relationship corresponding to the image to be processed based on the statistical features of the image to be processed and the statistical features of the reference image; and a color adjustment processing module, used to perform color adjustment processing on the image to be processed based on the target mapping relationship.
[0007] According to a third aspect of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the image color adjustment method as described in the above embodiment is implemented.
[0008] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the image color adjustment method as described in the above embodiments.
[0009] It can be seen from the above technical solutions that the image color adjustment method and device, system, computer-readable storage medium, and electronic device in the exemplary embodiments of the present disclosure have at least the following advantages and positive effects:
[0010] The image color adjustment method disclosed in the present invention recognizes the text information corresponding to the voice information and obtains the entity fragment corresponding to the text information; first, obtains the statistical features of the image to be processed and the statistical features of the reference image; then, generates the target mapping relationship corresponding to the image to be processed according to the statistical features of the image to be processed and the statistical features of the reference image; finally, performs color adjustment processing on the image to be processed according to the target mapping relationship. The image color adjustment method disclosed in the present invention dynamically generates the target mapping relationship through the statistical features of the image to be processed and the reference image, the generated target mapping relationship is targeted, and performs color adjustment processing on the image to be processed according to the target mapping relationship, thereby improving the accuracy of image processing.
[0011] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0013] Figure 1 A schematic diagram schematically shows a system architecture of this exemplary embodiment;
[0014] Figure 2 A schematic diagram schematically shows an electronic device according to this exemplary embodiment;
[0015] Figure 3 The flowchart of the image color adjustment method according to an embodiment of the present disclosure is schematically shown;
[0016] Figure 4 The following is a schematic diagram showing a flow chart of a method for obtaining statistical features of an image to be processed according to an embodiment of the present disclosure;
[0017] Figure 5 A schematic diagram of a method flow for generating a target mapping relationship according to an embodiment of the present disclosure is shown;
[0018] Figure 6 A schematic diagram of a method flow for obtaining feature information corresponding to an input pixel value according to an embodiment of the present disclosure is shown;
[0019] Figure 7 A schematic diagram of a method flow for generating a target mapping relationship according to an embodiment of the present disclosure is shown;
[0020] Figure 8 The following is a schematic diagram showing a process flow of an image color adjustment method according to a specific embodiment of the present disclosure;
[0021] Fig. 9 The block diagram schematically shows an image color adjustment device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0022] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more comprehensive and complete and will fully convey the concept of the example embodiments to those skilled in the art.
[0023] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0024] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0025] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0026] In the related art of this field, designers manually modulate LUT tables of different styles, determine the LUT table of the target style, and perform LUT mapping on the image to be processed to obtain an output image of the target style corresponding to the image to be processed. However, the LUT table obtained by manual modulation is static and has no scalability. It can only be used as a filter and has low pertinence for different toning of images to be processed.
[0027] Based on the problems existing in the related art, the embodiment of the present disclosure first provides an image color adjustment method, which is applied to the system architecture of the exemplary embodiment of the present disclosure. Figure 1A schematic diagram of a system architecture of an exemplary embodiment of the present disclosure is shown. Figure 1 As shown, the system architecture 100 may include: a terminal 110, a network 120 and a server 130. The terminal 110 may be any electronic device with an audio acquisition function, including but not limited to a mobile phone, a tablet computer, a personal computer, a smart wearable device, etc. The network 120 is used to provide a medium for a communication link between the terminal 110 and the server 130, and may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. It should be understood that Figure 1 The number of terminals, networks and servers in the embodiment is only for illustration. Any number of terminals, networks and servers may be provided as required. For example, the server 130 may be a server cluster composed of multiple servers.
[0028] The image color adjustment method provided in the embodiment of the present disclosure can be executed by the terminal 110, for example, the terminal 110 obtains the image to be processed and the reference image, generates a target mapping relationship according to the statistical features of the image to be processed and the reference image, and performs color adjustment on the image to be processed according to the target mapping relationship.
[0029] In addition, the image color adjustment method provided in the embodiment of the present disclosure can also be executed by the server 130. For example, after the terminal 110 obtains the image to be processed and the reference image, the image to be processed and the reference image are uploaded to the server 130, so that the server 130 generates a target mapping relationship based on the statistical features of the image to be processed and the reference image, and performs color adjustment on the image to be processed according to the target mapping relationship, and returns the image to be processed after the color adjustment to the terminal 110. The present disclosure does not limit this.
[0030] An exemplary embodiment of the present disclosure provides an electronic device for implementing an image color adjustment method, which may be Figure 1 The terminal 110 or the server 130 in the embodiment. The electronic device at least comprises a processor and a memory, the memory is used to store executable instructions of the processor, and the processor is configured to execute the image color adjustment method by executing the executable instructions.
[0031] Electronic devices can be implemented in various forms, for example, they can include mobile devices such as mobile phones, tablet computers, laptops, personal digital assistants (PDAs), navigation devices, wearable devices, drones, and fixed devices such as desktop computers and smart TVs.
[0032] Below Figure 2 Taking the mobile terminal 200 in FIG. 1 as an example, the structure of the electronic device is exemplarily described. It should be understood by those skilled in the art that, in addition to the components specifically used for mobile purposes, Figure 2The structure in the figure can also be applied to fixed type devices. In other embodiments, the mobile terminal 200 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure can be implemented in hardware, software, or a combination of software and hardware. The interface connection relationship between the components is only shown schematically and does not constitute a structural limitation of the mobile terminal 200. In other embodiments, the mobile terminal 200 may also adopt the same Figure 2 Different interface connection methods, or a combination of multiple interface connection methods.
[0033] like Figure 2 As shown, the mobile terminal 200 may specifically include: a processor 210, an internal memory 221, an external memory interface 222, a USB interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 271, a receiver 272, a microphone 273, an earphone interface 274, a sensor module 280, a display screen 290, a camera module 291, an indicator 292, a motor 293, a button 294, and a subscriber identification module (Subscriber Identification Module, SIM) card interface 295, etc. The sensor module 280 may include a depth sensor 2801, a pressure sensor 2802, a gyroscope sensor 2803, an air pressure sensor 2804, etc.
[0034] The processor 210 may include one or more processing units, for example, the processor 210 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor and / or a neural network processor (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0035] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the mobile terminal 200 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0036] The processor 210 is provided with a memory. The memory can store instructions for implementing six modular functions: detection instructions, connection instructions, information management instructions, analysis instructions, data transmission instructions, and notification instructions, and the execution is controlled by the processor 210.
[0037] The charging management module 240 is used to receive charging input from the charger. The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives input from the battery 242 and / or the charging management module 240 to power the processor 210, the internal memory 221, the display screen 290, the camera module 291 and the wireless communication module 260.
[0038] The wireless communication function of the mobile terminal 200 can be implemented through antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modulation and demodulation processor and baseband processor. Among them, antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals; mobile communication module 250 can provide solutions for wireless communication including 2G / 3G / 4G / 5G applied on mobile terminal 200; modulation and demodulation processor can include modulator and demodulator; wireless communication module 260 can provide solutions for wireless communication including wireless local area network (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT) and the like applied on mobile terminal 200. In some embodiments, antenna 1 of mobile terminal 200 is coupled with mobile communication module 250, and antenna 2 is coupled with wireless communication module 260, so that mobile terminal 200 can communicate with network and other devices through wireless communication technology.
[0039] The mobile terminal 200 implements the display function through a GPU, a display screen 290, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 290 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 210 may include one or more GPUs that execute program instructions to generate or change display information.
[0040] The mobile terminal 200 can realize the shooting function through the ISP, the camera module 291, the video codec, the GPU, the display screen 290 and the application processor, etc. Among them, the ISP is used to process the data fed back by the camera module 291; the camera module 291 is used to capture static images or videos; the digital signal processor is used to process digital signals, and can process other digital signals in addition to digital image signals; the video codec is used to compress or decompress digital videos, and the mobile terminal 200 can also support one or more video codecs.
[0041] The external memory interface 222 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile terminal 200. The external memory card communicates with the processor 210 through the external memory interface 222 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0042] The internal memory 221 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 221 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the mobile terminal 200 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash memory (Universal Flash Storage, UFS), etc. The processor 210 executes various functional applications and data processing of the mobile terminal 200 by running instructions stored in the internal memory 221 and / or instructions stored in a memory provided in the processor.
[0043] The mobile terminal 200 can implement audio functions such as music playing and recording through the audio module 270 , the speaker 271 , the receiver 272 , the microphone 273 , the earphone interface 274 and the application processor.
[0044] The depth sensor 2801 is used to obtain the depth information of the scene. In some embodiments, the depth sensor can be arranged in the camera module 291.
[0045] The pressure sensor 2802 is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 2802 can be arranged on the display screen 290. There are many types of pressure sensors 2802, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc.
[0046] The gyro sensor 2803 can be used to determine the motion posture of the mobile terminal 200. In some embodiments, the angular velocity of the mobile terminal 200 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 2803. The gyro sensor 2803 can be used for shooting anti-shake, navigation, somatosensory game scenes, etc.
[0047] In addition, sensors with other functions may be set in the sensor module 280 according to actual needs, such as an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0048] The mobile terminal 200 may also include other devices that provide auxiliary functions. For example, the key 294 includes a power key, a volume key, etc., and the user can generate key signal input related to the user settings and function control of the mobile terminal 200 through key input. For example, the indicator 292, the motor 293, the SIM card interface 295, etc.
[0049] The image color adjustment method and the image color adjustment device according to the exemplary embodiments of the present disclosure are described in detail below. Figure 3 A flow chart of an image color adjustment method is shown, as shown in 3, the image color adjustment method at least comprises the following steps:
[0050] Step S310: obtaining statistical features of the image to be processed and obtaining statistical features of the reference image;
[0051] Step S320: generating a target mapping relationship corresponding to the image to be processed according to the statistical features of the image to be processed and the statistical features of the reference image;
[0052] Step S330: performing color adjustment on the image to be processed according to the target mapping relationship.
[0053] The image color adjustment method disclosed in the present invention dynamically generates a target mapping relationship through statistical features of the image to be processed and the reference image. The generated target mapping relationship is targeted, and color adjustment is performed on the image to be processed according to the target mapping relationship, thereby improving the accuracy of the color adjustment processing.
[0054] In order to make the technical solution of the present disclosure clearer, each step of the image color adjustment method is described below.
[0055] In step S310, statistical features of the image to be processed are obtained, and statistical features of the reference image are obtained.
[0056] In the exemplary embodiments of the present disclosure, the image to be processed refers to a target image for image color adjustment. The image to be processed can be an image input by a user, or can be obtained by photographing by an image acquisition unit, or can be obtained by drawing by image editing software. The present disclosure does not specifically limit the acquisition method and acquisition path of the image to be processed.
[0057] In addition, the reference image refers to a source image used to provide style information during the image color adjustment process. For example, the reference image can be an image with a retro style, or an image with warm or cold tones, which is not specifically limited in the present disclosure.
[0058] For example, based on image A and image B, through image color processing, a target image C is output, and the target image C has the shape of image A and the style of image B. At this time, it can be considered that image A is the image to be processed and image B is the reference image.
[0059] In an exemplary embodiment of the present disclosure, before acquiring statistical features of the image to be processed, the image to be processed is scaled to obtain a processed image to be processed, wherein the resolution of the processed image to be processed is smaller than the resolution of the image to be processed.
[0060] Specifically, the image to be processed is scaled using a scaling function to obtain an image to be processed with a smaller resolution. Among them, the image to be processed can be scaled using a resize scaling function. For example, an image with a resolution of 1080*1920 is scaled using the resize scaling function to obtain an image of 640*360. Of course, the scaling multiple can be any multiple, and the present disclosure does not specifically limit this.
[0061] In an exemplary embodiment of the present disclosure, the statistical features include feature mean information and feature standard deviation information, wherein the feature mean information includes the feature mean corresponding to the feature information of the image to be processed, and the feature standard deviation information includes the feature standard deviation corresponding to the feature information of the image to be processed.
[0062] Specifically, Figure 4 A schematic diagram of a method for obtaining statistical features of an image to be processed is shown in FIG. Figure 4 As shown, the process at least includes steps S410 to S420, which are described in detail as follows:
[0063] In step S410, the image to be processed is input into a feature extraction model to obtain feature information corresponding to the image to be processed.
[0064] In an exemplary embodiment of the present disclosure, the feature extraction model may be a convolutional neural network (CNN), which is a hierarchical model whose input is raw data, such as RGB images, raw audio data, etc. The convolutional neural network extracts high-level semantic information from the raw data input layer layer by layer through a series of operations such as convolution operations, pooling operations, and non-linear activation function mapping. This process is called "feed-forward".
[0065] For example, the feature extraction model may be a convolutional neural network with a 1*1 convolution kernel, which upsamples each pixel in the input image to be processed, and upsamples the RGB channels in each pixel into multi-channel feature information. For example, the pixel information of the RGB channel may be converted into 64-channel feature information. The present disclosure does not specifically limit the specific structure of the convolutional neural network.
[0066] Specifically, the image to be processed is input into the convolutional neural network, and the convolutional neural network is used to extract features of the image to be processed to obtain feature information of the image to be processed. In addition, the image to be processed after scaling can also be input into the convolutional neural network to obtain feature information of the image to be processed.
[0067] In step S420, feature mean information and feature standard deviation information of the image to be processed are calculated according to the feature information of the image to be processed.
[0068] In an exemplary embodiment of the present disclosure, after acquiring feature information of an image to be processed, the mean and standard deviation corresponding to the feature information of the image to be processed are calculated, and the mean and standard deviation corresponding to the feature information of the image to be processed are configured as statistical features of the image to be processed.
[0069] In an exemplary embodiment of the present disclosure, a feature extraction model may be used to extract features from a reference image to obtain feature information of the reference image, and a mean and a standard deviation corresponding to the feature information of the reference image are calculated, and the mean and the standard deviation corresponding to the feature information of the reference image are configured as statistical features of the reference image. The feature extraction model may be the same as or different from the feature extraction model for obtaining feature information of the image to be processed, and the present disclosure does not specifically limit this.
[0070] The reference image may be pre-extracted to obtain feature information of the reference image, and the statistical features of the reference image may be calculated based on the feature information of the reference image. The statistical features corresponding to the reference image may be stored in a database, and the statistical features of the reference image may be directly obtained from the database. For example, a certain style image is selected to perform color adjustment on the image to be processed, and the statistical features corresponding to the style image are obtained in the database.
[0071] In addition, the feature extraction model can be used to extract features from the reference image in real time, and obtain statistical features of the reference image in real time.
[0072] In step S320, a target mapping relationship corresponding to the image to be processed is generated according to the statistical features of the image to be processed and the statistical features of the reference image.
[0073] In an exemplary embodiment of the present disclosure, the target mapping relationship may be a LUT table, the index number of the LUT table is the input pixel value, and the index value of the LUT table is the output pixel value. The input pixel value and the output pixel value both include the values of the RGB channels, specifically including the pixel values composed of the red channel R, the green channel G, and the blue channel B.
[0074] In an exemplary embodiment of the present disclosure, the statistical features of the image to be processed and the statistical features of the reference image may be stored in an ADAIN module, and a target mapping relationship may be generated through the ADAIN module. Figure 5 A schematic diagram of a method for generating a target mapping relationship is shown in FIG. Figure 5 As shown, the process at least includes steps S510 to S520, which are described in detail as follows:
[0075] In step S510, an input pixel value is acquired, and feature extraction is performed on the input pixel value to obtain feature information corresponding to the input pixel value.
[0076] In an exemplary embodiment of the present disclosure, the input pixel value may be a set of pixel values that are preset. For example, the red channel R, the green channel G, and the blue channel B may be pixel values of 0 to 255, respectively. For example, the input pixel values are (0,0,0), (0,0,1), (0,1,0), (1,0,0), ... (0,0,255), (0,255,0), (255,0,0), ... (255,255,255), etc. 256*256*256 input pixel values. For another example, the input pixel values can also be (0,0,0), (0,0,8), (0,8,0), (8,0,0), ... (0,0,32), (0,32,0), (32,0,0), ... (0,0,255), (0,255,0), (255,0,0), ... (255,255,255), etc. 33*33*33 input pixel values.
[0077] In addition, the input pixel value can also be obtained by traversing the image to be processed to obtain the pixel value corresponding to the image to be processed as the input pixel value. Specifically, Figure 6 A schematic diagram of a method for obtaining feature information corresponding to an input pixel value is shown in FIG. Figure 6 As shown, the process at least includes steps S610 to S630, which are described in detail as follows:
[0078] In step S610, the image to be processed is traversed, pixel values corresponding to the image to be processed are obtained, and the pixel values of the image to be processed are configured as input pixel values.
[0079] In an exemplary embodiment of the present disclosure, all pixel points in the image to be processed are traversed, pixel values corresponding to all pixel points are obtained, and the pixel values corresponding to all pixel points are used as input pixel values.
[0080] In addition, the pixel values of each pixel point of the image to be processed can be traversed to obtain the pixel range of the pixel value in the image to be processed, and the input pixel value can be configured according to the pixel range corresponding to the image to be processed. For example, if the pixel range of the pixel point in the red channel R, green channel G, and blue channel B in the image to be processed is 132 to 255, the input pixel value is configured as (0,0,132), (0,132,0), (132,0,0), ... (0,0,255), (0,255,0), (255,0,0), ... (255,255,255), etc.
[0081] In step S620, the input pixel value is subjected to matrix transformation to obtain image information corresponding to the input pixel value.
[0082] In an exemplary embodiment of the present disclosure, the input pixel value is input into the reshape function for matrix transformation to obtain image information corresponding to the input pixel value. The image information may include W*H RGB channel values, where W divided by H, or H divided by W can obtain any positive integer. For example, the input pixel value is input into the reshape function for matrix transformation to obtain 33*1089 image information.
[0083] In step S630, the image information is input into a feature extraction model to obtain feature information corresponding to the image information.
[0084] In an exemplary embodiment of the present disclosure, feature extraction is performed on image information through a feature extraction model to obtain feature information corresponding to the image information, that is, feature information corresponding to the input pixel value.
[0085] In addition, an initial LUT table of 33*33*33 can also be obtained, and the index numbers of the initial LUT table are 33*33*33 input pixel values, and the 33*33*33 input pixel values include: (0,0,0,), (0,0,8,), (0,8,0,), (8,0,0,)...(0,0,255,), (0,255,0,), (255,0,0,). The index value of the initial LUT table is 33*33*33 initial output pixel values, and the initial output pixel value can be any pixel value, which is not specifically limited in the present disclosure.
[0086] The 33*33*33 initial LUT table is input into the reshape function for matrix transformation to obtain 33*1089 image information, and the image information corresponding to the initial LUT table is input into the feature extraction model to obtain the feature information corresponding to the initial LUT table.
[0087] Continue to refer to Figure 5 As shown, in step S520, a target mapping relationship corresponding to the image to be processed is generated according to the feature information of the input pixel value, the statistical features of the image to be processed and the statistical features of the reference image.
[0088] In an exemplary embodiment of the present disclosure, output feature information corresponding to the feature information of the input pixel value is calculated based on the feature information corresponding to the input pixel value, the statistical features of the image to be processed, and the statistical features of the reference image, and the output feature information is input into a feature mapping model to obtain the output pixel value.
[0089] Specifically, Figure 7 A schematic diagram of a method for generating a target mapping relationship is shown in FIG. Figure 7 As shown, the process at least includes steps S710 to S730, which are described in detail as follows:
[0090] In step S710, output feature information corresponding to the feature information of the input pixel value is acquired according to the feature information of the input pixel value, the statistical features of the image to be processed, and the statistical features of the reference image.
[0091] In an exemplary embodiment of the present disclosure, the output feature information is calculated according to the following formula (1), which is as follows:
[0092]
[0093] Among them, P represents the output feature information, s represents the feature information of the input pixel value, μ(x) represents the feature mean information of the image to be processed, σ(x) represents the feature standard deviation information of the image to be processed, μ(y) represents the feature mean information of the reference image, and σ(y) represents the feature standard deviation information of the reference image.
[0094] In step S720, feature mapping is performed on the output feature information to obtain output pixel values corresponding to the output feature information.
[0095] In an exemplary embodiment of the present disclosure, the output feature information is input into a feature mapping model to obtain an output pixel value corresponding to the output feature information. The feature mapping model may be a convolutional neural network, which may downsample the output feature information of multiple channels, map the output feature information of multiple channels to RGB channels, and obtain output pixel values of the RGB channels.
[0096] In step S730, a target mapping relationship is generated according to the input pixel value and the output pixel value.
[0097] In an exemplary embodiment of the present disclosure, a target mapping relationship is created for an input pixel value and an output pixel value corresponding to the input pixel value. The target mapping relationship may be in the form of an index, with the input pixel value as the index number and the output pixel value corresponding to the input pixel value as the index value corresponding to the index number.
[0098] In addition, after obtaining the feature information corresponding to the initial LUT table, according to the above formula (1), the output feature information corresponding to the initial LUT table is obtained, and the output feature information is feature mapped by the feature mapping model to obtain the output pixel value corresponding to the initial LUT table. The initial output pixel value in the initial LUT table is replaced according to the output pixel value to obtain the target LUT table.
[0099] In step S330, the image to be processed is subjected to color adjustment according to the target mapping relationship.
[0100] In an exemplary embodiment of the present disclosure, the pixel value of each pixel in the image to be processed is obtained, the pixel value of each pixel is matched with the input pixel value in the target mapping relationship, the output pixel value corresponding to the input pixel value matching the pixel value of each pixel is obtained, and the output pixel value is used to replace the corresponding pixel value of each pixel to obtain the target image after color adjustment processing.
[0101] Among them, if there is no input pixel value corresponding to the pixel value of the pixel point in the image to be processed in the target mapping relationship, two or more input pixel values closest to the pixel value of the pixel point in the image to be processed are obtained, and the two or more input pixel values are interpolated to obtain the output pixel value corresponding to the pixel point.
[0102] Figure 8 A schematic diagram of a process of an image color adjustment method according to this specific embodiment is shown. Figure 8 As shown, the process at least includes steps S810 to S890, which are described in detail as follows:
[0103] In step S810, an image to be processed is acquired, and scaling is performed on the image to be processed to obtain a processed image to be processed.
[0104] The resolution of the image to be processed is 1080*1920, and the image resolution of the image to be processed is scaled to obtain an image with a resolution of 640*360.
[0105] In step S820, feature extraction is performed on the processed image to be processed by a feature extraction model to obtain feature information of the image to be processed, and feature mean information and feature standard deviation information corresponding to the feature information of the image to be processed are obtained.
[0106] In step S830, feature extraction is performed on the reference image using a feature extraction model to obtain feature information of the reference image, and feature mean information and feature standard deviation information corresponding to the feature information of the reference image are obtained.
[0107] In step S840, the feature mean information and feature standard deviation information of the image to be processed, and the feature mean information and feature standard deviation information of the reference image are stored in the ADAIN model.
[0108] The ADAIN model is constructed according to formula (1) in the above embodiment. The input of the ADAIN model is the feature information of the input pixel value, and the output of the ADAIN model is the output feature information.
[0109] In step S850, an initial LUT table is obtained, and input pixel values in the initial LUT table are matrix-transformed to obtain image information corresponding to the initial LUT table, and feature information corresponding to the image information in the initial LUT table is obtained through a feature extraction model.
[0110] The initial LUT table includes input pixel values and initial output pixel values, and the input pixel values are RGB pixel values of a preset number of 33*33*33.
[0111] In step S860, the feature information corresponding to the initial LUT table is input into the ADAIN model, and the output feature information corresponding to the initial LUT table is obtained through the ADAIN model according to formula (1).
[0112] In step S870, the output feature information corresponding to the initial LUT table is input into the feature mapping model to obtain the output pixel value corresponding to the output feature information, and the initial output pixel value in the initial LUT table is replaced according to the output pixel value to obtain the target LUT table.
[0113] In step S880, the pixel value of each pixel in the image to be processed is obtained, and the pixel value of each pixel is used as the input pixel value to index in the target LUT table to obtain the output pixel value corresponding to each pixel.
[0114] In step S890, a target image after color adjustment is generated according to the output pixel value corresponding to each pixel point.
[0115] In a specific embodiment of the present disclosure, the resolution of the image to be processed is scaled from 1080*1920 to an image with a resolution of 640*360, and the amount of calculation is reduced from 1080*1920=2073600 to 640*360+33*33*33=266337, which is reduced by an order of magnitude. Moreover, it is verified by experiments that reducing an image of any resolution to 360P will not cause obvious progress loss. Therefore, the larger the resolution of the image to be processed, the greater the acceleration ratio will be.
[0116] The image color adjustment method of this embodiment generates a target mapping relationship through the statistical features of the image to be processed and the reference image, and then performs color adjustment on the image to be processed according to the target mapping relationship. On the one hand, the present disclosure can dynamically generate a target mapping relationship according to the difference between the image to be processed and the reference image, and the generated target mapping relationship is targeted to the image to be processed and the reference image, so that the accuracy of color adjustment is higher; on the other hand, the resolution of the image to be processed is reduced through scaling processing, and the target mapping relationship is generated based on the statistical information of the processed image to be processed, which greatly reduces the amount of calculation and reduces the system consumption of generating the target mapping relationship.
[0117] Those skilled in the art will appreciate that all or part of the steps for implementing the above embodiments are implemented as a computer program executed by a CPU. When the computer program is executed by the CPU, the above functions defined by the above method provided by the present invention are performed. The program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk.
[0118] In addition, it should be noted that the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0119] The following describes an apparatus embodiment of the present disclosure, which can be used to execute the above-mentioned image color adjustment method of the present disclosure. For details not disclosed in the apparatus embodiment of the present disclosure, please refer to the above-mentioned embodiment of the image color adjustment method of the present disclosure.
[0120] Fig. 9 The block diagram schematically shows an image color adjustment device according to an embodiment of the present disclosure.
[0121] Reference Fig. 9 As shown, according to an embodiment of the present disclosure, an image color adjustment device 900 includes: a feature acquisition module 901, a mapping generation module 902, and a color adjustment processing module 903. Specifically:
[0122] The feature acquisition module 901 is used to acquire the statistical features of the image to be processed and the statistical features of the reference image;
[0123] A mapping generation module 902 is used to generate a target mapping relationship corresponding to the image to be processed according to the statistical characteristics of the image to be processed and the statistical characteristics of the reference image;
[0124] The color adjustment processing module 903 is used to perform color adjustment processing on the image to be processed according to the target mapping relationship.
[0125] In an exemplary embodiment of the present disclosure, the mapping generation module 902 can also be used to obtain input pixel values and perform feature extraction on the input pixel values to obtain feature information corresponding to the input pixel values; and generate a target mapping relationship corresponding to the image to be processed based on the feature information of the input pixel values, the statistical features of the image to be processed, and the statistical features of the reference image.
[0126] In an exemplary embodiment of the present disclosure, the mapping generation module 902 can also be used to obtain output feature information corresponding to the feature information of the input pixel value based on the feature information of the input pixel value, the statistical features of the image to be processed, and the statistical features of the reference image; perform feature mapping on the output feature information to obtain the output pixel value corresponding to the output feature information; and generate a target mapping relationship based on the input pixel value and the output pixel value.
[0127] In an exemplary embodiment of the present disclosure, the mapping generation module 902 may also be used to calculate the output feature information according to the following formula (1), which is as follows:
[0128]
[0129] Wherein, P represents the output feature information, s represents the feature information of the input pixel value, μ(x) represents the feature mean information of the image to be processed, σ(x) represents the feature standard deviation information of the image to be processed, μ(y) represents the feature mean information of the reference image, and σ(y) represents the feature standard deviation information of the reference image. The statistical features include feature mean information and feature standard deviation information.
[0130] In an exemplary embodiment of the present disclosure, the mapping generation module 902 can also be used to traverse the image to be processed, obtain pixel values corresponding to the image to be processed, and configure the pixel values of the image to be processed as input pixel values; perform matrix transformation on the input pixel values to obtain image information corresponding to the input pixel values; and input the image information into a feature extraction model to obtain feature information corresponding to the image information.
[0131] In an exemplary embodiment of the present disclosure, the feature acquisition module 901 can also be used to input the image to be processed into a feature extraction model to obtain feature information corresponding to the image to be processed; and calculate the feature mean information and feature standard deviation information of the image to be processed based on the feature information of the image to be processed.
[0132] In an exemplary embodiment of the present disclosure, the image color adjustment device 900 may further include a scaling processing module (not shown in the figure), which is used to perform scaling processing on the image to be processed to obtain a processed image to be processed, wherein the resolution of the processed image to be processed is smaller than the resolution of the image to be processed.
[0133] The specific details of each module in the above-mentioned image color adjustment device have been described in detail in the implementation of the image color adjustment method. The undisclosed details can be found in the implementation of the image color adjustment method, and thus will not be repeated here.
[0134] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".
[0135] The exemplary embodiments of the present disclosure also provide a computer-readable storage medium on which a program product capable of implementing the above-mentioned method of the present specification is stored. In some possible implementations, various aspects of the present disclosure can also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of the present specification, for example, it can execute Figures 3 to 8 Any one or more steps in .
[0136] The exemplary embodiments of the present disclosure also provide a program product for implementing the above method, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0137] The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: an electrical connection with one or more conductors, a portable 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 thereof.
[0138] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0139] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0140] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0141] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and embodiments are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
Claims
1. An image color adjustment method, characterized in that: include: Obtaining statistical features of the image to be processed and obtaining statistical features of the reference image; Generating a target mapping relationship corresponding to the image to be processed according to the statistical features of the image to be processed and the statistical features of the reference image; Replacing the pixel value of each pixel of the image to be processed according to the target mapping relationship to achieve color adjustment processing of the image to be processed; Wherein, generating a target mapping relationship corresponding to the image to be processed according to the statistical features of the image to be processed and the statistical features of the reference image includes: Acquire an input pixel value, and perform feature extraction on the input pixel value to obtain feature information corresponding to the input pixel value; A target mapping relationship corresponding to the image to be processed is generated according to feature information of the input pixel value, statistical features of the image to be processed and statistical features of the reference image; the target mapping relationship is in the form of an index number with the input pixel value as the index number and an output pixel value corresponding to the input pixel value as the index value.
2. The image color adjustment method according to claim 1, characterized in that: Generating a target mapping relationship corresponding to the image to be processed according to the feature information of the input pixel value, the statistical features of the image to be processed and the statistical features of the reference image, including: Acquire output feature information corresponding to the feature information of the input pixel value according to the feature information of the input pixel value, the statistical features of the image to be processed, and the statistical features of the reference image; Performing feature mapping on the output feature information to obtain an output pixel value corresponding to the output feature information; The target mapping relationship is generated according to the input pixel value and the output pixel value.
3. The image color adjustment method according to claim 2, characterized in that: The statistical features include feature mean information and feature standard deviation information; Acquiring output feature information corresponding to the feature information of the input pixel value according to the feature information of the input pixel value, the statistical features of the image to be processed, and the statistical features of the reference image, including: The output feature information is calculated according to the following formula (1), which is as follows: Among them, P represents the output feature information, s represents the feature information of the input pixel value, μ(x) represents the feature mean information of the image to be processed, σ(x) represents the feature standard deviation information of the image to be processed, μ(y) represents the feature mean information of the reference image, and σ(y) represents the feature standard deviation information of the reference image.
4. The image color adjustment method according to claim 1, characterized in that: Before obtaining the statistical features of the image to be processed, the method further includes: The image to be processed is scaled to obtain a processed image to be processed, wherein the resolution of the processed image to be processed is smaller than the resolution of the image to be processed.
5. The image color adjustment method according to claim 4, characterized in that: Acquiring an input pixel value and performing feature extraction on the input pixel value to obtain feature information corresponding to the input pixel value, including: Traversing the image to be processed, obtaining pixel values corresponding to the image to be processed, and configuring the pixel values of the image to be processed as the input pixel values; Performing matrix transformation on the input pixel value to obtain image information corresponding to the input pixel value; The image information is input into a feature extraction model to obtain feature information corresponding to the image information.
6. The image color adjustment method according to claim 5, characterized in that: Obtain the statistical features of the image to be processed, including: Inputting the image to be processed into the feature extraction model to obtain feature information corresponding to the image to be processed; The feature mean information and the feature standard deviation information of the image to be processed are calculated according to the feature information of the image to be processed.
7. An image color adjustment device, characterized in that: include: A feature acquisition module, used to acquire statistical features of the image to be processed and to acquire statistical features of the reference image; A mapping generation module, used to generate a target mapping relationship corresponding to the image to be processed according to the statistical characteristics of the image to be processed and the statistical characteristics of the reference image; A color adjustment processing module, used for replacing the pixel value of each pixel of the image to be processed according to the target mapping relationship, so as to achieve color adjustment processing of the image to be processed; Wherein, the mapping generation module is configured to execute: Acquire an input pixel value, and perform feature extraction on the input pixel value to obtain feature information corresponding to the input pixel value; A target mapping relationship corresponding to the image to be processed is generated according to feature information of the input pixel value, statistical features of the image to be processed and statistical features of the reference image; the target mapping relationship is in the form of an index number with the input pixel value as the index number and an output pixel value corresponding to the input pixel value as the index value.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the image color adjustment method according to any one of claims 1 to 6 is implemented.
9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the image color adjustment method according to any one of claims 1 to 6.
