Data mapping method based on three-dimensional lookup table
Patent Information
- Application Number
- PCT/CN2024/081247
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-06
- Filing Date
- 2024-03-12
- Publication Date
- 2025-10-02
AI Technical Summary
The data mapping method based on trilinear interpolation in the prior art has low data mapping accuracy.
A data mapping method based on a three-dimensional lookup table is adopted. By obtaining the original grayscale value and color depth of the target pixel point, a source cube is established after the first mapping process, which is expanded into a target cube. The target tetrahedron is determined using the tetrahedron interpolation algorithm, and the second mapping process is performed. Finally, interpolation processing is performed to obtain the target mapping value.
The accuracy of data mapping is improved, and the problem of low data mapping accuracy of the trilinear interpolation method in the prior art is solved.
Smart Images

Figure CN2024081247_02102025_PF_FP_ABST
Abstract
Description
Data mapping method based on three-dimensional lookup table
[0001] The present disclosure claims priority from a patent document filed on March 6, 2024, with application number 202410258036.3 and titled “Data mapping method based on three-dimensional lookup table”, the entire contents of which are incorporated by reference into the present disclosure. Technical Field
[0002] The present disclosure relates to the field of display technology image processing, and in particular to a data mapping method based on a three-dimensional lookup table, a data mapping device based on a three-dimensional lookup table, a computer-readable storage medium, and an electronic device. Background Art
[0003] With the development of electronic technology, the use of display panels such as mobile phones, tablets, and computer screens is becoming increasingly widespread. They are no longer limited to a single color display mode. How to flexibly and quickly achieve color mode transitions has become a data mapping problem that needs to be solved urgently. However, the data mapping method based on trilinear interpolation in the existing technology has low data mapping accuracy.
[0004] Summary of the Invention
[0005] The main purpose of the present disclosure is to provide a data mapping method based on a three-dimensional lookup table, a data mapping device based on a three-dimensional lookup table, a computer-readable storage medium and an electronic device, so as to at least solve the problem of low data mapping accuracy of the data mapping method in the prior art.
[0006] According to one aspect of the present disclosure, a data mapping method based on a three-dimensional lookup table is provided, which obtains an original grayscale value of a target pixel point and a color depth of the target pixel point, and shifts the original grayscale value left by a predetermined number of bits to obtain a target grayscale value, wherein the original grayscale value and the target grayscale value are binary numbers, the predetermined number of bits is a positive integer, and the target grayscale value includes an R channel sub-grayscale value, a G channel sub-grayscale value, and a B channel sub-grayscale value; performs a first mapping process on the target grayscale value according to the predetermined number of bits and the color depth to obtain a mapped grayscale value, wherein the mapped grayscale value is a power of 2; establishes a source cube containing the target pixel point, and obtains the position of the target pixel point in the source cube to obtain a first coordinate, wherein the length of the source cube corresponds to the R channel sub-grayscale value, and the source cube The width of the source cube corresponds to the B channel sub-grayscale value, and the height of the source cube corresponds to the G channel sub-grayscale value; the source cube is expanded to obtain a target cube, and the position of the target pixel point in the target cube is obtained to obtain a second coordinate, wherein the side length of the target cube is equal to the maximum value of the length, width and height of the source cube; according to the second coordinate, a target tetrahedron containing the second coordinate in the target cube is determined, and according to the target tetrahedron, a second mapping process is performed on the second coordinate to obtain a third coordinate, wherein the vertices of the target tetrahedron are any four of the vertices of the target cube; according to the positions of the vertices of the target tetrahedron and the side length of the target cube, the third coordinate is interpolated to obtain a target mapping value of the target pixel point.
[0007] Optionally, performing a first mapping process on the target grayscale value according to the predetermined number of bits and the color depth to obtain a mapped grayscale value includes: performing a first mapping process on the target grayscale value (2 n -1)×2 m Perform the first mapping process to obtain the mapped grayscale value 2 m+n , where m is the predetermined number of bits and n is the color depth.
[0008] Optionally, a source cube containing the target pixel point is established, and the position of the target pixel point in the source cube is obtained to obtain a first coordinate, including: taking any point around the target pixel point as a first origin, establishing the source cube containing the target pixel point; and determining the relative coordinates of the target pixel point with respect to the first origin as the first coordinates.
[0009] Optionally, the first coordinate includes a first R coordinate value, a first G coordinate value and a first B coordinate value, and the second coordinate includes a second R coordinate value, a second G coordinate value and a second B coordinate value, wherein obtaining the position of the target pixel point in the target cube to obtain the second coordinate includes: calculating the second R coordinate value R2 according to the formula R2=R1<<(xa), wherein R1 is the first R coordinate value, << is a left shift operator, x is the side length of the target cube, and a is the length of the source cube; calculating the second G coordinate value G2 according to the formula G2=G1<<(xb), wherein G1 is the first G coordinate value and b is the height of the source cube; calculating the second B coordinate value B2 according to the formula B2=B1<<(xc), wherein B1 is the first B coordinate value and c is the width of the source cube.
[0010] Optionally, the second coordinates include a second R coordinate value, a second G coordinate value, and a second B coordinate value, and the target tetrahedrons include a first tetrahedron, a second tetrahedron, a third tetrahedron, a fourth tetrahedron, a fifth tetrahedron, and a sixth tetrahedron. Determining, according to the second coordinates, the target tetrahedron containing the second coordinates in the target cube includes: determining whether the second coordinates satisfy that the second B coordinate value is greater than or equal to the second R coordinate value and the second R coordinate value is greater than or equal to the second G coordinate value, and if the second coordinates satisfy that the second B coordinate value is greater than or equal to the second R coordinate value and the second R coordinate value is greater than or equal to the second G coordinate value, determining the first tetrahedron as the target tetrahedron; In the case that the second coordinate does not satisfy that the second B coordinate value is greater than or equal to the second R coordinate value or the second R coordinate value is greater than or equal to the second G coordinate value, determine whether the second coordinate satisfies that the second B coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second R coordinate value; in the case that the second coordinate satisfies that the second B coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second R coordinate value, determine that the second tetrahedron is the target tetrahedron; in the case that the second coordinate does not satisfy that the second B coordinate value is greater than or equal to the second G coordinate value or the second G coordinate value is greater than or equal to the second R coordinate value, determine that the second tetrahedron is the target tetrahedron. Whether the second coordinates satisfy that the second G coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second R coordinate value, and when the second coordinates satisfy that the second G coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second R coordinate value, determine that the third tetrahedron is the target tetrahedron; when the second coordinates do not satisfy that the second G coordinate value is greater than or equal to the second B coordinate value or the second B coordinate value is greater than or equal to the second R coordinate value, determine whether the second coordinates satisfy that the second R coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second G coordinate value, and when the second coordinates satisfy the When the second R coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second G coordinate value, the fourth tetrahedron is determined to be the target tetrahedron; when the second coordinate does not satisfy that the second R coordinate value is greater than or equal to the second B coordinate value or the second B coordinate value is greater than or equal to the second G coordinate value, whether the second coordinate satisfies that the second R coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second B coordinate value; when the second coordinate satisfies that the second R coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second B coordinate value, the fifth tetrahedron is determined to be the target tetrahedron;If the second coordinate does not satisfy the condition that the second R coordinate value is greater than or equal to the second G coordinate value or the condition that the second G coordinate value is greater than or equal to the second B coordinate value, the sixth tetrahedron is determined to be the target tetrahedron.
[0011] Optionally, the target cube includes a first cube vertex, a second cube vertex, a third cube vertex, a fourth cube vertex, a fifth cube vertex, a sixth cube vertex, a seventh cube vertex, and an eighth cube vertex; the target tetrahedron includes a first tetrahedron vertex, a second tetrahedron vertex, a third tetrahedron vertex, and a fourth tetrahedron vertex; the third coordinate includes a third R coordinate value, a third G coordinate value, and a third B coordinate value; and according to the target tetrahedron, performing a second mapping process on the second coordinate to obtain the third coordinate, including: when the target tetrahedron is the first tetrahedron, determining that the second R coordinate value is the third R coordinate value, the second G coordinate value is the third G coordinate value, The target tetrahedron is the second tetrahedron, and the second G coordinate value is the third R coordinate value, the second R coordinate value is the third G coordinate value, the second B coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the second cube vertex is the second tetrahedron vertex, the sixth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex; when the target tetrahedron is the second tetrahedron, the second G coordinate value is the third R coordinate value, the second R coordinate value is the third G coordinate value, the second B coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the second cube vertex is the second tetrahedron vertex, the fourth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex. The cube vertex is the fourth tetrahedron vertex; when the target tetrahedron is the third tetrahedron, it is determined that the second B coordinate value is the third R coordinate value, the second R coordinate value is the third G coordinate value, the second G coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the third cube vertex is the second tetrahedron vertex, the fourth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex; when the target tetrahedron is the fourth tetrahedron, it is determined that the second B coordinate value is the third R coordinate value, the second G coordinate value is the third G coordinate value, the second R coordinate value is the third G coordinate value, and the second R coordinate value is the third B coordinate value. three B coordinate values, the first cube vertex is the first tetrahedron vertex, the second cube vertex is the second tetrahedron vertex, the sixth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex; when the target tetrahedron is the fifth tetrahedron, determining that the second G coordinate value is the third R coordinate value, the second B coordinate value is the third G coordinate value, the second R coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the fifth cube vertex is the second tetrahedron vertex, the seventh cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex;When the target tetrahedron is the sixth tetrahedron, the second R coordinate value is determined to be the third R coordinate value, the second B coordinate value is the third G coordinate value, the second G coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the third cube vertex is the second tetrahedron vertex, the seventh cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex.
[0012] Optionally, the third coordinate is interpolated according to the positions of the vertices of the target tetrahedron and the side length of the target cube to obtain the target mapping value of the target pixel point, including: calculating the initial mapping value F according to the formula F=[F0<<x+(F1-F0)×B3+(F2-F1)×R3+(F3-F2)×G3]>>x, wherein F0 is the first tetrahedron vertex, << is a left shift operator, x is the side length of the target cube, F1 is the second tetrahedron vertex, B3 is the third B coordinate value, F2 is the third tetrahedron vertex, R3 is the third R coordinate value, F3 is the fourth tetrahedron vertex, G3 is the third G coordinate value, and >> is a right shift operator; the initial mapping value is right-shifted by the predetermined number of bits to obtain the target mapping value.
[0013] According to another aspect of the present disclosure, a data mapping device based on a three-dimensional lookup table is provided, including: a first acquisition unit, configured to acquire an original grayscale value of a target pixel point and a color depth of the target pixel point, and shift the original grayscale value left by a predetermined number of bits to obtain a target grayscale value, wherein the original grayscale value and the target grayscale value are binary numbers, the predetermined number of bits is a positive integer, and the target grayscale value includes an R channel sub-grayscale value, a G channel sub-grayscale value, and a B channel sub-grayscale value; a first processing unit, configured to perform a first mapping process on the target grayscale value according to the predetermined number of bits and the color depth to obtain a mapped grayscale value, wherein the mapped grayscale value is a power of 2; a second acquisition unit, configured to establish a source cube containing the target pixel point, and acquire the position of the target pixel point in the source cube to obtain a first coordinate, wherein the length of the source cube corresponds to the R channel sub-grayscale value, and the length of the source cube corresponds to the R channel sub-grayscale value. The width of the cube corresponds to the B channel sub-grayscale value, and the height of the source cube corresponds to the G channel sub-grayscale value; the third acquisition unit is configured to perform expansion processing on the source cube to obtain a target cube, and obtain the position of the target pixel point in the target cube to obtain a second coordinate, wherein the side length of the target cube is equal to the maximum value of the length, width and height of the source cube; the second processing unit is configured to determine the target tetrahedron containing the second coordinate in the target cube according to the second coordinate, and perform a second mapping processing on the second coordinate according to the target tetrahedron to obtain a third coordinate, wherein the vertices of the target tetrahedron are any four of the vertices of the target cube; the third processing unit is configured to perform interpolation processing on the third coordinate according to the positions of the vertices of the target tetrahedron and the side length of the target cube to obtain the target mapping value of the target pixel point.
[0014] According to another aspect of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the methods described.
[0015] According to another aspect of the present disclosure, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute any one of the methods described above through the computer program.
[0016] Applying the technical solution disclosed in the present invention, first, the original grayscale value and the color depth of the target pixel are obtained, and the original grayscale value is shifted left by a predetermined number of bits to obtain the target grayscale value; the target grayscale value is subjected to a first mapping process to obtain a mapped grayscale value; then a source cube containing the target pixel is established, and the position of the target pixel in the source cube is obtained to obtain a first coordinate; the source cube is expanded to obtain a target cube, and the position of the target pixel in the target cube is obtained to obtain a second coordinate; then, based on the second coordinate, a target tetrahedron containing the second coordinate in the target cube is determined, and based on the target tetrahedron, a second mapping process is performed on the second coordinate to obtain a third coordinate; finally, the third coordinate is interpolated to obtain the target mapping value of the target pixel. By remapping the grayscale value to a power of 2, the data mapping accuracy of certain intervals that do not conform to the nth power of 2 can be improved. In addition, the tetrahedron interpolation algorithm is used, which can also improve the data mapping accuracy compared to the trilinear interpolation in the prior art, thereby solving the problem of low data mapping accuracy of the trilinear interpolation data mapping method in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which constitute part of the present disclosure, are intended to provide a further understanding of the present disclosure. The exemplary embodiments of the present disclosure and their descriptions are intended to explain the present disclosure and do not constitute an improper limitation of the present disclosure. In the accompanying drawings:
[0018] FIG1 shows a hardware structure block diagram of a mobile terminal for executing a data mapping method based on a three-dimensional lookup table according to an embodiment of the present disclosure;
[0019] FIG2 shows a flow chart of a data mapping method based on a three-dimensional lookup table according to an embodiment of the present disclosure;
[0020] FIG3 shows a schematic structural diagram of a cube index provided in an embodiment of the present disclosure;
[0021] FIG4 shows a schematic structural diagram of an output node definition provided according to an embodiment of the present disclosure;
[0022] FIG5 shows a schematic structural diagram of a source cube provided in an embodiment of the present disclosure;
[0023] FIG6 shows a schematic structural diagram of a target cube provided according to an embodiment of the present disclosure;
[0024] FIG7 shows a schematic structural diagram of a tetrahedron search according to an embodiment of the present disclosure;
[0025] FIG8 shows a schematic structural diagram of tetrahedron mapping provided according to an embodiment of the present disclosure;
[0026] FIG9 shows a schematic diagram of a specific process of a data mapping method based on a three-dimensional lookup table according to an embodiment of the present disclosure;
[0027] FIG10 shows a structural block diagram of a data mapping device based on a three-dimensional lookup table according to an embodiment of the present disclosure.
[0028] The above drawings include the following reference numerals: 102, processor; 104, memory; 106, transmission device; 108, input / output device. DETAILED DESCRIPTION
[0029] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0030] In order to enable those skilled in the art to better understand the solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the embodiments described are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present disclosure.
[0031] It should be noted that the terms "first," "second," and the like in the specification and claims of the present disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate for the embodiments of the present disclosure described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or inherent to these processes, methods, products, or apparatus.
[0032] As introduced in the background technology, the data mapping method in the prior art has low data mapping accuracy. In order to solve the above technical problems, the embodiments of the present disclosure provide a data mapping method based on a three-dimensional lookup table, a data mapping device based on a three-dimensional lookup table, a computer-readable storage medium and an electronic device.
[0033] The technical solutions in the embodiments of the present invention will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present invention.
[0034] The method embodiments provided in the embodiments of the present disclosure can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, FIG1 is a hardware structure block diagram of a mobile terminal of a data mapping method based on a three-dimensional lookup table according to an embodiment of the present invention. As shown in FIG1 , the mobile terminal may include one or more (only one is shown in FIG1 ) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 configured to store data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 configured for a communication function. It will be understood by those skilled in the art that the structure shown in FIG1 is only for illustration and does not limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than those shown in FIG1 , or have a configuration different from that shown in FIG1 .
[0035] The memory 104 can be configured to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data mapping method based on the three-dimensional lookup table in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned networks include but are not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is configured to receive or send data via a network. Specific examples of the above-mentioned networks may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, abbreviated as NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module configured to communicate with the Internet wirelessly.
[0036] In this embodiment, a data mapping method based on a three-dimensional lookup table is provided that runs on a mobile terminal, a computer terminal or a similar computing device. 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.
[0037] FIG2 is a flow chart of a data mapping method based on a three-dimensional lookup table according to an embodiment of the present disclosure. As shown in FIG2 , the method includes the following steps:
[0038] Step S201, obtaining an original grayscale value of a target pixel and a color depth of the target pixel, and shifting the original grayscale value left by a predetermined number of bits to obtain a target grayscale value, wherein the original grayscale value and the target grayscale value are binary numbers, the predetermined number of bits is a positive integer, and the target grayscale value includes an R channel sub-grayscale value, a G channel sub-grayscale value, and a B channel sub-grayscale value;
[0039] Specifically, a pixel is the smallest unit of an image. Each pixel has a grayscale value, which is an integer between 0 and 255, representing the brightness or color depth of the pixel. Each pixel has a corresponding RGB value, which is composed of the grayscale values of the red, green, and blue channels, representing the color of the pixel. Color depth refers to the color depth of each pixel in the image, that is, the number of colors that each pixel can represent. Color depth is usually expressed in bits. For example, 8-bit color depth means that each pixel can represent 2 8 =256 colors.
[0040] Step S202, performing a first mapping process on the target grayscale value according to the predetermined number of bits and the color depth to obtain a mapped grayscale value, wherein the mapped grayscale value is a power of 2;
[0041] Specifically, the pixel value calculation formula of pixel point p is: Among them, p0 and p1 are the pixel values of two pixel points adjacent to pixel point p, x is the horizontal coordinate value of pixel point p, x0 is the horizontal coordinate value of p1, and x1 is the horizontal coordinate value of p0. Since the calculation process of the above pixel point p involves division, the implementation of division in the hardware circuit consumes too many resources, and a shift operation will be used instead. Therefore, the value of x1-x0 must satisfy the power of 2 to ensure the calculation accuracy. However, in actual applications, the range of grayscale values is 0~2k-1, and there is at least one x1-x0 that does not satisfy the power of 2. Therefore, remapping the above value that does not satisfy the power of 2 to the power of 2, that is, the above first mapping process, can further improve the accuracy.
[0042] Step S203: Create a source cube containing the target pixel point, and obtain the position of the target pixel point in the source cube to obtain a first coordinate, wherein the length of the source cube corresponds to the R channel sub-grayscale value, the width of the source cube corresponds to the B channel sub-grayscale value, and the height of the source cube corresponds to the G channel sub-grayscale value;
[0043] Specifically, the source cube is a cube structure formed by the data source space. The source space in data mapping refers to the original data set for data mapping, that is, the source of the data to be processed and transformed by data mapping. The source space can be any space containing data. Data mapping extracts data from the source space and maps it to the target space to achieve data transformation and integration. The data in the source space may come from different data sources, and the task of data mapping is to integrate and transform the data from these different source spaces into the format and structure required by the target space.
[0044] Step S204: Expand the source cube to obtain a target cube, and obtain the position of the target pixel in the target cube to obtain a second coordinate, wherein the side length of the target cube is equal to the maximum of the length, width, and height of the source cube;
[0045] Specifically, since the mapped grayscale value after the first mapping processing satisfies the power of 2, the node intervals between each pixel point can be set at non-uniform intervals. Therefore, any target pixel point may fall in a rectangular block with uncertain three-sided sizes. The interpolation formulas used in different rectangular blocks will be different, which is not conducive to hardware implementation. By mapping the relative positions of target points P in different rectangular blocks to the relative positions in the cube, the interpolation formulas can be shared, thereby reducing hardware overhead.
[0046] Step S205: determining a target tetrahedron in the target cube containing the second coordinates based on the second coordinates, and performing a second mapping process on the second coordinates based on the target tetrahedron to obtain a third coordinate, wherein the vertices of the target tetrahedron are any four of the vertices of the target cube;
[0047] Specifically, the above-mentioned second mapping process is a tetrahedron mapping, which is a method of mapping a point in a three-dimensional space to another three-dimensional space. The specific steps are as follows: Determine the vertices of the original tetrahedron: first determine the vertex coordinates of the original tetrahedron, usually expressed as coordinates A, B, C and D; Determine the vertices of the target tetrahedron: then determine the vertex coordinates of the target tetrahedron, usually expressed as coordinates A', B', C' and D'; Based on the vertex coordinates of the original tetrahedron and the target tetrahedron, determine the mapping relationship between them. This can be achieved through a linear transformation matrix, affine transformation or other mathematical methods; apply the mapping relationship to each point in the original tetrahedron to obtain the corresponding point coordinates in the target tetrahedron; finally, the correctness of the mapping can be verified to ensure that the points in the original tetrahedron can be correctly mapped to the corresponding points in the target tetrahedron after mapping.
[0048] Step S206 , interpolating the third coordinate according to the positions of the vertices of the target tetrahedron and the side length of the target cube to obtain a target mapping value of the target pixel.
[0049] Specifically, the interpolation process may be a three-dimensional lookup table interpolation algorithm, which is an algorithm for interpolation in three-dimensional space. A three-dimensional lookup table is constructed to store known data points, and the values of unknown points are calculated by interpolating these data points.
[0050] According to this embodiment, first, the original grayscale value and color depth of the target pixel are obtained, and the original grayscale value is shifted left by a predetermined number of bits to obtain the target grayscale value; a first mapping process is performed on the target grayscale value to obtain a mapped grayscale value; a source cube containing the target pixel is established, and the position of the target pixel in the source cube is obtained to obtain a first coordinate; the source cube is expanded to obtain a target cube, and the position of the target pixel in the target cube is obtained to obtain a second coordinate; then, based on the second coordinate, a target tetrahedron containing the second coordinate in the target cube is determined, and based on the target tetrahedron, a second mapping process is performed on the second coordinate to obtain a third coordinate; finally, an interpolation process is performed on the third coordinate to obtain the target mapping value of the target pixel. By remapping the grayscale value to a power of 2, the data mapping accuracy of certain intervals that do not conform to the power of 2 can be improved. In addition, the use of a tetrahedral interpolation algorithm can also improve the data mapping accuracy compared to the trilinear interpolation in the prior art, thereby solving the problem of low data mapping accuracy of the trilinear interpolation data mapping method in the prior art.
[0051] In the specific implementation process, the above step S202 can be implemented by the following steps: Step S2021, the above target grayscale value (2 n -1)×2 m Perform the first mapping process to obtain the above-mentioned mapping grayscale value 2 m+n , where m is the predetermined number of bits and n is the color depth. This method can further quickly implement the first mapping process.
[0052] Specifically, the first mapping process can determine the grayscale of the input in sequence by setting a threshold value to achieve correction of the grayscale value. m Thresholds are used to judge the input grayscale in turn and correct the output grayscale. If the input grayscale is greater than or equal to the threshold 0, the output grayscale is the input grayscale plus 2. m Otherwise, if the input grayscale is greater than or equal to the threshold 1, the output grayscale is the input grayscale plus 2 m -1, otherwise, if the input grayscale is greater than or equal to the threshold 2, the output grayscale is the input grayscale plus 2 m-2, otherwise, if the input grayscale is greater than or equal to the threshold 3, the output grayscale is the input grayscale plus 2 m -3, and so on, if the input grayscale is greater than or equal to the threshold 2 m -1, the output grayscale is the input grayscale plus 1, otherwise, the output grayscale is equal to the input grayscale.
[0053] In order to further quickly locate the position of the target pixel point in the source cube, the above-mentioned step S203 of the present disclosure can be implemented by the following steps: step S2031, taking any point around the above-mentioned target pixel point as the first origin, establishing the above-mentioned source cube containing the above-mentioned target pixel point; step S2032, determining the relative coordinates of the above-mentioned target pixel point with respect to the above-mentioned first origin as the above-mentioned first coordinates.
[0054] Specifically, the process of determining the first coordinate is as follows: First, as shown in FIG3 , a source cube is established, and the cube index containing the input RGB grayscale is searched, and the eight points of the source cube are obtained as follows: (R_idx, G_idx, B_idx), (R_idx, G_idx, B_idx+1), (R_idx+1, G_idx, B_idx), (R_idx+1, G_idx, B_idx+1), (R_idx, G_idx+1, B_idx+1), (R_idx, G_idx+1, B_idx+1), (R_idx, G_idx+1, B_idx+1), (R_idx, G_idx idx+1, B_idx), (R_idx+1, G_idx+1, B_idx) and (R_idx+1, G_idx+1, B_idx+1); then, as shown in Figure 4, define the output nodes as: A010, A110, A011, A111, A000, A100, A001, A101; finally, calculate the relative coordinates of RGB in the cube ΔR=R-A000_R, ΔG=G-A000_G, ΔB=B-A000_B to obtain the above-mentioned first coordinates.
[0055] The first coordinates include a first R coordinate value, a first G coordinate value, and a first B coordinate value, and the second coordinates include a second R coordinate value, a second G coordinate value, and a second B coordinate value. Step S204 can also be implemented in other ways, for example: Step S2041, according to the formula R2=R1<<(xa), calculate the second R coordinate value R2, where R1 is the first R coordinate value, << is a left shift operator, x is the side length of the target cube, and a is the length of the source cube; Step S2042, according to the formula G2=G1<<(xb), calculate the second G coordinate value G2, where G1 is the first G coordinate value and b is the height of the source cube; Step S2043, according to the formula B2=B1<<(xc), calculate the second B coordinate value B2, where B1 is the first B coordinate value and c is the width of the source cube. This method can further quickly obtain the second coordinates.
[0056] Specifically, as shown in Figure 5, the target pixel point P may fall within a cuboid with three sides of uncertain size. Based on x = MAX(a, b, c), the cube is stretched into a cube with the longest side, resulting in the target cube shown in Figure 6. Furthermore, setting nodes at unequal intervals is more consistent with human perception. The human eye is nonlinearly sensitive to brightness changes, and this nonlinearity is more pronounced at low grayscales. Therefore, more nodes are required at low grayscales. At high grayscales, brightness perception is more linear, so fewer nodes can be used at high grayscales.
[0057] In some embodiments, the second coordinate includes a second R coordinate value, a second G coordinate value, and a second B coordinate value, and the target tetrahedron includes a first tetrahedron, a second tetrahedron, a third tetrahedron, a fourth tetrahedron, a fifth tetrahedron, and a sixth tetrahedron. The step S205 can be specifically implemented by the following steps: step S2051, determining whether the second coordinate satisfies the second B coordinate value greater than or equal to the second R coordinate value and the second R coordinate value greater than or equal to the second G coordinate value; and if the second coordinate satisfies the second B coordinate value greater than or equal to the second R coordinate value and the second G coordinate value, In the case where the second coordinate value is greater than or equal to the second G coordinate value, the first tetrahedron is determined to be the target tetrahedron; in step S2052, if the second coordinate does not satisfy that the second B coordinate value is greater than or equal to the second R coordinate value or the second R coordinate value is greater than or equal to the second G coordinate value, the first tetrahedron is determined to be the target tetrahedron; in the case where ... satisfies that the second B coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second R coordinate value, the first tetrahedron is determined to be the target tetrahedron; In the case of the second coordinate value, the second tetrahedron is determined to be the target tetrahedron; in step S2053, if the second coordinate does not satisfy that the second B coordinate value is greater than or equal to the second G coordinate value or the second G coordinate value is greater than or equal to the second R coordinate value, it is determined whether the second coordinate satisfies that the second G coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second R coordinate value; if the second coordinate satisfies that the second G coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second R coordinate value, the second tetrahedron is determined to be the target tetrahedron. The third tetrahedron is the target tetrahedron; in step S2054, if the second coordinates do not satisfy the condition that the second G coordinate value is greater than or equal to the second B coordinate value or the second B coordinate value is greater than or equal to the second R coordinate value, determining whether the second coordinates satisfy the condition that the second R coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second G coordinate value; if the second coordinates satisfy the condition that the second R coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second G coordinate value, determining the fourth tetrahedron as the target tetrahedron;Step S2055: If the second coordinate does not satisfy the conditions that the second R coordinate value is greater than or equal to the second B coordinate value or the second B coordinate value is greater than or equal to the second G coordinate value, determine whether the second coordinate satisfies the conditions that the second R coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second B coordinate value. If the second coordinate satisfies the conditions that the second R coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second B coordinate value, determine the fifth tetrahedron as the target tetrahedron. Step S2056: If the second coordinate does not satisfy the conditions that the second R coordinate value is greater than or equal to the second G coordinate value or the second G coordinate value is greater than or equal to the second B coordinate value, determine the sixth tetrahedron as the target tetrahedron. This method can further quickly implement tetrahedron search.
[0058] Specifically, as shown in FIG7 , t1 is the first tetrahedron, t2 is the second tetrahedron, t3 is the third tetrahedron, t4 is the fourth tetrahedron, t5 is the fifth tetrahedron, and t6 is the sixth tetrahedron.
[0059] The target cube includes a first cube vertex, a second cube vertex, a third cube vertex, a fourth cube vertex, a fifth cube vertex, a sixth cube vertex, a seventh cube vertex and an eighth cube vertex, the target tetrahedron includes a first tetrahedron vertex, a second tetrahedron vertex, a third tetrahedron vertex and a fourth tetrahedron vertex, the third coordinate includes a third R coordinate value, a third G coordinate value and a third B coordinate value, and the step S205 further includes: step S2056, in the case that the target tetrahedron is the first tetrahedron, determining that the second R coordinate value is the third R coordinate value, the second G coordinate value is the third G coordinate value, the second B coordinate value is the third B coordinate value, the third The first cube vertex is the vertex of the first tetrahedron, the second cube vertex is the vertex of the second tetrahedron, the sixth cube vertex is the vertex of the third tetrahedron, and the eighth cube vertex is the vertex of the fourth tetrahedron; step S2057, when the target tetrahedron is the second tetrahedron, determine that the second G coordinate value is the third R coordinate value, the second R coordinate value is the third G coordinate value, the second B coordinate value is the third B coordinate value, the first cube vertex is the vertex of the first tetrahedron, the second cube vertex is the vertex of the second tetrahedron, the fourth cube vertex is the vertex of the third tetrahedron, and the eighth cube vertex is the vertex of the fourth tetrahedron; step S2 058, in the case that the above-mentioned target tetrahedron is the above-mentioned third tetrahedron, determine that the above-mentioned second B coordinate value is the above-mentioned third R coordinate value, the above-mentioned second R coordinate value is the above-mentioned third G coordinate value, the above-mentioned second G coordinate value is the above-mentioned third B coordinate value, the above-mentioned first cube vertex is the above-mentioned first tetrahedron vertex, the above-mentioned third cube vertex is the above-mentioned second tetrahedron vertex, the above-mentioned fourth cube vertex is the above-mentioned third tetrahedron vertex, and the above-mentioned eighth cube vertex is the above-mentioned fourth tetrahedron vertex; step S2059, in the case that the above-mentioned target tetrahedron is the above-mentioned fourth tetrahedron, determine that the above-mentioned second B coordinate value is the above-mentioned third R coordinate value, the above-mentioned second G coordinate value is the above-mentioned third G coordinate value, the above-mentioned second R coordinate value is the above-mentioned third B coordinate value, The first cube vertex is a vertex of the first tetrahedron, the second cube vertex is a vertex of the second tetrahedron, the sixth cube vertex is a vertex of the third tetrahedron, and the eighth cube vertex is a vertex of the fourth tetrahedron; in step S20510, when the target tetrahedron is the fifth tetrahedron, determining that the second G coordinate value is the third R coordinate value, the second B coordinate value is the third G coordinate value, the second R coordinate value is the third B coordinate value, the first cube vertex is a vertex of the first tetrahedron, the fifth cube vertex is a vertex of the second tetrahedron, the seventh cube vertex is a vertex of the third tetrahedron, and the eighth cube vertex is a vertex of the fourth tetrahedron;Step S20511: When the target tetrahedron is the sixth tetrahedron, the second R coordinate value is determined to be the third R coordinate value, the second B coordinate value is the third G coordinate value, the second G coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the third cube vertex is the second tetrahedron vertex, the seventh cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex. This method can further quickly implement tetrahedron mapping.
[0060] Specifically, as shown in Figure 8, t1 is the above-mentioned first tetrahedron, P0 is the vertex of the first tetrahedron, that is, the vertex of the first cube, P1 is the vertex of the second tetrahedron, that is, the vertex of the second cube, P2 is the vertex of the third tetrahedron, that is, the vertex of the sixth cube, and P3 is the vertex of the fourth tetrahedron, that is, the vertex of the eighth cube; t2 is the above-mentioned second tetrahedron, P0 is the vertex of the first tetrahedron, that is, the vertex of the first cube, P1 is the vertex of the second tetrahedron, that is, the vertex of the second cube, P2 is the vertex of the third tetrahedron, that is, the vertex of the fourth cube, and P3 is the vertex of the fourth tetrahedron, that is, the vertex of the eighth cube; t3 is the above-mentioned third tetrahedron, P0 is the vertex of the first tetrahedron, that is, the vertex of the first cube, P1 is the vertex of the second tetrahedron, that is, the vertex of the third cube, P2 is the vertex of the third tetrahedron, that is, the vertex of the fourth cube, and P3 is the vertex of the fourth tetrahedron, that is, the vertex of the eighth cube body vertex; t4 is the fourth tetrahedron mentioned above, P0 is the first tetrahedron vertex, that is, the first cube vertex, P1 is the second tetrahedron vertex, that is, the second cube vertex, P2 is the third tetrahedron vertex, that is, the sixth cube vertex, and P3 is the fourth tetrahedron vertex, that is, the eighth cube vertex; t5 is the fifth tetrahedron mentioned above, P0 is the first tetrahedron vertex, that is, the first cube vertex, P1 is the second tetrahedron vertex, that is, the fifth cube vertex, P2 is the third tetrahedron vertex, that is, the seventh cube vertex, and P3 is the fourth tetrahedron vertex, that is, the eighth cube vertex; t6 is the sixth tetrahedron mentioned above, P0 is the first tetrahedron vertex, that is, the first cube vertex, P1 is the second tetrahedron vertex, that is, the third cube vertex, P2 is the third tetrahedron vertex, that is, the seventh cube vertex, and P3 is the fourth tetrahedron vertex, that is, the eighth cube vertex.
[0061] The above-mentioned step S206 can be implemented by the following steps: Step S2061, according to the formula F = [F0<<x+(F1-F0)×B3+(F2-F1)×R3+(F3-F2)×G3]>>x, calculate the initial mapping value F, where F0 is the first tetrahedron vertex, << is the left shift operator, x is the side length of the above-mentioned target cube, F1 is the second tetrahedron vertex, B3 is the third B coordinate value, F2 is the third tetrahedron vertex, R3 is the third R coordinate value, F3 is the fourth tetrahedron vertex, G3 is the third G coordinate value, and >> is the right shift operator; Step S2062, right-shift the above-mentioned initial mapping value by the above-mentioned predetermined number of bits to obtain the above-mentioned target mapping value. In this method, since the formula for calculating the initial mapping value only requires 3 multipliers and 4 adders, compared with the existing technology, the consumption of multipliers is much greater than that of adders, which can further reduce the hardware overhead of data mapping calculation.
[0062] Specifically, the above calculation formula can be derived by the following equation: as well as
[0063] In order to enable those skilled in the art to more clearly understand the technical solution of the present disclosure, the implementation process of the data mapping method based on the three-dimensional lookup table of the present disclosure will be described in detail below with reference to specific embodiments.
[0064] This embodiment relates to a specific data mapping method based on a three-dimensional lookup table, as shown in FIG9 , including the following steps:
[0065] Step S1: input grayscale;
[0066] Step S2: grayscale is shifted left by m bits;
[0067] Step S3: Grayscale mapping, set 2 in grayscale mapping m Thresholds are used to judge the input grayscale in turn and correct the output grayscale. If the input grayscale is greater than or equal to the threshold 0, the output grayscale is the input grayscale plus 2. m Otherwise, if the input grayscale is greater than or equal to the threshold 1, the output grayscale is the input grayscale plus 2 m -1, otherwise, if the input grayscale is greater than or equal to the threshold 2, the output grayscale is the input grayscale plus 2 m -2, otherwise, if the input grayscale is greater than or equal to the threshold 3, the output grayscale is the input grayscale plus 2 m -3, and so on, if the input grayscale is greater than or equal to the threshold 2 m -1, the output grayscale is the input grayscale plus 1, otherwise, the output grayscale is equal to the input grayscale;
[0068] Step S4: index search;
[0069] Step S5: cube mapping;
[0070] Step S6: tetrahedron search;
[0071] Step S7: tetrahedron mapping;
[0072] Step S8: interpolation;
[0073] Step S9: After right shifting by m bits, the target mapping value is output.
[0074] The embodiments of the present disclosure also provide a data mapping device based on a three-dimensional lookup table. It should be noted that the data mapping device based on a three-dimensional lookup table in the embodiments of the present disclosure can be configured to execute the data mapping method provided by the embodiments of the present disclosure, which is configured to be based on a three-dimensional lookup table. The device is configured to implement the above-mentioned embodiments and preferred implementation modes, and those that have been explained will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and conceivable.
[0075] The following introduces a data mapping device based on a three-dimensional lookup table provided in an embodiment of the present disclosure.
[0076] FIG10 is a schematic diagram of a data mapping device based on a three-dimensional lookup table according to an embodiment of the present disclosure. As shown in FIG10 , the device includes:
[0077] The first acquisition unit 10 is configured to acquire an original grayscale value of a target pixel and a color depth of the target pixel, and shift the original grayscale value left by a predetermined number of bits to obtain a target grayscale value, wherein the original grayscale value and the target grayscale value are binary numbers, the predetermined number of bits is a positive integer, and the target grayscale value includes an R channel sub-grayscale value, a G channel sub-grayscale value, and a B channel sub-grayscale value;
[0078] Specifically, a pixel is the smallest unit of an image. Each pixel has a grayscale value, which is an integer between 0 and 255, representing the brightness or color depth of the pixel. Each pixel has a corresponding RGB value, which is composed of the grayscale values of the red, green, and blue channels, representing the color of the pixel. Color depth refers to the color depth of each pixel in the image, that is, the number of colors that each pixel can represent. Color depth is usually expressed in bits. For example, 8-bit color depth means that each pixel can represent 2 8 =256 colors.
[0079] The first processing unit 20 is configured to perform a first mapping process on the target grayscale value according to the predetermined number of bits and the color depth to obtain a mapped grayscale value, wherein the mapped grayscale value is a power of 2;
[0080] Specifically, the pixel value calculation formula of pixel point p is: Among them, p0 and p1 are the pixel values of two pixel points adjacent to pixel point p, x is the horizontal coordinate value of pixel point p, x0 is the horizontal coordinate value of p1, and x1 is the horizontal coordinate value of p0. Since the calculation process of the above pixel point p involves division, the implementation of division in the hardware circuit consumes too many resources, and a shift operation will be used instead. Therefore, the value of x1-x0 must meet the power of 2 to ensure the calculation accuracy. However, in actual applications, the range of grayscale values is 0~2k-1, and there is at least one x1-x0 that does not meet the power of 2. Therefore, remapping the above value that does not meet the power of 2 to the power of 2, that is, the above first mapping process, can further improve the accuracy.
[0081] The second acquisition unit 30 is configured to establish a source cube containing the target pixel point, and acquire a position of the target pixel point in the source cube to obtain a first coordinate, wherein the length of the source cube corresponds to the R channel sub-grayscale value, the width of the source cube corresponds to the B channel sub-grayscale value, and the height of the source cube corresponds to the G channel sub-grayscale value;
[0082] Specifically, the source cube is a cube structure formed by the data source space. The source space in data mapping refers to the original data set for data mapping, that is, the source of the data to be processed and transformed by data mapping. The source space can be any space containing data. Data mapping extracts data from the source space and maps it to the target space to achieve data transformation and integration. The data in the source space may come from different data sources, and the task of data mapping is to integrate and transform the data from these different source spaces into the format and structure required by the target space.
[0083] a third acquiring unit 40 configured to expand the source cube to obtain a target cube, and acquire a position of the target pixel in the target cube to obtain a second coordinate, wherein the side length of the target cube is equal to the maximum of the length, width, and height of the source cube;
[0084] Specifically, since the mapped grayscale value after the first mapping processing satisfies the power of 2, the node intervals between each pixel point can be set at non-uniform intervals. Therefore, any target pixel point may fall in a rectangular block with uncertain three-sided sizes. The interpolation formulas used in different rectangular blocks will be different, which is not conducive to hardware implementation. By mapping the relative positions of target points P in different rectangular blocks to the relative positions in the cube, the interpolation formulas can be shared, thereby reducing hardware overhead.
[0085] The second processing unit 50 is configured to determine, based on the second coordinates, a target tetrahedron in the target cube containing the second coordinates, and perform a second mapping process on the second coordinates based on the target tetrahedron to obtain a third coordinate, wherein the vertices of the target tetrahedron are any four of the vertices of the target cube;
[0086] Specifically, the above-mentioned second mapping process is a tetrahedron mapping, which is a method of mapping a point in a three-dimensional space to another three-dimensional space. The specific steps are as follows: Determine the vertices of the original tetrahedron: first determine the vertex coordinates of the original tetrahedron, usually expressed as coordinates A, B, C and D; Determine the vertices of the target tetrahedron: then determine the vertex coordinates of the target tetrahedron, usually expressed as coordinates A', B', C' and D'; Based on the vertex coordinates of the original tetrahedron and the target tetrahedron, determine the mapping relationship between them. This can be achieved through a linear transformation matrix, affine transformation or other mathematical methods; apply the mapping relationship to each point in the original tetrahedron to obtain the corresponding point coordinates in the target tetrahedron; finally, the correctness of the mapping can be verified to ensure that the points in the original tetrahedron can be correctly mapped to the corresponding points in the target tetrahedron after mapping.
[0087] The third processing unit 60 is configured to perform interpolation processing on the third coordinate according to the positions of the vertices of the target tetrahedron and the side length of the target cube to obtain the target mapping value of the target pixel point.
[0088] Specifically, the interpolation process may be a three-dimensional lookup table interpolation algorithm, which is an algorithm for interpolation in three-dimensional space. A three-dimensional lookup table is constructed to store known data points, and the values of unknown points are calculated by interpolating these data points.
[0089] Through this embodiment, the first acquisition unit acquires the original grayscale value and the color depth of the target pixel point, and shifts the original grayscale value left by a predetermined number of bits to obtain the target grayscale value; the first processing unit performs a first mapping process on the target grayscale value to obtain a mapped grayscale value; the second acquisition unit establishes a source cube containing the target pixel point, and acquires the position of the target pixel point in the source cube to obtain a first coordinate; the third acquisition unit performs an expansion process on the source cube to obtain a target cube, and acquires the position of the target pixel point in the target cube to obtain a second coordinate; the second processing unit determines a target tetrahedron containing the second coordinate in the target cube based on the second coordinate, and performs a second mapping process on the second coordinate based on the target tetrahedron to obtain a third coordinate; the third processing unit performs an interpolation process on the third coordinate to obtain a target mapping value of the target pixel point. By remapping the grayscale values to powers of 2, the data mapping accuracy of certain intervals that do not conform to the power of 2 can be improved. In addition, the tetrahedral interpolation algorithm can also improve the data mapping accuracy compared to the trilinear interpolation in the existing technology, solving the problem of low data mapping accuracy of the trilinear interpolation data mapping method in the existing technology.
[0090] In a specific implementation process, the first processing unit includes a first processing module configured to process the target grayscale value (2 n -1)×2 m Perform the first mapping process to obtain the above-mentioned mapping grayscale value 2 m+n , where m is the predetermined number of bits and n is the color depth. This method can further quickly implement the first mapping process.
[0091] Specifically, the first mapping process can determine the grayscale of the input in sequence by setting a threshold value to achieve correction of the grayscale value. m Thresholds are used to judge the input grayscale in turn and correct the output grayscale. If the input grayscale is greater than or equal to the threshold 0, the output grayscale is the input grayscale plus 2. m Otherwise, if the input grayscale is greater than or equal to the threshold 1, the output grayscale is the input grayscale plus 2 m -1, otherwise, if the input grayscale is greater than or equal to the threshold 2, the output grayscale is the input grayscale plus 2 m -2, otherwise, if the input grayscale is greater than or equal to the threshold 3, the output grayscale is the input grayscale plus 2 m -3, and so on, if the input grayscale is greater than or equal to the threshold 2 m -1, the output grayscale is the input grayscale plus 1, otherwise, the output grayscale is equal to the input grayscale.
[0092] In order to further quickly locate the position of the target pixel point in the source cube, the above-mentioned second acquisition unit of the present disclosure includes an establishment module and a first determination module, wherein the establishment module is configured to establish the above-mentioned source cube containing the above-mentioned target pixel point with any point around the above-mentioned target pixel point as the first origin; the first determination module is configured to determine the relative coordinates of the above-mentioned target pixel point with respect to the above-mentioned first origin as the above-mentioned first coordinates.
[0093] Specifically, the process of determining the first coordinate is as follows: First, as shown in FIG3 , a source cube is established, and the cube index containing the input RGB grayscale is searched, and the eight points of the source cube are obtained as follows: (R_idx, G_idx, B_idx), (R_idx, G_idx, B_idx+1), (R_idx+1, G_idx, B_idx), (R_idx+1, G_idx, B_idx+1), (R_idx, G_idx+1, B_idx+1), (R_idx, G_idx+1, B_idx+1), (R_idx, G_idx+1, B_idx+1), (R_idx, G_idx idx+1, B_idx), (R_idx+1, G_idx+1, B_idx) and (R_idx+1, G_idx+1, B_idx+1); then, as shown in Figure 4, define the output nodes as: A010, A110, A011, A111, A000, A100, A001, A101; finally, calculate the relative coordinates of RGB in the cube ΔR=R-A000_R, ΔG=G-A000_G, ΔB=B-A000_B to obtain the above-mentioned first coordinates.
[0094] The first coordinate includes a first R coordinate value, a first G coordinate value, and a first B coordinate value; the second coordinate includes a second R coordinate value, a second G coordinate value, and a second B coordinate value; the third acquisition unit includes a first calculation module, a second calculation module, and a third calculation module, wherein the first calculation module is configured to calculate the second R coordinate value R2 according to the formula R2=R1<<(xa), wherein R1 is the first R coordinate value, << is a left shift operator, x is the side length of the target cube, and a is the length of the source cube; the second calculation module is configured to calculate the second G coordinate value G2 according to the formula G2=G1<<(xb), wherein G1 is the first G coordinate value and b is the height of the source cube; the third calculation module is configured to calculate the second B coordinate value B2 according to the formula B2=B1<<(xc), wherein B1 is the first B coordinate value and c is the width of the source cube. The device can further quickly acquire the second coordinate.
[0095] Specifically, as shown in Figure 5, the target pixel point P may fall within a cuboid with three sides of uncertain size. Based on x = MAX(a, b, c), the cube is stretched into a cube with the longest side, resulting in the target cube shown in Figure 6. Furthermore, setting nodes at unequal intervals is more consistent with human perception. The human eye is nonlinearly sensitive to brightness changes, and this nonlinearity is more pronounced at low grayscales. Therefore, more nodes are required at low grayscales. At high grayscales, brightness perception is more linear, so fewer nodes can be used at high grayscales.
[0096] In some embodiments, the second coordinate includes a second R coordinate value, a second G coordinate value, and a second B coordinate value, the target tetrahedron includes a first tetrahedron, a second tetrahedron, a third tetrahedron, a fourth tetrahedron, a fifth tetrahedron, and a sixth tetrahedron, and the second processing unit includes a second determination module, a third determination module, a fourth determination module, a fifth determination module, a sixth determination module, and a seventh determination module, wherein the second determination module is configured to determine whether the second coordinate satisfies the conditions that the second B coordinate value is greater than or equal to the second R coordinate value and the second R coordinate value is greater than or equal to the second G coordinate value. When the second coordinate satisfies the above conditions, When the second B coordinate value is greater than or equal to the second R coordinate value and the second R coordinate value is greater than or equal to the second G coordinate value, the first tetrahedron is determined to be the target tetrahedron; the third determining module is configured to, when the second coordinate does not satisfy the second B coordinate value is greater than or equal to the second R coordinate value or the second R coordinate value is greater than or equal to the second G coordinate value, determine whether the second coordinate satisfies the second B coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second R coordinate value, and when the second coordinate satisfies the second B coordinate value is greater than or equal to the second G coordinate value and the second R coordinate value, determine whether the second coordinate satisfies the second B coordinate value is greater than or equal to the second G coordinate value and the second R coordinate value. When the second G coordinate value is greater than or equal to the second R coordinate value, the second tetrahedron is determined to be the target tetrahedron; the fourth determining module is configured to, when the second coordinate does not satisfy the second B coordinate value is greater than or equal to the second G coordinate value or the second G coordinate value is greater than or equal to the second R coordinate value, determine whether the second coordinate satisfies the second G coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second R coordinate value, and when the second coordinate satisfies the second G coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second R coordinate value. the third tetrahedron is determined as the target tetrahedron; the fifth determining module is configured to, if the second coordinates do not satisfy the conditions that the second G coordinate value is greater than or equal to the second B coordinate value or the second B coordinate value is greater than or equal to the second R coordinate value, determine whether the second coordinates satisfy the conditions that the second R coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second G coordinate value; and if the second coordinates satisfy the conditions that the second R coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second G coordinate value, determine the fourth tetrahedron as the target tetrahedron;The sixth determination module is configured to, if the second coordinate does not satisfy the conditions that the second R coordinate value is greater than or equal to the second B coordinate value or the second B coordinate value is greater than or equal to the second G coordinate value, determine whether the second coordinate satisfies the conditions that the second R coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second B coordinate value, and if the second coordinate satisfies the conditions that the second R coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second B coordinate value, determine the fifth tetrahedron as the target tetrahedron. The seventh determination module is configured to, if the second coordinate does not satisfy the conditions that the second R coordinate value is greater than or equal to the second G coordinate value or the second G coordinate value is greater than or equal to the second B coordinate value, determine the sixth tetrahedron as the target tetrahedron. This device can further quickly implement tetrahedron search.
[0097] Specifically, as shown in FIG7 , t1 is the first tetrahedron, t2 is the second tetrahedron, t3 is the third tetrahedron, t4 is the fourth tetrahedron, t5 is the fifth tetrahedron, and t6 is the sixth tetrahedron.
[0098] The target cube includes a first cube vertex, a second cube vertex, a third cube vertex, a fourth cube vertex, a fifth cube vertex, a sixth cube vertex, a seventh cube vertex, and an eighth cube vertex; the target tetrahedron includes a first tetrahedron vertex, a second tetrahedron vertex, a third tetrahedron vertex, and a fourth tetrahedron vertex; the third coordinate includes a third R coordinate value, a third G coordinate value, and a third B coordinate value; the second processing unit further includes an eighth determining module, a ninth determining module, a tenth determining module, an eleventh determining module, a twelfth determining module, and a thirteenth determining module; wherein the eighth determining module is configured to determine the value of the first tetrahedron vertex, the second tetrahedron vertex, the third tetrahedron vertex, and the fourth tetrahedron vertex; When the target tetrahedron is the first tetrahedron, the second R coordinate value is determined to be the third R coordinate value, the second G coordinate value is the third G coordinate value, the second B coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the second cube vertex is the second tetrahedron vertex, the sixth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex; the ninth determining module is configured to determine, when the target tetrahedron is the second tetrahedron, that the second G coordinate value is the third R coordinate value, the second R coordinate value is the third G coordinate value, the second B coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the second cube vertex is the second tetrahedron vertex, the sixth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex. G coordinate value, the above-mentioned second B coordinate value is the above-mentioned third B coordinate value, the above-mentioned first cube vertex is the above-mentioned first tetrahedron vertex, the above-mentioned second cube vertex is the above-mentioned second tetrahedron vertex, the above-mentioned fourth cube vertex is the above-mentioned third tetrahedron vertex, and the above-mentioned eighth cube vertex is the above-mentioned fourth tetrahedron vertex; the tenth determination module is configured to, when the above-mentioned target tetrahedron is the above-mentioned third tetrahedron, determine that the above-mentioned second B coordinate value is the above-mentioned third R coordinate value, the above-mentioned second R coordinate value is the above-mentioned third G coordinate value, the above-mentioned second G coordinate value is the above-mentioned third B coordinate value, the above-mentioned first cube vertex is the above-mentioned first tetrahedron vertex, the above-mentioned third cube vertex is the above-mentioned fourth tetrahedron vertex is the second tetrahedron vertex, the fourth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex; the eleventh determining module is configured to, when the target tetrahedron is the fourth tetrahedron, determine that the second B coordinate value is the third R coordinate value, the second G coordinate value is the third G coordinate value, the second R coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the second cube vertex is the second tetrahedron vertex, the sixth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex;The twelfth determination module is configured to, when the target tetrahedron is the fifth tetrahedron, determine that the second G coordinate value is the third R coordinate value, the second B coordinate value is the third G coordinate value, the second R coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the fifth cube vertex is the second tetrahedron vertex, the seventh cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex; and the thirteenth determination module is configured to, when the target tetrahedron is the sixth tetrahedron, determine that the second R coordinate value is the third R coordinate value, the second B coordinate value is the third G coordinate value, the second G coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the third cube vertex is the second tetrahedron vertex, the seventh cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex. This device can further quickly implement tetrahedron mapping.
[0099] Specifically, as shown in Figure 8, t1 is the above-mentioned first tetrahedron, P0 is the vertex of the first tetrahedron, that is, the vertex of the first cube, P1 is the vertex of the second tetrahedron, that is, the vertex of the second cube, P2 is the vertex of the third tetrahedron, that is, the vertex of the sixth cube, and P3 is the vertex of the fourth tetrahedron, that is, the vertex of the eighth cube; t2 is the above-mentioned second tetrahedron, P0 is the vertex of the first tetrahedron, that is, the vertex of the first cube, P1 is the vertex of the second tetrahedron, that is, the vertex of the second cube, P2 is the vertex of the third tetrahedron, that is, the vertex of the fourth cube, and P3 is the vertex of the fourth tetrahedron, that is, the vertex of the eighth cube; t3 is the above-mentioned third tetrahedron, P0 is the vertex of the first tetrahedron, that is, the vertex of the first cube, P1 is the vertex of the second tetrahedron, that is, the vertex of the third cube, P2 is the vertex of the third tetrahedron, that is, the vertex of the fourth cube, and P3 is the vertex of the fourth tetrahedron, that is, the vertex of the eighth cube body vertex; t4 is the fourth tetrahedron mentioned above, P0 is the first tetrahedron vertex, that is, the first cube vertex, P1 is the second tetrahedron vertex, that is, the second cube vertex, P2 is the third tetrahedron vertex, that is, the sixth cube vertex, and P3 is the fourth tetrahedron vertex, that is, the eighth cube vertex; t5 is the fifth tetrahedron mentioned above, P0 is the first tetrahedron vertex, that is, the first cube vertex, P1 is the second tetrahedron vertex, that is, the fifth cube vertex, P2 is the third tetrahedron vertex, that is, the seventh cube vertex, and P3 is the fourth tetrahedron vertex, that is, the eighth cube vertex; t6 is the sixth tetrahedron mentioned above, P0 is the first tetrahedron vertex, that is, the first cube vertex, P1 is the second tetrahedron vertex, that is, the third cube vertex, P2 is the third tetrahedron vertex, that is, the seventh cube vertex, and P3 is the fourth tetrahedron vertex, that is, the eighth cube vertex.
[0100] The above-mentioned third processing unit includes a fourth calculation module and a second processing module, wherein the fourth calculation module is configured to calculate the initial mapping value F according to the formula F=[F0<<x+(F1-F0)×B3+(F2-F1)×R3+(F3-F2)×G3]>>x, wherein F0 is the above-mentioned first tetrahedron vertex, << is the left shift operation symbol, x is the side length of the above-mentioned target cube, F1 is the above-mentioned second tetrahedron vertex, B3 is the above-mentioned third B coordinate value, F2 is the above-mentioned third tetrahedron vertex, R3 is the above-mentioned third R coordinate value, F3 is the above-mentioned fourth tetrahedron vertex, G3 is the above-mentioned third G coordinate value, and >> is the right shift operation symbol; the second processing module is configured to shift the above-mentioned initial mapping value right by the above-mentioned predetermined number of bits to obtain the above-mentioned target mapping value. In this device, since the formula for calculating the initial mapping value only requires 3 multipliers and 4 adders, compared with the prior art, the consumption of multipliers is much greater than that of adders, which can further reduce the hardware overhead of data mapping calculation.
[0101] Specifically, the above calculation formula can be derived by the following equation: as well as
[0102] The data mapping device based on a three-dimensional lookup table includes a processor and a memory. The first acquisition unit, the first processing unit, the second acquisition unit, the third acquisition unit, the second processing unit, and the third processing unit are all stored as program units in the memory. The processor executes the program units stored in the memory to implement corresponding functions. The above modules are all located in the same processor; alternatively, the above modules can be located in different processors in any combination.
[0103] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and data mapping based on a three-dimensional lookup table can be performed by adjusting kernel parameters.
[0104] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0105] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program. When the program is executed, the device where the computer-readable storage medium is located is controlled to execute the data mapping method based on the three-dimensional lookup table.
[0106] An embodiment of the present invention provides a processor, which is used to run a program, wherein the data mapping method based on the three-dimensional lookup table is executed when the program is run.
[0107] An embodiment of the present invention provides a device comprising a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the aforementioned data mapping method based on a three-dimensional lookup table. The device herein may be a server, a PC, a PAD, a mobile phone, or the like.
[0108] The present disclosure also provides a computer program product, which, when executed on a data processing device, is suitable for executing and initializing the above-mentioned data mapping method based on a three-dimensional lookup table.
[0109] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, can be centralized on a single computing device, or can be distributed across a network of multiple computing devices. They can be implemented using program code executable by the computing device, and thus, can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described herein can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0110] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0111] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0112] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0113] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0114] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0115] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0116] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0117] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0118] The foregoing description is merely a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Those skilled in the art will readily appreciate that various modifications and variations are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present disclosure shall be included within the scope of protection of the present disclosure.
Claims
1. A data mapping method based on a three-dimensional lookup table, wherein: include: Obtaining an original grayscale value of a target pixel and a color depth of the target pixel, and shifting the original grayscale value left by a predetermined number of bits to obtain a target grayscale value, wherein the original grayscale value and the target grayscale value are binary numbers, the predetermined number of bits is a positive integer, and the target grayscale value includes an R channel sub-grayscale value, a G channel sub-grayscale value, and a B channel sub-grayscale value; performing a first mapping process on the target grayscale value according to the predetermined number of bits and the color depth to obtain a mapped grayscale value, wherein the mapped grayscale value is a power of 2; Establishing a source cube containing the target pixel point, and obtaining a position of the target pixel point in the source cube to obtain a first coordinate, wherein the length of the source cube corresponds to the R channel sub-grayscale value, the width of the source cube corresponds to the B channel sub-grayscale value, and the height of the source cube corresponds to the G channel sub-grayscale value; Expanding the source cube to obtain a target cube, and obtaining a position of the target pixel point in the target cube to obtain a second coordinate, wherein the side length of the target cube is equal to the maximum of the length, width, and height of the source cube; determining, based on the second coordinates, a target tetrahedron in the target cube that contains the second coordinates, and performing a second mapping process on the second coordinates based on the target tetrahedron to obtain a third coordinate, wherein the vertices of the target tetrahedron are any four of the vertices of the target cube; The third coordinate is interpolated according to the positions of the vertices of the target tetrahedron and the side length of the target cube to obtain a target mapping value of the target pixel point.
2. The method according to claim 1, wherein Performing a first mapping process on the target grayscale value according to the predetermined number of bits and the color depth to obtain a mapped grayscale value includes: For the target grayscale value (2 n -1)×2 m Perform the first mapping process to obtain the mapped grayscale value 2 m+n , where m is the predetermined number of bits and n is the color depth.
3. The method according to claim 1, wherein Establishing a source cube containing the target pixel point, and obtaining a position of the target pixel point in the source cube to obtain a first coordinate, including: Taking any point around the target pixel as the first origin, establishing the source cube containing the target pixel; The relative coordinates of the target pixel point with respect to the first origin are determined as the first coordinates.
4. The method according to claim 1, wherein The first coordinate includes a first R coordinate value, a first G coordinate value, and a first B coordinate value, and the second coordinate includes a second R coordinate value, a second G coordinate value, and a second B coordinate value. Acquiring the position of the target pixel point in the target cube to obtain the second coordinate includes: Calculate the second R coordinate value R2 according to the formula R2=R1<<(xa), where R1 is the first R coordinate value, << is a left shift operator, x is the side length of the target cube, and a is the length of the source cube; Calculate the second G coordinate value G2 according to the formula G2=G1<<(xb), where G1 is the first G coordinate value and b is the height of the source cube; The second B coordinate value B2 is calculated according to the formula B2=B1<<(xc), where B1 is the first B coordinate value and c is the width of the source cube.
5. The method according to claim 1, wherein The second coordinates include a second R coordinate value, a second G coordinate value, and a second B coordinate value, and the target tetrahedron includes a first tetrahedron, a second tetrahedron, a third tetrahedron, a fourth tetrahedron, a fifth tetrahedron, and a sixth tetrahedron. Determining the target tetrahedron containing the second coordinates in the target cube according to the second coordinates includes: determining whether the second coordinate satisfies the conditions that the second B coordinate value is greater than or equal to the second R coordinate value and the second R coordinate value is greater than or equal to the second G coordinate value, and determining the first tetrahedron as the target tetrahedron if the second coordinate satisfies the conditions that the second B coordinate value is greater than or equal to the second R coordinate value and the second R coordinate value is greater than or equal to the second G coordinate value; If the second coordinate does not satisfy that the second B coordinate value is greater than or equal to the second R coordinate value or the second R coordinate value is greater than or equal to the second G coordinate value, determining whether the second coordinate satisfies that the second B coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second R coordinate value; if the second coordinate satisfies that the second B coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second R coordinate value, determining that the second tetrahedron is the target tetrahedron; If the second coordinate does not satisfy that the second B coordinate value is greater than or equal to the second G coordinate value or the second G coordinate value is greater than or equal to the second R coordinate value, determining whether the second coordinate satisfies that the second G coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second R coordinate value; if the second coordinate satisfies that the second G coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second R coordinate value, determining the third tetrahedron as the target tetrahedron; If the second coordinate does not satisfy that the second G coordinate value is greater than or equal to the second B coordinate value or the second B coordinate value is greater than or equal to the second R coordinate value, determining whether the second coordinate satisfies that the second R coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second G coordinate value; if the second coordinate satisfies that the second R coordinate value is greater than or equal to the second B coordinate value and the second B coordinate value is greater than or equal to the second G coordinate value, determining the fourth tetrahedron as the target tetrahedron; If the second coordinate does not satisfy that the second R coordinate value is greater than or equal to the second B coordinate value or the second B coordinate value is greater than or equal to the second G coordinate value, determining whether the second coordinate satisfies that the second R coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second B coordinate value; if the second coordinate satisfies that the second R coordinate value is greater than or equal to the second G coordinate value and the second G coordinate value is greater than or equal to the second B coordinate value, determining the fifth tetrahedron as the target tetrahedron; When the second coordinate does not satisfy that the second R coordinate value is greater than or equal to the second G coordinate value or the second G coordinate value is greater than or equal to the second B coordinate value, the sixth tetrahedron is determined to be the target tetrahedron.
6. The method according to claim 5, wherein: The target cube includes a first cube vertex, a second cube vertex, a third cube vertex, a fourth cube vertex, a fifth cube vertex, a sixth cube vertex, a seventh cube vertex, and an eighth cube vertex; the target tetrahedron includes a first tetrahedron vertex, a second tetrahedron vertex, a third tetrahedron vertex, and a fourth tetrahedron vertex; the third coordinate includes a third R coordinate value, a third G coordinate value, and a third B coordinate value; and according to the target tetrahedron, performing a second mapping process on the second coordinate to obtain the third coordinate includes: When the target tetrahedron is the first tetrahedron, determining that the second R coordinate value is the third R coordinate value, the second G coordinate value is the third G coordinate value, the second B coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the second cube vertex is the second tetrahedron vertex, the sixth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex; When the target tetrahedron is the second tetrahedron, determining that the second G coordinate value is the third R coordinate value, the second R coordinate value is the third G coordinate value, the second B coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the second cube vertex is the second tetrahedron vertex, the fourth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex; When the target tetrahedron is the third tetrahedron, determining that the second B coordinate value is the third R coordinate value, the second R coordinate value is the third G coordinate value, the second G coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the third cube vertex is the second tetrahedron vertex, the fourth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex; When the target tetrahedron is the fourth tetrahedron, determining that the second B coordinate value is the third R coordinate value, the second G coordinate value is the third G coordinate value, the second R coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the second cube vertex is the second tetrahedron vertex, the sixth cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex; When the target tetrahedron is the fifth tetrahedron, determining that the second G coordinate value is the third R coordinate value, the second B coordinate value is the third G coordinate value, the second R coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the fifth cube vertex is the second tetrahedron vertex, the seventh cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex; When the target tetrahedron is the sixth tetrahedron, determine that the second R coordinate value is the third R coordinate value, the second B coordinate value is the third G coordinate value, the second G coordinate value is the third B coordinate value, the first cube vertex is the first tetrahedron vertex, the third cube vertex is the second tetrahedron vertex, the seventh cube vertex is the third tetrahedron vertex, and the eighth cube vertex is the fourth tetrahedron vertex.
7. The method according to claim 6, wherein: The method includes performing interpolation processing on the third coordinate according to the positions of the vertices of the target tetrahedron and the side length of the target cube to obtain a target mapping value of the target pixel point, including: According to the formula F=[F0<<x+(F1-F0)×B3+(F2-F1)×R3+(F3-F2)×G3]>>x, the initial mapping value F is calculated, where F0 is the first tetrahedron vertex, << is the left shift operator, x is the side length of the target cube, F1 is the second tetrahedron vertex, B3 is the third B coordinate value, F2 is the third tetrahedron vertex, R3 is the third R coordinate value, F3 is the fourth tetrahedron vertex, and G3 is the fourth tetrahedron vertex. Three G coordinate values, >> is the right shift operator; The initial mapping value is right-shifted by the predetermined number of bits to obtain the target mapping value.
8. A data mapping device based on a three-dimensional lookup table, wherein: include: A first acquisition unit is configured to acquire an original grayscale value of a target pixel and a color depth of the target pixel, and shift the original grayscale value left by a predetermined number of bits to obtain a target grayscale value, wherein the original grayscale value and the target grayscale value are binary numbers, the predetermined number of bits is a positive integer, and the target grayscale value includes an R channel sub-grayscale value, a G channel sub-grayscale value, and a B channel sub-grayscale value; a first processing unit configured to perform a first mapping process on the target grayscale value according to the predetermined number of bits and the color depth to obtain a mapped grayscale value, wherein the mapped grayscale value is a power of 2; a second acquiring unit configured to establish a source cube containing the target pixel point, and acquire a position of the target pixel point in the source cube to obtain a first coordinate, wherein a length of the source cube corresponds to the R channel sub-grayscale value, a width of the source cube corresponds to the B channel sub-grayscale value, and a height of the source cube corresponds to the G channel sub-grayscale value; a third acquiring unit configured to expand the source cube to obtain a target cube, and acquire a position of the target pixel point in the target cube to obtain a second coordinate, wherein a side length of the target cube is equal to a maximum of a length, a width, and a height of the source cube; a second processing unit configured to determine, based on the second coordinates, a target tetrahedron in the target cube that contains the second coordinates, and perform a second mapping process on the second coordinates based on the target tetrahedron to obtain a third coordinate, wherein the vertices of the target tetrahedron are any four of the vertices of the target cube; The third processing unit is configured to perform interpolation processing on the third coordinate according to the positions of the vertices of the target tetrahedron and the side length of the target cube to obtain a target mapping value of the target pixel point.
9. A computer-readable storage medium, wherein: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, wherein: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.