[go: up one dir, main page]

CN113489860A - Image color correction method and device, electronic equipment and machine readable medium - Google Patents

Image color correction method and device, electronic equipment and machine readable medium Download PDF

Info

Publication number
CN113489860A
CN113489860A CN202111032781.9A CN202111032781A CN113489860A CN 113489860 A CN113489860 A CN 113489860A CN 202111032781 A CN202111032781 A CN 202111032781A CN 113489860 A CN113489860 A CN 113489860A
Authority
CN
China
Prior art keywords
data
binary
color
color correction
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111032781.9A
Other languages
Chinese (zh)
Other versions
CN113489860B (en
Inventor
刘路伟
闫亚军
刘东旭
刘铁华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Meishe Network Technology Co ltd
Original Assignee
Beijing Meishe Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Meishe Network Technology Co ltd filed Critical Beijing Meishe Network Technology Co ltd
Priority to CN202111032781.9A priority Critical patent/CN113489860B/en
Publication of CN113489860A publication Critical patent/CN113489860A/en
Application granted granted Critical
Publication of CN113489860B publication Critical patent/CN113489860B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/46Colour picture communication systems
    • H04N1/56Processing of colour picture signals
    • H04N1/60Colour correction or control
    • H04N1/6075Corrections to the hue

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Color Image Communication Systems (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the application provides an image color correction method, an image color correction device, electronic equipment and a machine readable medium. Belongs to the technical field of image processing. The method comprises the following steps: acquiring an image to be color-corrected and corresponding color correction demand information; reading a binary file meeting the color correction demand information from a disk according to the color correction demand information, wherein the binary file comprises binary data; the binary data is obtained by converting LUT data in an LUT file; converting the binary file into a target color lookup table and storing the target color lookup table in a memory, wherein the target color lookup table comprises decimal data, and the decimal data is obtained by converting the binary data; and in the memory, performing color correction processing on the image to be subjected to color correction by using the target color lookup table to obtain the image subjected to color correction. By using the image color correction method provided by the application, the running speed of the color correction file can be higher.

Description

Image color correction method and device, electronic equipment and machine readable medium
Technical Field
The embodiment of the application relates to the technical field of image processing, in particular to an image color correction method, an image color correction device, electronic equipment and a machine readable medium.
Background
The color correction is an important link during video shooting and editing, and through adjusting multiple aspects such as brightness, contrast, color and the like, the image quality defects caused by insufficient environment, equipment, experience and the like can be made up, and the overall picture quality and picture impression of the video are improved.
In the current color correction process, a user usually uses an LUT tool to correct a color of a picture, and the LUT tool can convert one color effect into another color effect on the picture.
However, the LUT tool is very large in space occupation, so that the processes of turning on the LUT tool and operating the LUT tool are slow when the user performs color correction by using the LUT tool.
Disclosure of Invention
The embodiment of the application provides an image color correction method, an image color correction device, electronic equipment and a machine readable medium, and aims to solve the problem of low running speed caused by using an LUT tool.
A first aspect of an embodiment of the present application provides an image color correction method, where the method includes:
acquiring an image to be color-corrected and corresponding color correction demand information;
reading a binary file meeting the color correction demand information from a disk according to the color correction demand information, wherein the binary file comprises binary data; the binary data is obtained by converting LUT data in an LUT file;
converting the binary file into a target color lookup table and storing the target color lookup table in a memory, wherein the target color lookup table comprises decimal data, and the decimal data is obtained by converting the binary data;
and in the memory, performing color correction processing on the image to be subjected to color correction by using the target color lookup table to obtain the image subjected to color correction.
Optionally, before reading the binary file satisfying the color correction requirement information from the disk, the method further includes:
searching a data head of each target color lookup table in the memory according to the color correction requirement information, and determining whether the target color lookup table meeting the color correction requirement information exists;
under the condition that a target color lookup table which meets the color correction requirement information does not exist in the memory, executing the following steps: and reading the binary file meeting the color correction requirement information from a disk according to the color correction requirement information.
Optionally, the binary file is generated by:
acquiring an LUT file to be processed;
converting the LUT data in the LUT file into the binary data and generating a data header for the binary data;
and adding the data head on the binary data to obtain the binary file.
Optionally, the data header comprises a data format;
converting the LUT data in the LUT file into the binary data and generating a header for the binary data, comprising: converting the LUT data into binary data in a data format that is a designated data format, the designated data format comprising any one of: the uint8 unsigned integer data, the uint16 unsigned integer data, the float16 half precision floating point data is float32 single precision floating point data;
adding the data header to the binary data to obtain the binary file, including: and adding a first identifier representing the specified data format to binary data to obtain the binary file, wherein different specified data formats correspond to different first identifiers.
Optionally, the data header comprises a single dimension size;
converting the LUT data in the LUT file into the binary data and generating a header for the binary data, comprising: converting the LUT data into binary data of a single dimension, the specified dimension comprising any of: 13. 15, 17;
and adding a second identifier representing the designated size to the binary data to obtain the binary file, wherein different single-dimensional sizes correspond to different second identifiers.
Optionally, the data header includes a data offset;
converting the LUT data in the LUT file into the binary data and generating a header for the binary data, comprising: converting the LUT data into binary data whose data offset is a specified offset;
adding a third identifier characterizing a designated offset to the binary data, wherein different designated offsets correspond to different third identifiers.
Optionally, in the memory, performing color correction processing on the image to be color-corrected by using the target color lookup table to obtain a color-corrected image, including:
reading an index table and an interpolation table in the memory;
taking the color correction demand information as an index value, and finding target data and a target interpolation coefficient corresponding to the index value in the index table;
obtaining the target interpolation coefficient from the interpolation table, and obtaining the target data from the target color lookup table;
obtaining a target interpolation value according to the target interpolation coefficient and the index value;
and inputting the target interpolation and the target data into the image to be color-corrected to obtain the image after color correction.
A second aspect of the embodiments of the present application provides an image color correction apparatus, including:
the acquisition module is used for acquiring the image to be color-corrected and corresponding color correction demand information;
the reading module is used for reading a binary file meeting the color correction demand information from a magnetic disk according to the color correction demand information, and the binary file comprises binary data; the binary data is obtained by converting LUT data in an LUT file;
the storage module is used for converting the binary file into a target color lookup table and storing the target color lookup table in a memory, wherein the target color lookup table comprises decimal data, and the decimal data is obtained by converting the binary data;
and the color correction module is used for acquiring a target color lookup table meeting the color correction requirement information from a memory, and performing color correction processing on the image to be color-corrected to obtain the image after color correction.
A third aspect of the embodiments of the present application provides an electronic device, including:
one or more processors; and
one or more machine-readable media having instructions stored thereon, which when executed by the one or more processors, cause the electronic device to perform a method as described in the first aspect of embodiments of the present application.
A fourth aspect of the embodiments of the present application provides an electronic device, including:
one or more machine readable media having instructions stored thereon, which when executed by one or more processors, cause the processors to perform a method as described in the first aspect of an embodiment of the present application.
By adopting the data storage method provided by the application, the decimal data can be converted into binary data and stored in the self-defined binary file, so that the space occupation of the binary file is reduced. The first aspect can enable the process of opening the binary file and the process of running the binary file by a user to be faster due to the fact that the space occupation amount of the binary file is smaller; the second aspect may enable a user to download a binary file faster. After the binary data in the binary file is converted into decimal data and stored in the memory, the memory is a storage medium with the highest running speed in the computer, so that the color correction processing can be performed on the color correction image more quickly, and the running speed of the file can be increased.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive exercise.
FIG. 1 is a flowchart illustrating steps of an image color correction method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a binary file according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an image color correction apparatus according to another embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, an embodiment of the present application provides an image color correction method, including:
step 101: and acquiring the image to be color-corrected and corresponding color correction requirement information.
In the embodiment of the present application, the image to be color-corrected refers to an image that needs color correction, and refers to an original, unprocessed image, and the image to be color-corrected includes RGB values of each pixel.
The color correction requirement information represents style information of the image to be color corrected, which is required by the user.
In some scenes, the color correction requirement information is of a dark and black style, and then after the to-be-corrected image and the color correction requirement information are acquired, it may be determined that the original to-be-corrected image is converted into the dark and black style.
Step 102: reading a binary file meeting the color correction demand information from a disk according to the color correction demand information, wherein the binary file comprises binary data; and converting the binary data by LUT data in the LUT file.
In the embodiment of the application, a plurality of binary files are stored in the disk, each binary file is a color lookup table and represents a color conversion effect, for example, the binary file a can convert an image to be color-corrected into a dark black style, and the binary file B can convert the image to be color-corrected into a nostalgic style picture.
In some scenes, when the image to be color-corrected is obtained and the style of the image to be color-corrected required by the user is determined to be a dark style, if the binary file A is determined to meet the user requirement from the multiple binary files in the disk, the color of the image to be color-corrected can be corrected by using the binary file A, so that the image to be color-corrected is converted into the dark style.
Where the LUT file is also essentially a color look-up table capable of converting one color effect to another, the suffix names of the LUT file may include LUT, vf, cube, 3dl, cms, dxlut, etc., while the LUT files of different suffix names include different types of LUT data.
The LUT file includes LUT data and a header of the LUT data, the LUT data exists in the LUT file in a text form, the LUT data itself existing in the text form occupies a relatively large memory, and the LUT file generally includes thousands of LUT data, so that the space occupation amount of the LUT file is large, for example, one LUT file may reach several tens of GB.
Specifically, when the LUT file is used as an LUT tool, if a user needs to download the LUT file from the server to a local disk of the client, the LUT file is large, so that the speed of downloading the LUT file by the user is slow in the first aspect, the LUT file needs to be stored in a large space in the second aspect, and when the user uses the LUT file to perform color effect conversion on an image, the processes of opening the LUT file and running the LUT file are slow in the third aspect.
Therefore, in order to increase the downloading speed of the LUT file, reduce the space occupation amount of the LUT file, and increase the operating speed of the LUT file, the LUT data in the LUT file is converted into binary data and stored in the customized binary file in the embodiment of the present application.
For example, if only three pieces of LUT data of 20, 30, and 40 are stored in the LUT file, the three pieces of LUT data of 20, 30, and 40 in the LUT file may be converted into three binary data of 10100, 11110, and 101000, respectively.
It will be appreciated that in a computer, a number will occupy 8 bytes, and the three LUT data 20, 30, and 40 will occupy 48 bytes, given the data format of the agent 8. And one byte can set 8 binary data, then three binary data of 10100, 11110, 101000 can be represented by 3 bytes.
Therefore, it can be seen that the binary data is used for storage, and compared with the LUT data for storage, the space occupation amount is greatly reduced, so that the space occupation amount of the binary file is obviously less than that of the LUT file for the LUT file and the binary file with the same color conversion effect, and when a user downloads the binary file, the binary file is smaller, so that the binary file can be downloaded more quickly, the space occupation amount is also reduced, and the running speed is improved.
Step 103: and converting the binary file into a target color lookup table and storing the target color lookup table in a memory, wherein the target color lookup table comprises decimal data, and the decimal data is obtained by converting the binary data.
In the embodiment of the application, after the LUT file is converted into the binary file and then into the target color lookup table, the color conversion effects of the LUT file, the binary file and the target color lookup table are consistent, but the data formats are different and the data volumes are different.
And because the target color lookup table is obtained by converting the binary data in the binary file, the data head of the decimal data in the target color lookup table is the same as the data head of the binary data in the binary file.
Specifically, in the process of reading the binary file into the memory, the binary data in the binary file is converted into decimal data, so that the binary file is converted into a target color lookup table and stored in the memory. Illustratively, in the process of reading the binary file into the memory, three binary data of 10100, 11110 and 101000 are respectively converted into three decimal data of 20, 30 and 40.
In some scenes, after the user opens the binary file, the computer automatically converts the binary file into a target color lookup table to read the target color lookup table into the memory, and performs the step of performing color effect conversion on the image to be color-corrected in the memory through the target color lookup table.
Because the memory is the storage position with the highest running speed in the computer, the color correction processing speed of the image to be color-corrected can be greatly improved by reading the binary file into the memory.
Step 104: and reading a target color lookup table from the memory, and performing color correction processing on the image to be color-corrected by using the target color lookup table to obtain the image after color correction.
In the embodiment of the application, the color-corrected image refers to a color-converted image to be color-corrected, and the target color lookup table stored in the memory is converted by a binary file, so the target color lookup table is also a color lookup table in nature, and since the color lookup table has a mapping relationship between an RGB input value and an RGB output value, one color effect can be converted into another color effect.
In some scenes, the RGB input value of each pixel in the image to be color-corrected is obtained, the RGB output value corresponding to each RGB input value is searched one by one in the decimal data of the target color lookup table, and each RGB output value is correspondingly input into each pixel of the image to be color-corrected, so that the image after color correction is obtained.
By the data storage method, the decimal data can be converted into binary data and stored in the user-defined binary file, and therefore the space occupation of the binary file is reduced. The first aspect can enable the process of opening the binary file and the process of running the binary file by a user to be faster due to the fact that the space occupation amount of the binary file is smaller; the second aspect may enable a user to download a binary file faster. After the binary data in the binary file is converted into decimal data and stored in the memory, the memory is a storage medium with the highest running speed in the computer, so that the color correction processing can be performed on the color correction image more quickly, and the running speed of the file can be increased.
An embodiment of the present application further provides an image color correction method, where the method includes:
step 201: and acquiring the image to be color-corrected and corresponding color correction requirement information.
Step 202: and searching the data head of each target color lookup table in the memory according to the color correction requirement information, and determining whether the target color lookup table meeting the color correction requirement information exists.
In the embodiment of the present application, LUT data in an LUT file is converted into binary data to form a binary file, the binary data in the binary file is converted into decimal data to form a target color lookup table, a data header is designed in both the LUT file and the target color lookup table of the binary file and the memory, and data stored in the file is read by the data header.
The data head in the target color lookup table is consistent with the data head in the binary file, and the data head in the target color lookup table is used for representing a reading rule of decimal data in the target color lookup table and a rule of writing the decimal data into the target color lookup table. The computer may read the decimal data according to a data header within the target color look-up table.
Step 203: and under the condition that the target color lookup table meeting the color correction requirement information exists in the memory, reading the target color lookup table meeting the color correction requirement information from the memory according to the color correction requirement information.
The memory can store a plurality of target color lookup tables, and when the target color lookup table meeting the user color correction requirement information can be searched from the memory, the binary file meeting the user color correction requirement information does not need to be searched from the disk and read into the memory, so that the color correction speed of the image is further improved.
Specifically, when a user uses a certain target color lookup table for the first time, the binary file in the disk is converted into the target color lookup table and read into the memory, so that the target color lookup table is read from the memory. However, when the user uses the target color lookup table again within the preset time, if the binary file is read from the disk and converted into the target color lookup table to be read into the memory, the image color effect conversion speed is slow.
Therefore, in order to increase the speed of the user using the same target color lookup table again to perform image color effect conversion, a map container may be established in the memory, and after the target color lookup table is read into the memory, the id of the target color lookup table and the decimal data of the target color lookup table are also read into the map container at the same time. When the user uses the same target color lookup table again within the preset time length, the required target color lookup table can be directly searched from the map container of the memory, and the color effect conversion speed of the image is higher.
Naturally, if it is found that the target color lookup table meeting the user requirement does not exist in the memory, the step 204 still needs to be executed: reading a binary file meeting the requirements of a user from a magnetic disk, converting the binary data in the binary file into decimal data to form a target color lookup table, reading the decimal data into an internal memory, and converting the color effect of the image to be color-corrected in the internal memory.
In order to increase the operating speed of the memory, the stored multiple objects may be cleared within a preset time period, and the map container of the cleared memory no longer stores the target color lookup table read into the memory.
Step 204: under the condition that a target color lookup table meeting the color correction requirement information does not exist in the memory, reading a binary file meeting the color correction requirement information from a disk according to the color correction requirement information, wherein the binary file comprises binary data; and converting the binary data by LUT data in the LUT file.
In the embodiment of the application, the color correction requirement information includes image information and template information. A number of binary files are stored in the disk, each binary file having a unique uid, i.e. a unique identifier. For example, the uid corresponding to binary file A of the name of "Hongfeng movie" is "6B 51AA79-1F7A-4F03-A731-2652 CEBECDDA", the corresponding conversion effect is to convert the color image to be corrected into a dark black style, "the uid corresponding to binary file B of the name of past DY" is "6B 51AA79-1F7A-4F03-A731-1234 CEBECDDA", the corresponding conversion effect is to convert the color image to be corrected into a nostalgic style, and the uid corresponding to binary file C of the name of "ancient wind" is "6B 51AA79-1F7A-4F03-A731-5678 CEBECDDA", and the corresponding conversion effect is to convert the color image to be corrected into a classical style.
In some scenarios, when a user wants to convert an image to be color-corrected into a dark-black style, and opens the disk, the user may click on the binary file a corresponding to the "port movie" in the disk, and the unique identifier uid corresponding to the binary file a is "6B 51AA79-1F7A-4F03-a731-2652 cebecgda", so that it can be determined that the conversion effect of the binary file a is to convert the image to be color-corrected into the dark-black style.
Accordingly, when the name of the binary file a is changed from "harbor movie" to "cool and dazzling movie", the conversion effect of the binary file a is to convert the color image to be corrected into a dark and black style since the uid of the binary file is not changed although the name is changed.
In the embodiment of the application, predefined templates can be stored in the disk, each predefined template comprises a plurality of binary files, for example, a predefined template 1 sequentially comprises a binary file a, a binary file B and a binary file C; the predefined template 2 sequentially comprises a binary file D, a binary file E and a binary file F.
In some scenes, when a user wants to convert the color image to be corrected into a dark black style in the 0 s-5 s, convert the color image to be corrected into a nostalgic style in the 6 s-10 s and convert the color image to be corrected into a classical style in the 11 s-15 s of the video to be corrected, the image color conversion can be performed on each frame of the color image to be corrected in the video to be corrected by using the predefined template 1.
In the embodiment of the application, the binary file is obtained through the following sub-steps:
substep 2041: a LUT file to be processed is obtained.
In step 2041, LUT files with different suffixes, such as LUT, vf, cube, 3dl, cms, dxlut, etc., may be obtained, and then the LUT data in the LUT files with different suffixes is uniformly converted into binary data.
By gathering the LUT files with different suffixes, the subsequent steps can be conveniently and uniformly converted into binary files, so that a user can perform color effect conversion on the color correction image by adopting the binary files with uniform formats without adopting the LUT files with various suffixes, and the uniformity of color conversion tools is realized.
Substep 2042: converting the LUT data in the LUT file into the binary data and generating a data header for the binary data.
In the embodiment of the present application, after LUT data is obtained by reading LUT files of respective different suffixes, the LUT data is converted into binary data; the developer defines the data head of the binary data in a unified way and writes the converted binary data according to the specified way of the binary data head, thus forming a unified self-defined binary file; referring to fig. 2, the binary file includes a data header of the binary data and the binary data, the data header of the binary data is also used to represent a data reading rule and a data writing rule of the binary data, and the computer can read the binary data and write the binary data according to the data header of the binary data.
Wherein, before converting LUT data into binary data, LUT data needs to be acquired from LUT data, and since LUT files include various files with different suffix names, LUT data needs to be acquired by taking the following steps, which are implemented by a conversion tool:
step A1: the LUT file suffix name is read to determine the LUT file type.
The translation tool stores the correspondence of suffix names to LUT file types. For example, when the read suffix name is vf, the LUT file type is determined to be vf file.
Step A2: and determining the data header of the LUT file according to the LUT file type.
The conversion tool also stores the correspondence between file types and headers. For example, when the file type is determined to be a vf file, the header of the vf file may be determined to include the data format of float16, the single dimension size of 13, and so on.
Step A3: the LUT data in the LUT file is read according to a header of the LUT file.
After determining the header of the LUT file, the conversion tool reads the LUT data in the LUT file according to the reading rule specified by the header of the LUT file.
For example, in the LUT file with the suffix vf, the data format in the data header is float16, so when reading the LUT data, the LUT data needs to be read according to the data format specified by float 16.
Wherein after converting the LUT data into binary data, a header needs to be generated for the binary data.
Since different LUT data are included in LUT files with different suffix names, when the binary file of the present application is adopted, a data header needs to be uniformly prepared for the binary file, so that when color effect conversion of an image is performed, the binary file provided in the embodiment of the present application can be uniformly adopted to perform color effect conversion. One type of binary file may have different headers, i.e., one color lookup table may have different headers, to enable multiple data representations for one color lookup table. For example, the binary file a may be stored in a size of one dimension 13 as shown in table 1 below, or may be stored in a size of one dimension 17, and both binary files a may convert a picture of a fresh style into a picture of a dark black style, but the amounts of data stored in the two binary files are different.
Specifically, the data header in the binary file at least includes a file identifier, a file type, a version number, a single dimension size, a data type, a 3D identifier, a reserved item, and a data offset.
Figure 571865DEST_PATH_IMAGE001
Table 1
Referring to table 1, table 1 shows a header of a certain binary file, and when a developer wants to define a header format of the binary file in the binary file, the developer may write the header that the developer wants to define after corresponding tags such as a file identifier (not shown in table 1), a version number, a single-dimensional size, a data format, a 3D identifier, a reserved item, a data offset, and the like.
In the case that the data header includes a version number, a version number of sdbaf.1 represents that the version of the current binary file is the initial version.
In the case where the data header includes a single-dimensional size, since the values of RGB are generally 256 parts for each dimension, if 256 parts of binary data are written in a binary file for each RGB dimension, this will certainly increase the labor intensity of the developer.
Therefore, in the embodiment of the present application, the number of binary data in the binary file is predefined in the data header by a single-dimensional size, so as to represent the data amount of the binary data. For example, converting the LUT data into binary data of a one-dimensional size, the specified size including any one of: 13. 15, 17, when the single dimension is 13, indicating that the binary file comprises 13 binary data; when the one-dimensional size is 15, it means that the binary file includes 15 binary data, and when the one-dimensional size is 17, it means that the binary data includes 17 binary data.
Through the arrangement that the data head comprises the single-dimensional size, each part of binary data does not need to be written in the binary file, and only the binary data with the specified size needs to be written, so that the labor intensity of developers is reduced.
In the case where the data header includes a data format, the data format is used to characterize write rules and read rules of binary data, e.g., converting the LUT data into binary data in a data format that is a designated data format, including any of: uint8 unsigned integer data, uint16 unsigned integer data, float16 half precision floating point data is float32 single precision floating point data. When the data format is 0, the binary file indicates that binary data in the fluid 8 data format is stored in the binary file; when the data format is 1, the binary file indicates that binary data in the fluid 16 data format is stored in the binary file; when the data format is 3, the binary file indicates that binary data in the float16 data format is stored in the binary file; when the data format is 4, it indicates that binary data in the float32 data format is stored in the binary file. Then, the developer can write 0, 1, 2, 3 under the label of the data format, thereby characterizing what data format the binary data in the binary file is.
In the case where the data header includes a 3D flag, the 3D flag is 0, indicating that the binary file is 1dlut, which means that the binary file is capable of converting the color of the image to a darker or lighter color, e.g., blue to dark blue or light blue; the 3D flag is 1, indicating that the binary is 3dlut, which means that the binary is capable of converting the color of the image to another color, for example blue to red. Then, the developer can write 0, 1 under the 3D identified tag, thereby characterizing whether the binary is 1dlut or 3 dlut.
In the case where the data header includes a data reservation entry, the data reservation entry may be any number, such as 0, 8, etc., so that the bytes within the data header are reserved in the data header for the functions of subsequent extensions.
In the case where the data header includes a data offset, the initial position of the binary data can be quickly found using the data offset.
For example, the header of binary data occupies a total of 8 bytes, and then the start position of binary data immediately after the header of binary data is the 9 th byte. Therefore, in order to find the start position of the binary data quickly, 8 is written under the label of the data offset of the data head, and then the computer automatically reads the binary data from the position of the 9 th byte according to the 8 bytes, rather than reading the 9 th byte from the first byte one by one, thereby improving the reading speed of the binary data.
Substep 2043: and adding the data head on the binary data to obtain the binary file.
In the embodiment of the present application, after the data header shown in table 1 is set, binary data may be written in the binary file according to the format specified by the data header shown in table 1, and the data header shown in table 1 is added in front of the binary data, so as to form a binary file with a preceding data header and a succeeding binary data header.
The order of adding the data head to the binary file and writing the binary data is not limited in the application, and the order of the data head and the binary data can be exchanged.
In some scenarios, a first identifier characterizing a specific data format is added to binary data to obtain the binary file, wherein different specific data formats correspond to different first identifiers.
As shown in table 1, a first flag may be added in front of the binary data, the first flag may include 0, 1, 2, 3, when the first flag is 0, the data format is uint8, and the rest of the first flags are similar.
In other scenarios, a second identifier representing a designated size is added to the binary data to obtain the binary file, wherein different single-dimensional sizes correspond to different second identifiers.
As shown in table 1, a second identifier may be added in front of the binary data, the second identifier may include 13, 15, 17, and when the second identifier is 13, it indicates that the single dimension size is 13.
In still other scenarios, a third identifier characterizing a specified offset is added to the binary data, wherein different specified offsets correspond to different third identifiers.
As shown in table 1, a third flag may be added in front of the binary data, and the third flag may include an arbitrary value, and when the third flag is 8, it indicates that the initial position of the LUT data is different from the initial position of the binary data by 8 bytes.
Step 205: and converting the binary file into a target color lookup table and storing the target color lookup table in a memory, wherein the target color lookup table comprises decimal data, and the decimal data is obtained by converting the binary data.
In the above steps 201 to 205, the LUT file, the binary file and the target color lookup table are each a color lookup table, and can convert one color effect of the image into another color effect, where the difference is that the space occupation amount of the binary data in the binary file is smaller, and the speed of converting the color effect of the image by the target color lookup table in the memory is faster.
Step 206: and in the memory, performing color correction processing on the image to be subjected to color correction by using the target color lookup table to obtain the image subjected to color correction.
In step 206, the method specifically includes the following steps:
substep 2061: and converting the image to be color-corrected in the non-RGB color space into the image to be color-corrected in the RGB color space.
Since the image to be color-corrected may include YUV and other non-RGB color spaces, and the binary file in the embodiment of the present application uses an RGB color space, the image to be color-corrected in the non-RGB color space needs to be converted into an image to be color-corrected in the RGB color space.
In the specific conversion, the YVU value of each pixel in the image to be color-corrected can be converted into an RGB value by adopting the following formula:
Figure 754585DEST_PATH_IMAGE002
(formula 1)
Figure 65481DEST_PATH_IMAGE003
(formula 2)
Figure 726269DEST_PATH_IMAGE004
(formula 3)
As can be seen from the above three formulas of formula 1, formula 2 and formula 3, the RGB value can be obtained by YUV value conversion, so that the image to be color-corrected in the YUV color space can be converted into the image to be color-corrected in the RGB color space.
Substep 2062: and acquiring the RGB value of each pixel on the image to be color-corrected.
Substep 2063: and finding out target decimal data corresponding to each pixel RGB value from the decimal data of the target color lookup table.
In the embodiment of the application, the number of pixels on the image to be color-corrected is too large, and the data size is large, so that the color conversion process of the image is slow.
In order to perform color conversion of an image more quickly, target decimal data can be searched from a target color lookup table in a multi-thread manner.
Specifically, the image to be color-corrected is divided into a plurality of image blocks, each image block is used for simultaneously searching corresponding target decimal data in a target color lookup table through different threads, and then the target decimal data is input into the image to be color-corrected through different threads, so that the color effect conversion of the image to be color-corrected is completed.
In order to find out the target decimal data from the target color lookup table more quickly, an index table is written in the memory, and the index table has a corresponding relation between an index value and the target decimal data.
Specifically, when the color conversion is performed on the color image to be corrected by using the index table and the interpolation table in the memory, the index table and the interpolation table may be read from the memory; taking the color correction demand information as an index value, and finding target data and a target interpolation coefficient corresponding to the index value in the index table; obtaining the target interpolation coefficient from the interpolation table, and obtaining the target data from the target color lookup table; obtaining a target interpolation value according to the target interpolation coefficient and the index value; and inputting the target interpolation and the target data into the image to be color-corrected to obtain the image after color correction.
Wherein the target data refers to target decimal data of a number of decimal data in the target color look-up table. Then, the procedure for obtaining the target decimal data is as follows: and taking the RGB value of each pixel in the image to be color-corrected as an index value, searching in the index table, and after finding out the corresponding target decimal data, acquiring the target decimal data from the target color lookup table. And inputting the target decimal data into the image to be color-corrected to complete the color conversion of the image to be color-corrected.
Since the single-dimensional size is predefined in sub-step 2042, the target decimal data corresponding to the RGB values of some pixels in the color image to be corrected may not be found in the target color lookup table.
Figure 321067DEST_PATH_IMAGE005
Table 2
For example, as shown in table 2, after the target color lookup table defines a single dimension size of 3 in the R dimension, the original 256 decimal data are reduced to three decimal data of 50, 200 and 255, and among these data, there should be 51, 52, 53, 54 decimal data between 50 and 200, and it is after the single dimension size is set, so these decimal data are missing.
Accordingly, when some pixel values of the image to be processed are input as index values in the index table, the decimal data 51, 52, 53, 54, etc. cannot be searched from the target color lookup table.
Therefore, in order to obtain the decimal data missing from the target color lookup tables 51, 52, 53 and 54, the embodiment of the present application further sets an interpolation table, and further sets a corresponding relationship between the index value and the target interpolation coefficient in the index table.
For example, the index value 26 corresponds to an interpolation coefficient 1, and when the R value of a certain pixel in the color image to be corrected is acquired as 26, the target interpolation coefficient 1 may be obtained from the interpolation table after the target interpolation coefficient 1 is found in the index table by using 26 as the index value.
Then the eight closest points, such as 22, 23, 24, 25, 27, 28, 29, 30, around the index value 26 are found in the RGB color space; the 8 points are divided into four groups of data, namely 22 and 23, 24 and 25, 27 and 28, and 29 and 30, and the four groups of data respectively use a target interpolation coefficient 1 and a linear difference algorithm to obtain four data; dividing the four data into two groups, and obtaining two data by respectively using a target interpolation coefficient 1 and a linear difference algorithm between two data in the two groups of data; finally, the target decimal data 51 is obtained by using the target interpolation coefficient 1 and the linear difference algorithm between the two data. And then the target decimal data 51 is input into the image to be color-corrected to complete the color effect conversion of the image to be color-corrected.
In this process, the index value and two data in each set of data may be substituted into a linear difference algorithm to calculate the target decimal data.
The method can make up for the missing decimal data to complete the color effect conversion of the image to be color-corrected, and can complete the color effect conversion work of the image to be color-corrected while occupying less space of the binary file or the target color lookup table.
In order to increase the reading speed of decimal data in the read target color lookup table, the data size of each RGB dimension is recorded in the memory, and the data size comprises a B table size and a GB table size.
Illustratively, because the target color lookup table stores the decimal data in each dimension of RGB, and the decimal data in each dimension includes 256 numerical values, when the computer needs to read the numerical value in the dimension G in the target color lookup table, the computer needs to read the numerical value in the dimension G after reading the 256 numerical values in the dimension B, which undoubtedly also reduces the reading speed of the computer for one target color lookup table.
Therefore, in order to increase the reading speed of the computer, the size of the B table is set in the memory, and the size of the B table represents the data volume in the B dimension, so that when the computer wants to read the value in the G dimension, the computer can directly know the data volume in the B dimension through the size of the B table, and after knowing the data volume, the computer can directly read the value in the G dimension without reading the values in the B dimension one by one, thereby increasing the reading speed of the computer.
Based on the same inventive concept, another embodiment of the present application provides an image color correction apparatus, please refer to an image color correction apparatus shown in fig. 3, the apparatus includes:
the acquisition module is used for acquiring the image to be color-corrected and corresponding color correction demand information;
the reading module is used for reading a binary file meeting the color correction demand information from a magnetic disk according to the color correction demand information, and the binary file comprises binary data; the binary data is obtained by converting LUT data in an LUT file;
the storage module is used for converting the binary file into a target color lookup table and storing the target color lookup table in a memory, wherein the target color lookup table comprises decimal data, and the decimal data is obtained by converting the binary data;
and the color correction module is used for acquiring a target color lookup table meeting the color correction requirement information from a memory, and performing color correction processing on the image to be color-corrected to obtain the image after color correction.
Optionally, the apparatus further comprises:
the judging module is used for searching a data head of each target color lookup table in the memory according to the color correction demand information and determining whether the target color lookup table meeting the color correction demand information exists or not;
a first executing module, configured to execute the following steps when a target color lookup table that meets the color correction requirement information does not exist in the memory: and reading the binary file meeting the color correction requirement information from a disk according to the color correction requirement information.
Optionally, the apparatus further comprises:
the file acquisition module is used for acquiring the LUT file to be processed;
the conversion module is used for converting the LUT data in the LUT file into the binary data and generating a data header for the binary data;
and the adding module is used for adding the data head on the binary data to obtain the binary file.
Optionally, the data header comprises a data format;
the conversion module further comprises: a format generation module for converting the LUT data into binary data having a data format that is a specified data format, the specified data format including any one of: the uint8 unsigned integer data, the uint16 unsigned integer data, the float16 half precision floating point data is float32 single precision floating point data;
the adding module further comprises: and the format adding module is used for adding the first identifier representing the specified data format to the binary data to obtain the binary file, wherein different specified data formats correspond to different first identifiers.
Optionally, the data header comprises a single dimension size;
the conversion module further comprises: a size generation module to convert the LUT data into binary data of a single dimension specified size, the specified size comprising any one of: 13. 15, 17;
the adding module further comprises: and the size adding module is used for adding a second identifier representing the designated size to the binary data to obtain the binary file, wherein different single-dimensional sizes correspond to different second identifiers.
Optionally, the data header includes a data offset;
the conversion module further comprises: an offset generation module for converting the LUT data into binary data whose data offset is a specified offset;
the adding module further comprises: and the offset adding module is used for adding a third identifier representing the designated offset to the binary data, wherein different designated offsets correspond to different third identifiers.
Optionally, the color correction module further includes:
the table reading module is used for reading the index table and the interpolation table in the memory;
the index module is used for taking the color correction demand information as an index value, and finding target data and a target interpolation coefficient corresponding to the index value in the index table;
a difference value obtaining module, configured to obtain the target interpolation coefficient from the interpolation table, and obtain the target data from the target color lookup table;
a difference value obtaining module, configured to obtain a target interpolation according to the target interpolation coefficient and the index value;
and the color correction submodule is used for inputting the target interpolation and the target data into the image to be subjected to color correction to obtain the image subjected to color correction.
Based on the same inventive concept, an embodiment of the present application further provides an electronic device, including: one or more processors; and one or more machine readable media having instructions stored thereon that, when executed by the one or more processors, cause the electronic device to perform the above-described image shading method.
Based on the same inventive concept, the embodiments of the present application also provide one or more machine-readable media having instructions stored thereon, which when executed by one or more processors, cause the processors to perform the image color correction method described above.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one of skill in the art, embodiments of the present application may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the true scope of the embodiments of the application.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The image color correction method, the image color correction device, the electronic device and the machine-readable medium provided by the present application are introduced in detail, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the above embodiment is only used to help understanding the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method of color correction of an image, the method comprising:
acquiring an image to be color-corrected and corresponding color correction demand information;
reading a binary file meeting the color correction demand information from a disk according to the color correction demand information, wherein the binary file comprises binary data; the binary data is obtained by converting LUT data in an LUT file;
converting the binary file into a target color lookup table and storing the target color lookup table in a memory, wherein the target color lookup table comprises decimal data, and the decimal data is obtained by converting the binary data;
and in the memory, performing color correction processing on the image to be subjected to color correction by using the target color lookup table to obtain the image subjected to color correction.
2. The method of claim 1, wherein before reading the binary file satisfying the color correction requirement information from the disk, the method further comprises:
searching each loaded color lookup table in the memory according to the color correction requirement information, and determining whether a target color lookup table meeting the color correction requirement information exists;
under the condition that a target color lookup table which meets the color correction requirement information does not exist in the memory, executing the following steps: and reading the binary file meeting the color correction requirement information from a disk according to the color correction requirement information.
3. The method of claim 1, wherein the binary file is generated by:
acquiring an LUT file to be processed;
converting the LUT data in the LUT file into the binary data and generating a data header for the binary data;
and adding the data head on the binary data to obtain the binary file.
4. The method of claim 3, wherein the data header comprises a data format;
converting the LUT data in the LUT file into the binary data and generating a header for the binary data, comprising: converting the LUT data into binary data in a data format that is a designated data format, the designated data format comprising any one of: the uint8 unsigned integer data, the uint16 unsigned integer data, the float16 half precision floating point data is float32 single precision floating point data;
adding the data header to the binary data to obtain the binary file, including: and adding a first identifier representing the specified data format to binary data to obtain the binary file, wherein different specified data formats correspond to different first identifiers.
5. The method of claim 3, wherein the data header comprises a one-dimensional size;
converting the LUT data in the LUT file into the binary data and generating a header for the binary data, comprising: converting the LUT data into binary data of a single dimension, the specified dimension comprising any of: 13. 15, 17;
and adding a second identifier representing the designated size to the binary data to obtain the binary file, wherein different single-dimensional sizes correspond to different second identifiers.
6. The method of claim 3, wherein the data header includes a data offset;
converting the LUT data in the LUT file into the binary data and generating a header for the binary data, comprising: converting the LUT data into binary data whose data offset is a specified offset;
adding a third identifier characterizing a designated offset to the binary data, wherein different designated offsets correspond to different third identifiers.
7. The method according to claim 1, wherein performing color correction processing on the image to be color-corrected by using the target color lookup table in the memory to obtain a color-corrected image comprises:
reading an index table and an interpolation table in the memory;
taking the color correction demand information as an index value, and finding target data and a target interpolation coefficient corresponding to the index value in the index table;
obtaining the target interpolation coefficient from the interpolation table, and obtaining the target data from the target color lookup table;
obtaining a target interpolation value according to the target interpolation coefficient and the index value;
and inputting the target interpolation and the target data into the image to be color-corrected to obtain the image after color correction.
8. An image color correction apparatus, comprising:
the acquisition module is used for acquiring the image to be color-corrected and corresponding color correction demand information;
the reading module is used for reading a binary file meeting the color correction demand information from a magnetic disk according to the color correction demand information, and the binary file comprises binary data; the binary data is obtained by converting LUT data in an LUT file;
the storage module is used for converting the binary file into a target color lookup table and storing the target color lookup table in a memory, wherein the target color lookup table comprises decimal data, and the decimal data is obtained by converting the binary data;
and the color correction module is used for acquiring a target color lookup table meeting the color correction requirement information from a memory, and performing color correction processing on the image to be color-corrected to obtain the image after color correction.
9. An electronic device, comprising:
one or more processors; and
one or more machine-readable media having instructions stored thereon that, when executed by the one or more processors, cause the electronic device to perform the method of any of claims 1-7.
10. One or more machine readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method of any one of claims 1-7.
CN202111032781.9A 2021-09-03 2021-09-03 Image color correction method and device, electronic equipment and machine readable medium Active CN113489860B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111032781.9A CN113489860B (en) 2021-09-03 2021-09-03 Image color correction method and device, electronic equipment and machine readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111032781.9A CN113489860B (en) 2021-09-03 2021-09-03 Image color correction method and device, electronic equipment and machine readable medium

Publications (2)

Publication Number Publication Date
CN113489860A true CN113489860A (en) 2021-10-08
CN113489860B CN113489860B (en) 2021-11-23

Family

ID=77947167

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111032781.9A Active CN113489860B (en) 2021-09-03 2021-09-03 Image color correction method and device, electronic equipment and machine readable medium

Country Status (1)

Country Link
CN (1) CN113489860B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6539110B2 (en) * 1997-10-14 2003-03-25 Apple Computer, Inc. Method and system for color matching between digital display devices
CN1459204A (en) * 2001-03-16 2003-11-26 精工爱普生株式会社 Environment adaptive image display system, information storage medium, and image processing method
JP3888119B2 (en) * 2001-10-11 2007-02-28 富士ゼロックス株式会社 Image processing device
CN101136998A (en) * 2006-08-31 2008-03-05 索尼株式会社 Image processing device and image processing method
CN101513035A (en) * 2006-09-06 2009-08-19 伊斯曼柯达公司 Color correction method
CN101808183A (en) * 2009-02-17 2010-08-18 佳能株式会社 Image processing apparatus and image processing method that correct color conversion table used when reading document
CN110035199A (en) * 2017-12-19 2019-07-19 奥林巴斯株式会社 Color of image conversion equipment, color of image conversion method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6539110B2 (en) * 1997-10-14 2003-03-25 Apple Computer, Inc. Method and system for color matching between digital display devices
CN1459204A (en) * 2001-03-16 2003-11-26 精工爱普生株式会社 Environment adaptive image display system, information storage medium, and image processing method
JP3888119B2 (en) * 2001-10-11 2007-02-28 富士ゼロックス株式会社 Image processing device
CN101136998A (en) * 2006-08-31 2008-03-05 索尼株式会社 Image processing device and image processing method
CN101513035A (en) * 2006-09-06 2009-08-19 伊斯曼柯达公司 Color correction method
CN101808183A (en) * 2009-02-17 2010-08-18 佳能株式会社 Image processing apparatus and image processing method that correct color conversion table used when reading document
CN110035199A (en) * 2017-12-19 2019-07-19 奥林巴斯株式会社 Color of image conversion equipment, color of image conversion method

Also Published As

Publication number Publication date
CN113489860B (en) 2021-11-23

Similar Documents

Publication Publication Date Title
US11094035B2 (en) System and method for mapped splicing of a three-dimensional look-up table for image format conversion
CN113112422B (en) Image processing method, device, electronic equipment and computer readable medium
CN115908613B (en) AI model generation method, system and storage medium based on artificial intelligence
CN113781321B (en) Information compensation method, device and equipment for image highlight region and storage medium
CN111049735B (en) Group head portrait display method, device, equipment and storage medium
CN110363837B (en) Method and device for processing texture image in game, electronic equipment and storage medium
CN113489860B (en) Image color correction method and device, electronic equipment and machine readable medium
CN115591239A (en) Game scene generation method and device, computer equipment and storage medium
CN111242836B (en) Target image generation method, device and equipment for generating advertisement image
US20120070080A1 (en) Color correction for digital images
US8922580B2 (en) Method and system to modify a color lookup table
CN108550110B (en) Panorama stitching method and device based on RAW image and electronic equipment
CN114449354B (en) Video editing method and system
CN114299168A (en) Image color matching method, device, equipment and medium
CN112070850B (en) Animation data encoding and decoding method and device, storage medium and computer equipment
CN112150589B (en) Animation data encoding and decoding method and device, storage medium and computer equipment
CN112053277B (en) Method, device, equipment and storage medium for changing image skin
US20220207671A1 (en) Conversion of image
EP3454538A1 (en) Method for determining a transfer function adapted to be used for color grading a visual content and corresponding electronic device, system, computer readable program product and computer readable storage medium
JP4772726B2 (en) Color conversion processing program, processing device, and processing method
CN114266841B (en) Image color conversion method and data storage method thereof
Zabaleta et al. Photorealistic style transfer for cinema shoots
CN117827179A (en) Data processing method, device, electronic equipment and storage medium
CN108959317B (en) Picture retrieval method based on feature extraction
CN119367757A (en) Game texture processing method, device, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant