Image color correction method, device, computer equipment and storage medium
By converting the image into grayscale RGB and single-channel mode during image processing, performing color scale adjustment and index color filling, the problem of image color deviation under colored light sources is solved, and effective color restoration and visual effect improvement are achieved.
Patent Information
- Application Number
- CN202410138042.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-01
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-02-01
AI Technical Summary
In the existing technology, in images or video frames shot under colored light sources, colors are prone to serious deviations, resulting in color distortion and affecting visual effects. Moreover, the existing image color correction effect is poor and the original color cannot be effectively restored.
Simulate and Restore the original colors of the image.
It effectively eliminates the color deviation caused by colored light sources, restores the original color of the image, and improves the visual effect and user experience of the image.
Smart Images

Figure CN117939096B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an image color correction method, device, computer equipment and storage medium. Background Art
[0002] In certain life scenarios, when users take photos or record live videos under colored light sources, the colors of the photos taken or the video frames acquired by the camera may be seriously deviated due to lighting reasons. For example, in some entertainment venues, the colors of people or objects in the photos or video frames may be distorted, seriously affecting the visual effect.
[0003] In the related art, the color of the image is corrected so that the processed image color is more consistent with the perception of the human eye and the color of the real scene. The existing image color correction effect is poor, and color correction cannot restore the original color of the image. Summary of the invention
[0004] In view of this, the present invention provides an image color correction method, apparatus, computer equipment and storage medium to solve the problem of poor image color correction effect in the prior art.
[0005] In a first aspect, the present invention provides an image color correction method, the method comprising:
[0006] Acquire a target image, convert the color space of the target image into a grayscale RGB color space, and obtain a first image;
[0007] In the grayscale RGB color space, performing channel image mode conversion on the first image and adjusting the channel color scale to generate a second image;
[0008] Convert the color space of the second image to a color RGB color space, and convert the second image to a single-channel image mode to obtain a third image;
[0009] The single-channel image mode of the third image is converted into an indexed color mode to generate a fourth image, and color correction is performed on the fourth image to obtain a corrected target image.
[0010] In the present invention, by adjusting the channel color scale, enhancing the contrast of each channel, finding dark and light colors, enhancing brightness and contrast, and converting the color RGB color space for single-channel image mode, and performing index color mode in the single-channel image mode to simulate color indexing to complete bitmap image filling, the effect of color correction on the image is improved, which is conducive to restoring the original color of the image, eliminating the problems of serious color deviation of the image or video frame caused by colored light sources, and color distortion of people or objects in the image, and being able to restore the original color of the image under the colored light source, thereby improving the visual effect of the image and improving the user experience.
[0011] In an optional implementation, adjusting the channel color scale of the first image includes:
[0012] Obtaining a color scale adjustment component value of the first image;
[0013] The high threshold and the low threshold of the color scale adjustment component value are counted, the average of the color scale adjustment component value is calculated, and the channel color scale is adjusted based on the average of the color scale adjustment component value.
[0014] In this method, the color level adjustment component values of each channel are counted, and the channel color level is adjusted based on the mean of the color level adjustment component values to facilitate later adjustments, prevent large deviations in color images during conversion, enhance the contrast of each channel, find dark and light colors, and enhance brightness and contrast.
[0015] In an optional implementation, the color scale adjustment component value includes the maximum and minimum values of the shadow, midtone, and highlight, and the high threshold and the low threshold of the color scale adjustment component value are counted, including:
[0016] Obtain the pixel value of each pixel of the first image in 16-bit channel image mode;
[0017] Based on the pixel values, counting the maximum and minimum values of shadows, midtones, and highlights of the first image in 16-bit channel image mode;
[0018] According to the maximum and minimum values of shadows, midtones and highlights, high thresholds and low thresholds of shadows, midtones and highlights are calculated respectively.
[0019] In this method, the target image is converted to 16-bit channel mode, with 65536 color levels for each channel, to obtain more color details, so as to facilitate the adjustment of multi-channel color levels component values. The color levels of the channels of the target image are adjusted in 16-bit channel mode to enhance the contrast of each channel, find dark and light colors, and enhance brightness and contrast.
[0020] In an optional implementation, converting the second image into a single-channel image mode includes:
[0021] Acquire a data file of the second image, wherein a pixel buffer of the data file includes transparency data of a transparency channel of each pixel point in the second image and color data of a plurality of color channels;
[0022] The transparency data and color data of each pixel are deleted, and the pixels of each pixel are reduced to the width of a single channel.
[0023] In this way, by limiting the target image file size through the single-channel image mode, the size of the image file can be reduced, which is convenient for subsequent color correction while maintaining visual quality and avoiding excessively obvious color differences in pixels after conversion.
[0024] In an optional implementation, converting the single-channel image mode of the third image into an indexed color mode to generate a fourth image, and performing color correction on the fourth image to obtain a corrected target image includes:
[0025] encoding the third image to obtain a fourth image;
[0026] Get the color summary, which is used to store and index the colors in the image;
[0027] Based on the color summary, the fourth image is indexed and filled to obtain a corrected target image.
[0028] In this way, the image is filled by simulating the color index through the index color mode, which improves the effect of color correction on the image and is conducive to restoring the original color of the image.
[0029] In an optional implementation, index filling is performed on the fourth image based on the color summary, including:
[0030] determining whether a color in the fourth image appears in the color summary;
[0031] When the color in the fourth image does not appear in the color summary, a color most similar to the color in the fourth image is selected for pixel restoration.
[0032] In this way, when a color in an image does not appear in the color summary, the closest existing color will be selected, or the existing color will be used to simulate the color correction to restore the original color of the image, improve the visual effect of the image, and enhance the user experience.
[0033] In an optional implementation, selecting a color most similar to a color in the fourth image for pixel restoration further includes:
[0034] A color most similar to a color in the fourth image is determined based on the high threshold and the low threshold for shadows, midtones, and highlights of the fourth image.
[0035] In this method, high and low thresholds of shadows, midtones, and highlights are determined through a single contrast, achieving a high degree of restoration, which is beneficial for restoring the original colors of the image.
[0036] In a second aspect, the present invention provides an image color correction device, the device comprising:
[0037] An image acquisition module is used to acquire a target image, convert the color space of the target image into a grayscale RGB color space, and obtain a first image;
[0038] A first image conversion module is used to perform channel image mode conversion on the first image and adjust the channel color scale in the grayscale RGB color space to generate a second image;
[0039] A second image conversion module is used to convert the color space of the second image into a color RGB color space, and convert the second image into a single-channel image mode to obtain a third image;
[0040] The image color correction module is used to convert the single-channel image mode of the third image into an indexed color mode to generate a fourth image, and perform color correction on the fourth image to obtain a corrected target image.
[0041] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the image color correction method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0042] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the image color correction method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 4 is a flow chart of an image color correction method according to an embodiment of the present invention.
[0045] Figure 2 FIG. 4 is a flow chart of another image color correction method according to an embodiment of the present invention.
[0046] Figure 3 is a flowchart of another image color correction method according to an embodiment of the present invention.
[0047] Figure 4 is a structural block diagram of an image color correction device according to an embodiment of the present invention.
[0048] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0050] In the related art, the color of the image is corrected so that the processed image color is more consistent with the perception of the human eye and the color of the real scene. The existing image color correction effect is poor, and color correction cannot restore the original color of the image.
[0051] In order to solve the above problems, an image color correction method is provided in an embodiment of the present invention, which is used in a computer device. It should be noted that its execution subject can be an image color correction device, which can be implemented as part or all of the computer device through software, hardware, or a combination of software and hardware. The computer device can be a terminal, a client, or a server. The server can be a single server or a server cluster composed of multiple servers. The terminal in the embodiment of the present application can be a smart phone, a personal computer, a tablet computer, or other intelligent hardware devices. In the following method embodiments, the execution subject is a computer device as an example for explanation.
[0052] The computer device in this embodiment is suitable for use in scenarios where the color of a photograph or a video frame image captured by a camera is deviated, and the color of a person or object in the photograph or video frame image is distorted. The present invention provides an image color correction method, which adjusts the channel color scale, enhances the contrast of each channel, searches for dark and light colors, enhances brightness and contrast, and converts the color RGB color space for a single-channel image mode, and performs an index color mode in the single-channel image mode to simulate a color index to complete bitmap image filling, thereby improving the effect of color correction on the image, facilitating the restoration of the original color of the image, eliminating the problem of severe color deviation of the image or video frame caused by a colored light source, and the color distortion of a person or object in the image, and being able to restore the original color of the image under a colored light source, thereby improving the visual effect of the image and the user experience.
[0053] According to an embodiment of the present invention, an embodiment of an image color correction method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0054] In this embodiment, a method for image color correction is provided, which can be used in the above-mentioned computer device. Figure 1 is a flow chart of an image color correction method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0055] Step S101, obtaining a target image, converting the color space of the target image into a grayscale RGB color space, and obtaining a first image.
[0056] In one example, the target image may be a photo or a video frame image, and the color space of the target image is converted into a grayscale RGB color space to obtain the first image.
[0057] Step S102: in the grayscale RGB color space, performing channel image mode conversion on the first image and adjusting the channel color scale to generate a second image.
[0058] In one example, the first image is converted to a 16-bit channel mode in a grayscale RGB color space, and the color levels of the channel are adjusted to generate a second image.
[0059] Step S103, converting the color space of the second image into a color RGB color space, and converting the second image into a single-channel image mode to obtain a third image.
[0060] In one example, the grayscale RGB color space of the second image is adjusted to a color RGB color space, and the 16-bit channel mode is converted to a single-channel image mode to obtain a third image.
[0061] Step S104, converting the single-channel image mode of the third image into an indexed color mode to generate a fourth image, and performing color correction on the fourth image to obtain a corrected target image.
[0062] In one example, the third image is converted into an indexed color mode in a single-channel image mode, the indexed image is generated and then color corrected, and a color-corrected target image is output.
[0063] The image color correction method provided in the present embodiment adjusts the channel color scale, enhances the contrast of each channel, searches for dark and light colors, enhances brightness and contrast, and converts the color RGB color space for single-channel image mode, and performs index color mode in the single-channel image mode to simulate color indexing to complete bitmap image filling, thereby improving the effect of color correction on the image, facilitating restoration of the original color of the image, eliminating the problem of severe color deviation of the image or video frame caused by colored light sources, and color distortion of people or objects in the image, being able to restore the original color of the image under the colored light source, improving the visual effect of the image, and improving the user experience.
[0064] In this embodiment, a method for image color correction is provided, which can be used in the above-mentioned computer device. Figure 2 is a flow chart of another image color correction method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0065] Step S201, obtain a target image, convert the color space of the target image into a grayscale RGB color space, and obtain a first image. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0066] Step S202: in the grayscale RGB color space, performing channel image mode conversion on the first image and adjusting the channel color scale to generate a second image.
[0067] Specifically, the above step S202 includes:
[0068] Step S2021, obtaining the color scale adjustment component value of the first image.
[0069] Step S2022, statistics are collected on the high threshold and the low threshold of the color scale adjustment component value, the average of the color scale adjustment component value is calculated, and the channel color scale is adjusted based on the average of the color scale adjustment component value.
[0070] In some optional implementations, the above step S2022 includes:
[0071] Step a1, obtaining the pixel value of each pixel of the first image in 16-bit channel image mode.
[0072] Step a2: based on the pixel values, counting the maximum and minimum values of the shadows, midtones and highlights of the first image in the 16-bit channel image mode.
[0073] Step a3, according to the maximum and minimum values of the shadows, midtones and bright spots, high thresholds and low thresholds of the shadows, midtones and bright spots are calculated respectively.
[0074] In one example, the color scale indicates the index standard of the brightness of the image, that is, the color index. In the digital image processing tutorial, it refers to the grayscale resolution (also known as grayscale resolution or amplitude resolution). The color richness and fineness of the image are determined by the color scale. The color scale refers to the brightness and has nothing to do with the color, that is, just adjust the brightness value.
[0075] By converting the target image to 16-bit channel mode, the number of color levels of each channel is 65536, so as to obtain more color details, so as to facilitate the color level adjustment component values of multiple channels. The color level adjustment component values include shadows, midtones and highlights. The adjustment process of shadows, midtones and highlights is to calculate the average value of shadows, the average value of midtones and the average value of highlights as the adjustment amount according to the high threshold and low threshold of shadows, the high threshold and low threshold of midtones and the high threshold and low threshold of highlights.
[0076] The statistical process of the high and low thresholds of shadows, the high and low thresholds of midtones, and the high threshold of highlights includes:
[0077] (1) Count the maximum and minimum values of the shadow, the maximum and minimum values of the midtone, and the maximum and minimum values of the highlight of the target image in the 16-bit channel mode; specifically, by obtaining the pixel value of the target image in the 16-bit channel mode, the range value and the threshold critical value can be obtained.
[0078] (2) According to the maximum and minimum values of the shadow, the maximum and minimum values of the midtone, and the maximum and minimum values of the bright spot, the high threshold and low threshold of the shadow, the high threshold and low threshold of the midtone, and the high threshold and low threshold of the bright spot are calculated respectively.
[0079] In this method, by converting the target image to 16-bit channel mode, the number of color levels of each channel is 65536, so as to obtain more color details, so as to facilitate the color level adjustment component value of multiple channels. By adjusting the color levels of the channels of the target image in 16-bit channel mode, the contrast of each channel can be enhanced, dark and light colors can be found, and the brightness and contrast can be enhanced. By taking statistics on the color level adjustment component values of each channel, the channel color levels are adjusted based on the mean of the color level adjustment component values, which is convenient for later adjustment, prevents large deviations in color images during conversion, enhances the contrast of each channel, finds dark and light colors, and enhances brightness and contrast.
[0080] Step S203, converting the color space of the second image into a color RGB color space, and converting the second image into a single-channel image mode to obtain a third image.
[0081] Specifically, the above step S203 includes:
[0082] Step S2031, obtaining a data file of the second image, wherein the pixel buffer of the data file includes transparency data of a transparency channel of each pixel point in the second image and color data of a plurality of color channels.
[0083] Step S2032, the transparency data and color data of each pixel are deleted, and the pixels of each pixel are reduced to a single channel width.
[0084] In one example, the single-channel image mode is an 8-bit / pixel channel image, and the target image file size is limited by the 8-bit / pixel channel image to avoid excessive color difference of pixels after conversion. Specifically, the data file of the image to be compressed is obtained, and the pixel buffer of the data file includes transparency data of the transparency channel of each pixel and color data of several color channels; the transparency data of each pixel and the color data of several color channels are deleted, and the pixels are reduced to the width of a single channel, so as to realize the conversion of the 16-bit channel mode to the single-channel image mode.
[0085] In this way, by limiting the target image file size through the single-channel image mode, the size of the image file can be reduced, which is convenient for subsequent color correction while maintaining visual quality and avoiding excessively obvious color differences in pixels after conversion.
[0086] Step S204: Convert the single-channel image mode of the third image to an indexed color mode to generate a fourth image, and perform color correction on the fourth image to obtain a corrected target image. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0087] The image color correction method provided in this embodiment counts the color scale adjustment component values of each channel, adjusts the channel color scale based on the mean of the color scale adjustment component values, facilitates later adjustments, prevents large deviations in color images during conversion, enhances the contrast of each channel, finds dark and light colors, and enhances brightness and contrast. By converting the target image to a 16-bit channel mode, the number of color scales for each channel is 65,536, so as to obtain more color details, so as to facilitate the color scale adjustment component values of multiple channels, and by adjusting the color scale of the channel of the target image in a 16-bit channel mode, the contrast of each channel can be enhanced, dark and light colors can be found, and brightness and contrast can be enhanced. By limiting the size of the target image file in a single-channel image mode, the size of the image file can be reduced, which is convenient for subsequent color correction while maintaining visual quality, and avoiding excessively obvious color differences in pixels after conversion.
[0088] In this embodiment, a method for image color correction is provided, which can be used in the above-mentioned computer device. Figure 3 is a flowchart of another image color correction method according to an embodiment of the present invention. Figure 3As shown, the process includes the following steps:
[0089] Step S301, obtain a target image, convert the color space of the target image into a grayscale RGB color space, and obtain a first image. Figure 2 Step S201 of the illustrated embodiment will not be described in detail here.
[0090] Step S302: In the grayscale RGB color space, the first image is converted into a channel image mode and the channel color scale is adjusted to generate a second image. Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.
[0091] Step S303, convert the color space of the second image into a color RGB color space, and convert the second image into a single-channel image mode to obtain a third image. Figure 2 Step S203 of the illustrated embodiment will not be described in detail here.
[0092] Step S304: convert the single-channel image mode of the third image into an indexed color mode to generate a fourth image, and perform color correction on the fourth image to obtain a corrected target image.
[0093] Specifically, the above step S304 includes:
[0094] Step S3041, encode the third image to obtain a fourth image.
[0095] Step S3042, obtaining a color summary, where the color summary is used to store and index the colors in the image.
[0096] In some optional implementations, the above step S3042 includes:
[0097] Step b1, determining whether the color in the fourth image appears in the color summary;
[0098] Step b2: When the color in the fourth image does not appear in the color summary, select the color most similar to the color in the fourth image for pixel restoration.
[0099] Step b3, determining the color most similar to the color in the fourth image based on the high threshold and the low threshold of the shadows, midtones and highlights of the fourth image.
[0100] In one example, the indexed color mode is a commonly used image mode on the Internet and in animations. When a color image is converted to an indexed color image, it contains nearly 256 colors. The indexed color image contains a color table. If the color in the original image cannot be expressed in 256 colors, the system will select the closest color from the available colors to simulate these colors. This can reduce the size of the image file and store the colors in the image and establish color indexes for these colors. The color table can be defined during the conversion process or modified after the indexed image is generated. Due to the limited color palette, the indexed color must reduce the file size. However, if it is only used for multimedia presentations, web pages or similar situations, the visual quality requirements can still be maintained. Only limited editing functions can be used in this mode. If a large amount of editing is required, it should be temporarily converted to RGB mode. The color correction process using the indexed color mode specifically includes:
[0101] (1) Complete the encoding of the target image bitmap picture. Among them, the image bit in the target image, also known as the dot map, is the most commonly used image representation method. The bitmap uses pixels to represent the image, and the phase filling of the optimal approximate color is completed through the image bit index.
[0102] (2) Complete the use of 256 color summarization to store and index the colors in the image. Color summarization is performed through color table insertion.
[0103] (3) Perform color index filling of the target image content. If the color in the original image does not appear, the program will select the closest existing color, or use the existing color to simulate the color to restore the pixel.
[0104] (4) Output the corrected bitmap image. The output target image is in RGB color space, and the values of the three components R, G, and B are the adjusted mean values when the color is defined by color correction.
[0105] The image color correction method provided in this embodiment simulates the color index to complete the image filling through the index color mode, thereby improving the effect of color correction on the image and facilitating the restoration of the original color of the image. When the color in the image does not appear in the color summary, the closest one of the existing colors will be selected, or the existing color will be used to simulate the color correction to restore the original color of the image, thereby improving the visual effect of the image and the user experience. Through a single contrast, the high threshold and low threshold of the shadow, midtone and highlight are determined to achieve a high degree of restoration, which is conducive to restoring the original color of the image.
[0106] In this embodiment, an image color correction device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0107] This embodiment provides an image color correction device, such as Figure 4 As shown, including:
[0108] The image acquisition module 401 is used to acquire a target image and convert the color space of the target image into a grayscale RGB color space to obtain a first image. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0109] The first image conversion module 402 is used to convert the channel image mode of the first image and adjust the channel color level in the grayscale RGB color space to generate a second image. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0110] The second image conversion module 403 is used to convert the color space of the second image into the color RGB color space, and convert the second image into a single-channel image mode to obtain a third image. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.
[0111] The image color correction module 404 is used to convert the single-channel image mode of the third image into an indexed color mode to generate a fourth image, and perform color correction on the fourth image to obtain a corrected target image. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0112] In some optional implementations, the first image conversion module 402 includes:
[0113] The color scale adjustment component acquisition unit is used to acquire the color scale adjustment component value of the first image.
[0114] The color scale adjustment component value statistical unit is used to count the high threshold and the low threshold of the color scale adjustment component value, calculate the average of the color scale adjustment component value, and adjust the channel color scale based on the average of the color scale adjustment component value.
[0115] In some optional implementations, the color scale adjustment component value statistics unit includes:
[0116] The pixel value acquisition subunit is used to acquire the pixel value of each pixel point of the first image in the 16-bit channel image mode.
[0117] The color scale adjustment component maximum value statistics subunit is used to count the maximum and minimum values of the shadows, midtones and highlights of the first image in the 16-bit channel image mode based on the pixel values.
[0118] The color scale adjustment component statistics subunit is used to calculate the high threshold value and the low threshold value of the shadow, the midtone and the bright spot according to the maximum value and the minimum value of the shadow, the midtone and the bright spot respectively.
[0119] In some optional implementations, the second image conversion module 403 includes:
[0120] The data file acquisition unit is used to acquire the data file of the second image, wherein the pixel buffer of the data file includes transparency data of the transparency channel of each pixel point in the second image and color data of several color channels.
[0121] The pixel compression unit is used to delete the transparency data and color data of each pixel point and reduce the pixels of each pixel point to a single channel width.
[0122] In some optional implementations, the image color correction module 404 includes:
[0123] The image encoding unit is used to encode the third image to obtain a fourth image.
[0124] The color summary acquisition unit is used to acquire the color summary, and the color summary is used to store and index the colors in the image.
[0125] The index filling unit is used to perform index filling on the fourth image based on color summary to obtain a corrected target image.
[0126] In some optional implementations, the index filling unit includes:
[0127] The color judgment subunit is used to judge whether the color in the fourth image appears in the color summary.
[0128] The pixel restoration subunit is used to select a color most similar to the color in the fourth image for pixel restoration when the color in the fourth image does not appear in the color summary.
[0129] In some optional implementations, the index filling unit includes:
[0130] The similar color determination subunit is used to determine the color most similar to the color in the fourth image based on the high threshold and the low threshold of the shadow, the midtone and the highlight of the fourth image.
[0131] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0132] The image color correction device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0133] The embodiment of the present invention also provides a computer device having the above Figure 4 The image color correction device shown.
[0134] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.
[0135] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0136] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0137] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0138] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0139] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0140] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0141] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for image color correction, characterized in that: The method comprises: Acquire a target image, and convert the color space of the target image into a grayscale RGB color space to obtain a first image; In the grayscale RGB color space, performing channel image mode conversion on the first image and adjusting the channel color scale to generate a second image includes: obtaining a color scale adjustment component value of the first image; performing statistics on a high threshold and a low threshold of the color scale adjustment component value, calculating a mean value of the color scale adjustment component value, and adjusting the channel color scale based on the mean value of the color scale adjustment component value; Converting the color space of the second image into a color RGB color space, and converting the second image into a single-channel image mode to obtain a third image, including: acquiring a data file of the second image, wherein a pixel buffer of the data file includes transparency data of a transparency channel of each pixel point in the second image and color data of a plurality of color channels; deleting the transparency data and the color data of each pixel point, and reducing the pixels of each pixel point to a single-channel width; Converting the single-channel image mode of the third image into an indexed color mode to generate a fourth image, performing color correction on the fourth image to obtain a corrected target image, including: encoding the third image to obtain the fourth image; obtaining a color summary, the color summary being used to store and index the colors in the image; and performing index filling on the fourth image based on the color summary to obtain a corrected target image.
2. The method according to claim 1, characterized in that The color scale adjustment component value includes the maximum and minimum values of shadows, midtones, and highlights, and the statistics of the high threshold and the low threshold of the color scale adjustment component value include: Obtaining the pixel value of each pixel of the first image in a 16-bit channel image mode; Based on the pixel values, counting maximum and minimum values of shadows, midtones, and highlights of the first image in a 16-bit channel image mode; According to the maximum and minimum values of the shadows, midtones and bright spots, high thresholds and low thresholds of the shadows, midtones and bright spots are calculated respectively.
3. The method according to claim 1, characterized in that The step of performing index filling on the fourth image based on the color summary includes: determining whether a color in the fourth image appears in the color summary; When the color in the fourth image does not appear in the color summary, a color most similar to the color in the fourth image is selected for pixel restoration.
4. The method according to claim 3, characterized in that The selecting a color most similar to the color in the fourth image to perform pixel restoration also includes: A color most similar to a color in the fourth image is determined based on high and low thresholds for shadows, midtones, and highlights of the fourth image.
5. An image color correction device, characterized in that: The device comprises: An image acquisition module is used to acquire a target image, convert the color space of the target image into a grayscale RGB color space, and obtain a first image; The first image conversion module is used to perform channel image mode conversion on the first image and adjust the channel color scale in the grayscale RGB color space to generate a second image, including: obtaining a color scale adjustment component value of the first image; performing statistics on a high threshold and a low threshold of the color scale adjustment component value, calculating a mean value of the color scale adjustment component value, and adjusting the channel color scale based on the mean value of the color scale adjustment component value; The second image conversion module is used to convert the color space of the second image into a color RGB color space, and convert the second image into a single-channel image mode to obtain a third image, including: obtaining a data file of the second image, wherein a pixel buffer of the data file includes transparency data of a transparency channel of each pixel point in the second image and color data of a plurality of color channels; deleting the transparency data and the color data of each pixel point, and reducing the pixels of each pixel point to a single-channel width; The image color correction module is used to convert the single-channel image mode of the third image into an indexed color mode to generate a fourth image, perform color correction on the fourth image, and obtain a corrected target image, including: encoding the third image to obtain the fourth image; obtaining a color summary, the color summary is used to store and index the colors in the image; based on the color summary, index filling the fourth image to obtain the corrected target image.
6. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the image color correction method according to any one of claims 1 to 4 by executing the computer instructions.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the image color correction method according to any one of claims 1 to 4.
