Image processing method and device, storage medium and electronic equipment
By determining the loss color depth and jitter matrix, the display device is jittered, which solves the problem of poor image quality when displaying high color depth images, and achieves efficient jitter processing and cost reduction.
Patent Information
- Application Number
- CN202310660710.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-05
- Publication Date
- 2024-12-06
AI Technical Summary
When display devices need to display high color depth images, in order to save driving costs, color depth is usually limited, resulting in poor image quality and need to be compensated by jitter processing, but the prior art is difficult to effectively realize high-precision jitter processing.
By determining the loss color depth and the corresponding jitter matrix, the pixel values of the original image are divided and compensated, and a compensated image is generated to achieve jitter processing for high color depth images and maintain image quality.
The jitter processing of high-color depth images is effectively realized, the picture quality of the display device is improved, the driving cost is reduced, and precise color compensation is achieved through the use of the jitter matrix.
Smart Images

Figure CN119090785A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of electronic technology, and in particular, relates to an image processing method, device, computer-readable storage medium and electronic device. Background Art
[0002] For display devices, the finer the voltage control, that is, the higher the color depth of the display device, the more delicate the displayed image, the smoother the color transition, and the better the image quality. However, the higher the color depth of the display device, the finer the voltage control is required, and the finer the voltage control, the more circuits are required, which increases the driving cost. In order to save driving costs, the color depth of the display device is usually limited to a certain color depth, such as 10 bits. When the color depth of the image that the display device needs to display is greater than the color depth, in order to keep the image quality not too bad, the image that the display device needs to display needs to be dithered. Summary of the invention
[0003] The embodiments of the present application provide an image processing method, an apparatus, a storage medium, and an electronic device, which can implement dithering processing on an image to be displayed by a display device.
[0004] In a first aspect, an embodiment of the present application provides an image processing method, comprising:
[0005] Determine the loss color depth according to the color depths corresponding to the original image and the display device respectively, and obtain a dither matrix corresponding to the loss color depth;
[0006] According to the loss color depth, dividing the pixel value of each pixel of the original image into a to-be-compensated value and a reference compensation value;
[0007] Determining a target value to be compensated from the values to be compensated according to the reference compensation value, the loss color depth, and the dither matrix;
[0008] The target value to be compensated is compensated to obtain a compensated image. The loss color depth is determined according to the color depths corresponding to the original image and the display device, respectively, and a dither matrix corresponding to the loss color depth is obtained;
[0009] According to the loss color depth, dividing the pixel value of each pixel of the original image into a to-be-compensated value and a reference compensation value;
[0010] Determining a target value to be compensated from the values to be compensated according to the reference compensation value, the loss color depth, and the dither matrix;
[0011] The target value to be compensated is compensated to obtain a compensated image.
[0012] In a second aspect, an embodiment of the present application provides an image processing device, including:
[0013] An acquisition module, used to determine the loss color depth according to the color depths corresponding to the original image and the display device, and to acquire a dither matrix corresponding to the loss color depth;
[0014] A division module, used for dividing the pixel value of each pixel of the original image into a to-be-compensated value and a reference compensation value according to the loss color depth;
[0015] A determination module, configured to determine a target value to be compensated from the values to be compensated according to the reference compensation value, the loss color depth, and the dither matrix;
[0016] The compensation module is used to compensate the target value to be compensated to obtain a compensated image.
[0017] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed on a computer, the computer executes the image processing method provided by the embodiment of the present application.
[0018] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the processor is used to execute the image processing method provided in the embodiment of the present application by calling a computer program stored in the memory.
[0019] In an embodiment of the present application, the loss color depth is determined according to the color depths corresponding to the original image and the display device respectively, and a dither matrix corresponding to the loss color depth is obtained; the pixel value of each pixel of the original image is divided into a value to be compensated and a reference compensation value according to the dither matrix and the loss color depth; a target value to be compensated is determined from the values to be compensated according to the reference compensation value, the loss color depth and the dither matrix; the target value to be compensated is compensated to obtain a compensated image, thereby achieving dithering processing of the original image, that is, the image that the display device needs to display, so that the image quality of the original image can be kept not too bad. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The technical solution and beneficial effects of the present application will be made apparent by describing in detail the specific implementation modes of the present application in conjunction with the accompanying drawings.
[0021] Figure 1 This is a first flow chart of the image processing method provided in the embodiment of the present application.
[0022] Figure 2 It is a schematic diagram of a dither matrix corresponding to a lossy color depth of 1 bit provided in an embodiment of the present application.
[0023] Figure 3 It is a schematic diagram of a dither matrix corresponding to a lossy color depth of 2 bits provided in an embodiment of the present application.
[0024] Figure 4 It is a schematic diagram of a dither matrix corresponding to a lossy color depth of 3 bits provided in an embodiment of the present application.
[0025] Figure 5 It is a schematic diagram of a dither matrix corresponding to a lossy color depth of 4 bits provided in an embodiment of the present application.
[0026] Figure 6 It is a schematic diagram of a reference compensation value of a certain area to be compensated provided in an embodiment of the present application.
[0027] Figure 7 It is a schematic diagram of the jitter matrix provided in an embodiment of the present application.
[0028] Figure 8 It is a schematic diagram of a certain area to be compensated provided in an embodiment of the present application.
[0029] Fig. 9 This is a second flow chart of the image processing method provided in the embodiment of the present application.
[0030] Fig.10 It is a schematic diagram of the area A to be compensated provided in an embodiment of the present application.
[0031] Fig.11 It is a schematic diagram of the value to be compensated of the area A to be compensated provided in an embodiment of the present application.
[0032] Fig.12 It is a schematic diagram of the reference compensation value of the area A to be compensated provided in an embodiment of the present application.
[0033] Fig.13 It is a schematic diagram of the reference compensated value of the area A to be compensated provided in an embodiment of the present application.
[0034] Fig.14 It is a schematic diagram of the compensated area A' corresponding to the area to be compensated A provided in an embodiment of the present application.
[0035] Fig.15 It is a structural schematic diagram of the image processing device provided in an embodiment of the present application.
[0036] Fig.16 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] It should be noted that the terms "first", "second" and "third" in this application are used to distinguish different objects, rather than to describe a specific order. 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 device that includes a series of steps or modules is not limited to the listed steps or modules, but some embodiments also include steps or modules that are not listed, or some embodiments also include other steps or modules inherent to these processes, methods, products or devices.
[0038] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0039] The embodiments of the present application provide an image processing method, an image processing device, a storage medium, and an electronic device. The execution subject of the image processing method may be the image processing device provided in the embodiments of the present application, or an electronic device integrating the image processing device, wherein the image processing device may be implemented in hardware or software. The electronic device may be a device such as a smart phone, a tablet computer, a PDA, a laptop computer, etc. that is equipped with a processor and has image processing capabilities.
[0040] See also Figure 1 , Figure 1 This is a schematic diagram of a first process of the image processing method provided in an embodiment of the present application. The process may include:
[0041] In 101, the loss color depth is determined according to the color depths corresponding to the original image and the display device, respectively, and a dither matrix corresponding to the loss color depth is obtained.
[0042] For display devices, the finer the voltage control, that is, the higher the color depth of the display device, the more delicate the displayed image, the smoother the color transition, and the better the image quality. However, the higher the color depth of the display device, the finer the voltage control is required, and the finer the voltage control, the more circuits are required, which increases the driving cost. In order to save driving costs, the color depth of the display device is usually limited to a certain color depth, such as 10 bits. When the color depth of the image that the display device needs to display is greater than the color depth, in order to maintain the image quality, the image that the display device needs to display needs to be dithered.
[0043] Dithering refers to using a lower color bit depth to obtain a richer visual effect, such as using a low color depth, such as 8 bits, to obtain a high color depth, such as 12 bits. This process usually involves color compensation. For example, for an 8-bit display, if it is compensated enough, the grayscale display of the 8-bit display will be smoother. Dithering can achieve this. It can also be understood that dithering is the filling and gain of the lost part of the signal when the high-precision signal is converted to a low-precision signal.
[0044] Among them, color depth: also known as color bit depth, is a unit of bit number used to represent the number of colors in a digital image. An image is composed of pixels at different locations, and the three primary color channels (red, green, and blue) of each pixel are mixed together to produce many different colors. Each of the three primary color channels of a digital image has a range of values that can be assigned, and this range is stored as a number. What determines how large or small the number can be is the number of bits / bits used by the computer to store the number. A bit / bit is just a binary unit of information, displayed as 0 or 1 in digital form. In order to store more and more complex information, computers need to use more bits of 0 or 1. A 1-bit integer can only have two values (0 or 1), but a 2-bit integer can have 4 values (00, 01, 10, and 11), and a 3-bit integer can have 8 values (000, 001, 010, 011, 100, 101, 110, and 111), and so on. By increasing the number of bits per primary color channel, computers can store more complex color information.
[0045] In this embodiment, the color depths corresponding to the original image and the display device may be obtained first, and then the loss color depth may be determined according to the color depths corresponding to the original image and the display device, and a dither matrix corresponding to the loss color depth may be obtained.
[0046] The original image may be an image that needs to be displayed by a display device, and the display device is a device that can display the original image, which may be a device with a display function, such as a smart phone, a tablet computer, a laptop computer, and the like.
[0047] It should be noted that, in the embodiment of the present application, the color depth of the original image is greater than the color depth of the display device.
[0048] The lossy color depth is the difference between the color depths of the original image and the display device.
[0049] For example, assuming that the color depth of the original image is 12 bits and the color depth of the display device is 8 bits, the loss color depth is 4 bits.
[0050] For another example, assuming that the color depth of the original image is 10 bits and the color depth of the display device is 8 bits, the loss color depth is 2 bits.
[0051] Among them, different lossy color depths correspond to different dither matrices, which can be dither matrices with different corresponding element values, or matrices of different sizes. For example, when the lossy color depth is 1 bit and 2 bits, it corresponds to a 2×2 dither matrix, but the element values in the dither matrices corresponding to the two are different. When the lossy color depth is 3 bits, it corresponds to a 3×2 dither matrix, and when the lossy color depth is 4 bits, it corresponds to a 4×4 dither matrix. The element values in the dither matrices corresponding to different lossy color depths range from 0 to 2. n -1. Where n is the lossy color depth. Except for the dither matrix corresponding to the lossy color depth of 1 bit, the element values in the dither matrices corresponding to other lossy color depths are different. The element values in the dither matrix can be in binary form, decimal form, or hexadecimal form.
[0052] For example, the dither matrix corresponding to the lossy color depth of 1 bit can be as follows: Figure 2 As shown, the dither matrix corresponding to the loss color depth of 2 bits can be as follows Figure 3 As shown, the dither matrix corresponding to the lossy color depth of 3 bits can be as follows Figure 4 As shown, the dither matrix corresponding to the lossy color depth of 4 bits can be as follows Figure 5 shown.
[0053] In 102, the pixel value of each pixel of the original image is divided into a to-be-compensated value and a reference compensation value according to the loss color depth.
[0054] Each pixel includes three primary color channels, namely red, green and blue, and each primary color channel has a corresponding pixel value. The pixel value in the embodiment of the present application may refer to the pixel value of any primary color channel. In the embodiment of the present application, the pixel value of each primary color channel of the original image is subjected to dithering processing to compensate the corresponding pixel value of each primary color channel, and finally a compensated image is obtained.
[0055] The following will be described by taking the dithering process of the pixels of the red channel as an example. It can be understood that the process of dithering the pixels of the green channel and the process of dithering the pixels of the blue channel can refer to the process of dithering the pixels of the red channel, and the embodiments of the present application will not be repeated.
[0056] In this embodiment, after the loss color depth is obtained, the pixel value of the red channel of each pixel of the original image may be divided into a to-be-compensated value and a reference compensation value according to the loss color depth.
[0057] If the pixel value range is expressed in decimal form, the pixel value of the red channel of the original image is in the range of 0 to 2. k -1, the value to be compensated ranges from 0 to 2 n -1, the reference compensation value range is 0 to 2 k-n -1. If the pixel value of the red channel of the pixel of the original image is expressed in binary form, the value to be compensated is the value of the first kn bits of the pixel value of the red channel of the pixel of the original image, and the reference compensation value is the value of the last n bits of the pixel value of the red channel of the pixel of the original image. Where k represents the color depth of the original image, and n represents the loss color depth.
[0058] For example, assuming that the color depth of the original image is 12 bits and the loss color depth is 4 bits, if the pixel value of the red channel of a pixel of the original image is expressed in binary form as 010001101011, then the value to be compensated of the pixel is expressed in binary form as 01000110, and the reference compensation value is expressed in binary form as 1011. If the pixel value of the red channel of a pixel of the original image is expressed in binary form as 011001101001, then the value to be compensated of the pixel is expressed in binary form as 01100110, and the reference compensation value is expressed in binary form as 1001.
[0059] It should be noted that in the embodiments of the present application, in order to facilitate calculation, during the calculation process, each value, such as the reference compensation value, the value to be compensated, etc., can be unified into decimal form for calculation.
[0060] In 103, a target value to be compensated is determined from the values to be compensated according to the reference compensation value, the loss color depth, and the dither matrix.
[0061] In this embodiment, after the value to be compensated and the reference compensation value of the original image are obtained, the target value to be compensated can be determined from the value to be compensated of the original image according to the reference compensation value, the loss color depth and the dither matrix of the original image.
[0062] In 104, the target value to be compensated is compensated to obtain a compensated image.
[0063] In this embodiment, after the target compensation value is obtained, the target value to be compensated may be compensated to obtain a compensated image.
[0064] In this embodiment, the loss color depth is determined according to the color depths corresponding to the original image and the display device respectively, and a dither matrix corresponding to the loss color depth is obtained; the pixel value of each pixel of the original image is divided into a value to be compensated and a reference compensation value according to the dither matrix and the loss color depth; a target value to be compensated is determined from the values to be compensated according to the reference compensation value of the original image, the loss color depth and the dither matrix; the target value to be compensated is compensated to obtain a compensated image, and dithering processing can be performed on the original image, that is, the image that the display device needs to display, so that the image quality of the original image can be kept not too bad.
[0065] In an optional embodiment, the pixel value of each pixel of the original image is divided into a to-be-compensated value and a reference compensation value according to the loss color depth, including:
[0066] According to the size of the dither matrix, the original image is divided into a plurality of areas to be compensated;
[0067] According to the loss color depth, the pixel value of each pixel in each area to be compensated is divided into a value to be compensated and a reference compensation value;
[0068] According to the reference compensation value of the original image, the loss color depth, and the dithering matrix, a target value to be compensated is determined from the values to be compensated, including:
[0069] According to the reference compensation value of each area to be compensated, the loss color depth and the dither matrix, a target value to be compensated is determined from the values to be compensated of each area to be compensated, so as to obtain the target value to be compensated of each area to be compensated;
[0070] Compensate the target value to be compensated to obtain a compensated image, including:
[0071] The target to-be-compensated value of each to-be-compensated area is compensated to obtain a plurality of compensated areas, and the plurality of compensated areas constitute a compensated image.
[0072] Generally speaking, the size of the dither matrix is smaller than the size of the original image. Therefore, according to the size of the dither matrix, the original image can be divided into multiple areas to be compensated with the same size as the dither matrix, and dithering processing can be performed on each area to be compensated separately to finally obtain a compensated image.
[0073] For example, assuming that the size of the original image is 1920×1080 and the size of the dither matrix is 4×4, the original image can be divided into 129,600 areas to be compensated, and the size of each area to be compensated is 4×4.
[0074] In an optional embodiment, determining a target value to be compensated from the values to be compensated of each area to be compensated according to the reference compensation value, the loss color depth and the dither matrix of each area to be compensated includes:
[0075] Calculate the sum of all reference compensation values of each area to be compensated to obtain a first target value corresponding to each area to be compensated;
[0076] Obtaining a first preset value, and calculating the power of the loss color depth of the first preset value to obtain a second target value corresponding to each area to be compensated;
[0077] According to the first target value and the second target value corresponding to each area to be compensated and the dither matrix, a target value to be compensated is determined from the values to be compensated of each area to be compensated.
[0078] The first preset value may be set by a person skilled in the art. For example, the first preset value may be 2, 2.01, 2.05, and so on.
[0079] Assume that the reference compensation value of a certain area to be compensated is as follows: Figure 6 As shown, then the sum of all reference compensation values of the area to be compensated, that is, the first target value corresponding to the area to be compensated is 110. Assuming that the first preset value is 2 and the loss color depth is 4 bits, then the power of the loss color depth of the first preset value, that is, the second target value corresponding to the area to be compensated is 2 4 =16.
[0080] For each area to be compensated, through the above process, the first target value and the second target value corresponding to each area to be compensated can be obtained. According to the first target value and the second target value corresponding to each area to be compensated and the jitter matrix, the target value to be compensated can be determined from the values to be compensated of each area to be compensated.
[0081] In an optional embodiment, determining a target value to be compensated from the values to be compensated of each area to be compensated according to the first target value and the second target value corresponding to each area to be compensated and the jitter matrix includes:
[0082] Obtaining a second preset value, and calculating the product of the first target value corresponding to each area to be compensated and the second preset value, to obtain a third target value corresponding to each area to be compensated;
[0083] Calculate the quotient of the third target value corresponding to each area to be compensated and the second target value corresponding to each area to be compensated to obtain a fourth target value corresponding to each area to be compensated;
[0084] According to the fourth target value corresponding to each area to be compensated and the dither matrix, a target value to be compensated is determined from the values to be compensated of each area to be compensated.
[0085] The second preset value may be set by a person skilled in the art. The second preset value may be greater than 1 and less than 2. For example, the second preset value may be 3 / 2.
[0086] Assuming that the first target value corresponding to a certain area to be compensated is 110 and the second preset value is 3 / 2, the product of the first target value and the second preset value corresponding to the area to be compensated, that is, the third target value corresponding to the area to be compensated is 165. Assuming that the second target value corresponding to the area to be compensated is 16, the fourth target value corresponding to the area to be compensated is 10.
[0087] For each area to be compensated, the fourth target value corresponding to each area to be compensated can be obtained through the above process. According to the fourth target value corresponding to each area to be compensated and the jitter matrix, the target value to be compensated can be determined from the values to be compensated of each area to be compensated.
[0088] It should be noted that the first target value, the second target value, the third target value and the fourth target value are all integers. If the calculated result is not an integer, the integer part is directly taken as the final result.
[0089] In an optional embodiment, determining a target value to be compensated from the values to be compensated of each area to be compensated according to the fourth target value corresponding to each area to be compensated and the jitter matrix includes:
[0090] Determine from the jitter matrix an element whose element value is less than a fourth target value corresponding to each area to be compensated, and obtain an element corresponding to each area to be compensated;
[0091] The to-be-compensated value of the pixel corresponding to the element corresponding to each to-be-compensated area in each to-be-compensated area is determined as the target to-be-compensated value.
[0092] For example, suppose the jitter matrix is Figure 7 As shown in Figure 8 As shown, element E1 corresponds to pixel P1, element E2 corresponds to pixel P2, ... element E14 corresponds to pixel P14, and element E15 corresponds to pixel P15.
[0093] Assuming that the fourth target value corresponding to the area to be compensated is 10, the element values of elements E1, E2, E3, E6, E8, E9, E11, E12, E14, and E16 in the jitter matrix are all less than the fourth target value, then it can be determined that the elements corresponding to the area to be compensated are elements E1, E2, E3, E6, E8, E9, E11, E12, E14, and E16, then it can be determined that the pixels corresponding to the elements corresponding to the area to be compensated in the area to be compensated are pixels P1, P2, P3, P6, P8, P9, P11, P12, P14, and P16, then the target value to be compensated for the area to be compensated is the pixel value of pixel P1, the pixel value of pixel P2, the pixel value of pixel P3, the pixel value of pixel P6, the pixel value of pixel P8, the pixel value of pixel P9, the pixel value of pixel P11, the pixel value of pixel P12, the pixel value of pixel P14, and the pixel value of pixel P16.
[0094] For each area to be compensated, through the above process, a target compensation value of each area to be compensated can be obtained.
[0095] In an optional embodiment, the target to-be-compensated value of each to-be-compensated area is compensated to obtain a plurality of compensated areas, including:
[0096] Obtaining a third preset value, and calculating the sum of a target value to be compensated of each area to be compensated and the third preset value, to obtain a reference compensated value of each area to be compensated;
[0097] Determining a fifth target value according to the color depth corresponding to the original image and the loss color depth;
[0098] For the reference compensated values of each area to be compensated that are greater than the fifth target value, modify them to the fifth target value, and for the reference compensated values of each area to be compensated that are less than or equal to the fifth target value, keep their values unchanged, and obtain the target compensated value of each area to be compensated;
[0099] A plurality of compensated regions are obtained according to the target compensated value of each to-be-compensated region and the to-be-compensated values of each to-be-compensated region except the target to-be-compensated value.
[0100] The third preset value may be set by a person skilled in the art. For example, the third preset value may be 1.
[0101] Fifth target value = 2 k-n -1. Where k represents the color depth corresponding to the original image, and n represents the loss color depth. For example, assuming that the color depth corresponding to the original image is 12 and n is 4, the fifth target value is 255.
[0102] For example, assuming that the third preset value is 1 and the fifth target value is 255, assuming that the target value to be compensated of a pixel in a certain area to be compensated is 255, then the reference compensated value of the pixel in the area to be compensated is 256. Since the pixel value is greater than the fifth target value, the reference compensated value needs to be modified to 255. Assuming that the target value to be compensated of another pixel in the area to be compensated is 20, then the reference compensated value of the pixel in the area to be compensated is 21. Since the reference compensated value is less than the fifth target value, the reference compensated value remains unchanged, and the values to be compensated in the area to be compensated except the target value to be compensated also remain unchanged, so that the corresponding compensated area is finally obtained.
[0103] For each area to be compensated, through the above process, a compensated area can be obtained, thereby obtaining multiple compensated areas.
[0104] In an optional embodiment, after compensating the target value to be compensated and obtaining the compensated image, the method further includes:
[0105] The compensated image is displayed via a display device.
[0106] It can be understood that the color depth corresponding to the original image is greater than the color depth corresponding to the display device, and the pixel value of each pixel of the compensated image is less than or equal to 2 m -1, that is, less than or equal to the maximum pixel value that the display device can display, and because the compensated image is an image that has been jittered, the compensated image can be displayed on the display device without losing its image quality.
[0107] See also Fig. 9 , Fig. 9 This is a second flow chart of the image processing method provided in the embodiment of the present application, and the flow chart may include:
[0108] In 201, the loss color depth is determined according to the color depths corresponding to the original image and the display device, respectively, and a dither matrix corresponding to the loss color depth is obtained.
[0109] In 202, the original image is divided into a plurality of areas to be compensated according to the size of the dither matrix.
[0110] For example, assuming that the color depth k corresponding to the original image is 12 bits and the color depth m corresponding to the display device is 8 bits, the loss color depth n is 4 bits.
[0111] Assume the jitter matrix is Figure 7 As shown, the size of the dither matrix is 4×4. Assuming that the size of the original image is 1920×1080, the original image can be divided into 129,600 areas to be compensated, and the size of each area to be compensated is 4×4.
[0112] In 203 , the pixel value of each pixel in each to-be-compensated area is divided into a to-be-compensated value and a reference compensation value according to the loss color depth.
[0113] The image processing method provided in the embodiment of the present application is described below by taking the processing of pixels of the red channel of a certain area to be compensated in the original image, such as the area A to be compensated, as an example. The process of processing pixels of other channels, i.e., the green channel and the blue channel, of the area A to be compensated in the original image can refer to the process of processing pixels of the red channel of the area A to be compensated in the original image, and the processing process of other areas to be compensated in the original image can refer to the processing process of the area A to be compensated, which will not be repeated here.
[0114] For example, the pixel value of each pixel in the area A to be compensated can be expressed in binary form, then the first 8 bits of the pixel value of each pixel in the area A to be compensated can be used as the value to be compensated for each pixel, and the last 4 bits of the pixel value of each pixel in the area A to be compensated can be used as the reference compensation value for each pixel. The value to be compensated and the reference compensation value of the area A to be compensated are obtained. The reference compensation value and the value to be compensated can be expressed in decimal form.
[0115] For example, assuming that the area A to be compensated is Fig.10 As shown, the compensation value of the area A to be compensated can be as follows: Fig.11 As shown, the reference compensation value of the area A to be compensated can be as follows: Fig.12 shown.
[0116] In 204 , the sum of all reference compensation values of each area to be compensated is calculated to obtain a first target value corresponding to each area to be compensated.
[0117] For example, assuming that the reference compensation value of the area A to be compensated is Fig.12 As shown, the first target value corresponding to the area A to be compensated is 0+7+2+9+11+3+13+5+3+10+1+8+14+6+12+4=108.
[0118] In 205, a first preset value is obtained, and the power of the loss color depth of the first preset value is calculated to obtain a second target value corresponding to each area to be compensated.
[0119] For example, assuming that the first preset value is 2, the second target value corresponding to the area to be compensated A is 2 4 =16
[0120] In 206 , a second preset value is obtained, and a product of the first target value corresponding to each area to be compensated and the second preset value is calculated to obtain a third target value corresponding to each area to be compensated.
[0121] For example, assuming that the second preset value is 3 / 2, the third target value corresponding to the area A to be compensated is 108×3 / 2=162.
[0122] In 207 , the quotient of the third target value corresponding to each area to be compensated and the second target value corresponding to each area to be compensated is calculated to obtain a fourth target value corresponding to each area to be compensated.
[0123] For example, the fourth target value corresponding to the area A to be compensated = 162 / 16 = 10
[0124] In 208, the element position whose element value is less than the fourth target value corresponding to each area to be compensated is determined from the dither matrix to obtain the element position corresponding to each area to be compensated.
[0125] It can be understood that if the element values of the elements E1, E2, E3, E6, E8, E9, E11, E12, E14, and E16 in the jitter matrix are less than 10, it can be determined that the elements corresponding to each area to be compensated are the elements E1, E2, E3, E6, E8, E9, E11, E12, E14, and E16 in the jitter matrix.
[0126] In 209 , the to-be-compensated value of the pixel corresponding to the element corresponding to each to-be-compensated area in each to-be-compensated area is determined as the target to-be-compensated value.
[0127] It is understandable that if Figure 7 and Fig.11 As shown, the pixels with to-be-compensated values of 178, 50, 162, 113, 2, 216, 255, 142, 1, and 51 in the to-be-compensated area A correspond to the elements E1, E2, E3, E6, E8, E9, E11, E12, E14, and E16 in the dithering matrix respectively, and the target to-be-compensated values are 178, 50, 162, 113, 2, 216, 255, 142, 1, and 51.
[0128] In 210 , a third preset value is obtained, and the sum of the target value to be compensated of each area to be compensated and the third preset value is calculated to obtain a reference compensated value of each area to be compensated.
[0129] For example, assuming that the third preset value is 1, the reference compensated value of the area A to be compensated is as follows: Fig.13 shown.
[0130] In 211 , a fifth target value is determined according to the color depth corresponding to the original image and the loss color depth.
[0131] For example, the fifth target value = 2 k-n -1=255.
[0132] In 212, for the reference compensated values of each area to be compensated that are greater than the fifth target value, they are modified to the fifth target value, and for the reference compensated values of each area to be compensated that are less than or equal to the fifth target value, their values remain unchanged, and multiple compensated areas are obtained, and the multiple compensated areas constitute a compensated image.
[0133] For example, assuming that the reference compensation value of the area A to be compensated is Fig.13 As shown in FIG. 1 , since the pixel value of the pixel in the third row and third column of the area A to be compensated is 256, that is, greater than 255, the pixel value of the pixel in the third row and third column of the area A to be compensated needs to be modified to 255, while the pixel values of other rows and other columns are all less than 255 and can remain unchanged. The compensated area A' corresponding to the area A to be compensated is obtained as shown in FIG. Fig.14 shown.
[0134] Other compensated regions of the compensated image can be obtained through the same process as the above process, thereby constituting the compensated image.
[0135] In 213, the compensated image is displayed via a display device.
[0136] For example, after the compensated image is obtained, the compensated image may be displayed on a display screen of a display device.
[0137] Since the compensated image is an image obtained by the image processing method provided in the embodiment of the present application through the original image, that is, the compensated image is an image after the original image is jittered, the image quality of the compensated image can be kept not too bad.
[0138] See also Fig.15 , Fig.15 The image processing device 300 includes an acquisition module 301 , a division module 302 , a determination module 303 and a compensation module 304 .
[0139] An acquisition module 301 is used to determine a loss color depth according to the color depths corresponding to the original image and the display device, and to acquire a dither matrix corresponding to the loss color depth;
[0140] A division module 302, configured to divide the pixel value of each pixel of the original image into a to-be-compensated value and a reference compensation value according to the loss color depth;
[0141] A determination module 303, configured to determine a target value to be compensated from the values to be compensated according to the reference compensation value, the loss color depth and the dither matrix;
[0142] The compensation module 304 is used to compensate the target value to be compensated to obtain a compensated image.
[0143] In an optional embodiment, the division module 302 may be used to: divide the original image into a plurality of areas to be compensated according to the size of the dither matrix; divide the pixel value of each pixel of each area to be compensated into a value to be compensated and a reference compensation value according to the loss color depth;
[0144] The determination module 303 may be configured to: determine a target value to be compensated from the values to be compensated of each area to be compensated according to the reference compensation value of each area to be compensated, the loss color depth, and the dither matrix, to obtain the target value to be compensated of each area to be compensated;
[0145] The compensation module 304 may be configured to compensate the target to-be-compensated value of each of the to-be-compensated regions to obtain a plurality of compensated regions, wherein the plurality of compensated regions constitute the compensated image.
[0146] In an optional embodiment, the determination module 303 can be used to: calculate the sum of all reference compensation values of each of the areas to be compensated to obtain a first target value corresponding to each of the areas to be compensated; obtain a first preset value, and calculate the loss color depth power of the first preset value to obtain a second target value corresponding to each of the areas to be compensated; determine the target value to be compensated from the values to be compensated of each of the areas to be compensated according to the first target value and the second target value corresponding to each of the areas to be compensated, and the jitter matrix.
[0147] In an optional embodiment, the determination module 303 can be used to: obtain a second preset value, and calculate the product of the first target value corresponding to each of the areas to be compensated and the second preset value to obtain a third target value corresponding to each of the areas to be compensated; calculate the quotient of the third target value corresponding to each of the areas to be compensated and the second target value corresponding to each of the areas to be compensated to obtain a fourth target value corresponding to each of the areas to be compensated; determine the target value to be compensated from the values to be compensated of each of the areas to be compensated according to the fourth target value corresponding to each of the areas to be compensated and the jitter matrix.
[0148] In an optional embodiment, the determination module 303 can be used to: determine from the jitter matrix an element whose element value is less than the fourth target value corresponding to each of the areas to be compensated, to obtain the element corresponding to each of the areas to be compensated; and determine the value to be compensated of the pixel corresponding to the element corresponding to each of the areas to be compensated in each of the areas to be compensated as the target value to be compensated.
[0149] In an optional embodiment, the compensation module 304 can be used to: obtain a third preset value, and calculate the sum of the target value to be compensated of each area to be compensated and the third preset value to obtain a reference compensated value of each area to be compensated; determine a fifth target value according to the color depth corresponding to the original image and the loss color depth; for each reference compensated value of the area to be compensated that is greater than the fifth target value, modify it to the fifth target value, and for each reference compensated value of the area to be compensated that is less than or equal to the fifth target value, keep its value unchanged, to obtain multiple compensated areas.
[0150] In an optional embodiment, the image processing apparatus 300 may further include a display module, and the display module may be configured to: display the compensated image via the display device.
[0151] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed on a computer, the computer executes the image processing method provided in the embodiment.
[0152] An embodiment of the present application also provides an electronic device, including a memory and a processor, wherein the processor is used to execute the image processing method provided in the present embodiment by calling a computer program stored in the memory.
[0153] For example, the electronic device described above may be a display device in an embodiment of the present application. Fig.16 , Fig.16 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0154] The electronic device 400 may include components such as a processor 401 and a memory 402. Those skilled in the art will appreciate that Fig.16 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, the electronic device 400 may also include a display screen.
[0155] The processor 401 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device and processes data by running or executing applications stored in the memory 402 and calling data stored in the memory 402, thereby monitoring the electronic device as a whole.
[0156] The memory 402 may be used to store applications and data. The applications stored in the memory 402 include executable codes. The applications may be composed of various functional modules. The processor 401 executes various functional applications and data processing by running the applications stored in the memory 402.
[0157] In this embodiment, the processor 401 in the electronic device will load the executable code corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application program stored in the memory 402, thereby achieving:
[0158] Determine the loss color depth according to the color depths corresponding to the original image and the display device respectively, and obtain a dither matrix corresponding to the loss color depth;
[0159] According to the loss color depth, dividing the pixel value of each pixel of the original image into a to-be-compensated value and a reference compensation value;
[0160] Determining a target value to be compensated from the values to be compensated according to the reference compensation value, the loss color depth, and the dither matrix;
[0161] The target value to be compensated is compensated to obtain a compensated image.
[0162] In an optional embodiment, when the processor 401 executes the step of dividing the pixel value of each pixel of the original image into a to-be-compensated value and a reference compensation value according to the loss color depth, the following steps may be performed: dividing the original image into a plurality of to-be-compensated areas according to the size of the dither matrix; dividing the pixel value of each pixel of each to-be-compensated area into a to-be-compensated value and a reference compensation value according to the loss color depth;
[0163] When the processor 401 performs the step of determining the target value to be compensated from the values to be compensated according to the reference compensation value, the loss color depth, and the dither matrix, the processor 401 may perform: determining the target value to be compensated from the values to be compensated of each area to be compensated according to the reference compensation value, the loss color depth, and the dither matrix of each area to be compensated, to obtain the target value to be compensated of each area to be compensated;
[0164] When the processor 401 performs the compensation for the target value to be compensated to obtain the compensated image, it can perform: compensating the target value to be compensated for each of the regions to be compensated to obtain multiple compensated regions, and the multiple compensated regions constitute the compensated image.
[0165] In an optional embodiment, when the processor 401 executes the determination of the target value to be compensated from the values to be compensated of each area to be compensated according to the reference compensation value of each area to be compensated, the lost color depth and the dither matrix, it can execute: calculating the sum of all reference compensation values of each area to be compensated to obtain a first target value corresponding to each area to be compensated; obtaining a first preset value, and calculating the power of the lost color depth of the first preset value to obtain a second target value corresponding to each area to be compensated; determining the target value to be compensated from the values to be compensated of each area to be compensated according to the first target value and the second target value corresponding to each area to be compensated, and the dither matrix.
[0166] In an optional embodiment, when the processor 401 executes the step of determining the target value to be compensated from the values to be compensated of each area to be compensated according to the first target value and the second target value corresponding to each area to be compensated, and the jitter matrix, it can execute: obtaining the second preset value, and calculating the product of the first target value corresponding to each area to be compensated and the second preset value to obtain the third target value corresponding to each area to be compensated; calculating the quotient of the third target value corresponding to each area to be compensated and the second target value corresponding to each area to be compensated to obtain the fourth target value corresponding to each area to be compensated; determining the target value to be compensated from the values to be compensated of each area to be compensated according to the fourth target value corresponding to each area to be compensated and the jitter matrix.
[0167] In an optional embodiment, when the processor 401 executes the method of determining the target value to be compensated from the values to be compensated of each area to be compensated according to the fourth target value corresponding to each area to be compensated and the dithering matrix, it can execute: determining from the dithering matrix an element whose element value is less than the fourth target value corresponding to each area to be compensated, to obtain the element corresponding to each area to be compensated; and determining the value to be compensated of the pixel corresponding to the element corresponding to each area to be compensated in each area to be compensated as the target value to be compensated.
[0168] In an optional embodiment, when the processor 401 performs the compensation for the target value to be compensated of each of the areas to be compensated to obtain multiple compensated areas, the following can be performed: obtaining a third preset value, and calculating the sum of the target value to be compensated of each of the areas to be compensated and the third preset value to obtain a reference compensated value of each of the areas to be compensated; determining a fifth target value according to the color depth corresponding to the original image and the loss color depth; for each of the reference compensated values of the areas to be compensated that is greater than the fifth target value, modifying it to the fifth target value, and for each of the reference compensated values of the areas to be compensated that is less than or equal to the fifth target value, keeping its value unchanged to obtain multiple compensated areas.
[0169] In an optional embodiment, after the processor 401 executes the compensating of the target value to be compensated and obtains the compensated image, it may further execute: displaying the compensated image through the display device.
[0170] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the image processing method above, and will not be repeated here.
[0171] The image processing device provided in the embodiment of the present application belongs to the same concept as the image processing method in the above embodiment. Any method provided in the image processing method embodiment can be run on the image processing device. The specific implementation process is detailed in the image processing method embodiment and will not be repeated here.
[0172] It should be noted that, for the image processing method of the embodiment of the present application, a person skilled in the art can understand that the implementation of all or part of the process of the image processing method of the embodiment of the present application can be completed by controlling the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, such as a memory, and executed by at least one processor, and the execution process may include the process of the embodiment of the image processing method. Among them, the computer-readable storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), etc.
[0173] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0174] For the image processing device of the embodiment of the present application, each functional module can be integrated into a processing chip, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium, such as a read-only memory, a disk or an optical disk.
[0175] The above is a detailed introduction to an image processing method, device, storage medium and electronic device provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. An image processing method, characterized in that: include: Determine the loss color depth according to the color depths corresponding to the original image and the display device respectively, and obtain a dither matrix corresponding to the loss color depth; According to the loss color depth, dividing the pixel value of each pixel of the original image into a to-be-compensated value and a reference compensation value; Determining a target value to be compensated from the values to be compensated according to the reference compensation value, the loss color depth, and the dither matrix; The target value to be compensated is compensated to obtain a compensated image.
2. The image processing method according to claim 1, characterized in that: The step of dividing the pixel value of each pixel of the original image into a to-be-compensated value and a reference compensation value according to the loss color depth comprises: According to the size of the dither matrix, the original image is divided into a plurality of areas to be compensated; According to the loss color depth, dividing the pixel value of each pixel in each of the to-be-compensated areas into a to-be-compensated value and a reference compensation value; The determining a target value to be compensated from the values to be compensated according to the reference compensation value, the loss color depth, and the dither matrix comprises: Determine a target value to be compensated from the values to be compensated of each area to be compensated according to the reference compensation value of each area to be compensated, the loss color depth, and the dither matrix, to obtain the target value to be compensated of each area to be compensated; The compensating the target value to be compensated to obtain a compensated image includes: The target to-be-compensated value of each of the to-be-compensated areas is compensated to obtain a plurality of compensated areas, and the plurality of compensated areas constitute the compensated image.
3. The image processing method according to claim 2, characterized in that: The step of determining a target value to be compensated from the value to be compensated of each area to be compensated according to the reference compensation value of each area to be compensated, the loss color depth, and the dither matrix comprises: Calculating the sum of all reference compensation values of each of the areas to be compensated to obtain a first target value corresponding to each of the areas to be compensated; Obtaining a first preset value, and calculating the power of the loss color depth of the first preset value to obtain a second target value corresponding to each of the areas to be compensated; According to the first target value and the second target value corresponding to each of the areas to be compensated, and the dither matrix, a target value to be compensated is determined from the values to be compensated of each of the areas to be compensated.
4. The image processing method according to claim 3, characterized in that: The step of determining a target value to be compensated from the value to be compensated of each area to be compensated according to the first target value and the second target value corresponding to each area to be compensated, and the jitter matrix, comprises: Obtaining a second preset value, and calculating the product of the first target value corresponding to each of the areas to be compensated and the second preset value, to obtain a third target value corresponding to each of the areas to be compensated; Calculating the quotient of the third target value corresponding to each of the to-be-compensated areas and the second target value corresponding to each of the to-be-compensated areas to obtain a fourth target value corresponding to each of the to-be-compensated areas; According to the fourth target value corresponding to each of the to-be-compensated areas and the jitter matrix, a target to-be-compensated value is determined from the to-be-compensated values of each of the to-be-compensated areas.
5. The image processing method according to claim 4, characterized in that: The step of determining a target value to be compensated from the value to be compensated of each area to be compensated according to the fourth target value corresponding to each area to be compensated and the jitter matrix includes: Determine from the jitter matrix an element whose element value is less than a fourth target value corresponding to each of the to-be-compensated areas, and obtain an element corresponding to each of the to-be-compensated areas; The to-be-compensated value of the pixel corresponding to the element corresponding to each of the to-be-compensated areas is determined as the target to-be-compensated value.
6. The image processing method according to any one of claims 2 to 5, characterized in that: The target to-be-compensated value of each to-be-compensated area is compensated to obtain a plurality of compensated areas, including: Obtaining a third preset value, and calculating the sum of the target value to be compensated of each of the areas to be compensated and the third preset value, to obtain a reference compensated value of each of the areas to be compensated; Determining a fifth target value according to the color depth corresponding to the original image and the loss color depth; For each of the reference compensated values of the area to be compensated that is greater than the fifth target value, it is modified to the fifth target value, and for each of the reference compensated values of the area to be compensated that is less than or equal to the fifth target value, its value remains unchanged, thereby obtaining multiple compensated areas.
7. The image processing method according to claim 1, characterized in that: After compensating the target value to be compensated to obtain the compensated image, the method further includes: The compensated image is displayed by the display device.
8. An image processing device, characterized in that: include: An acquisition module, used to determine the loss color depth according to the color depths corresponding to the original image and the display device, and to acquire a dither matrix corresponding to the loss color depth; A division module, used for dividing the pixel value of each pixel of the original image into a to-be-compensated value and a reference compensation value according to the loss color depth; A determination module, configured to determine a target value to be compensated from the values to be compensated according to the reference compensation value, the loss color depth, and the dither matrix; The compensation module is used to compensate the target value to be compensated to obtain a compensated image.
9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed on a computer, the computer is enabled to execute the image processing method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein a computer program is stored in the memory, and the processor is used to execute the image processing method according to any one of claims 1 to 7 by calling the computer program stored in the memory.
Citation Information
Patent Citations
Image processing method and apparatus and terminal
CN106162130A
Video frame processing method, device and equipment and storage medium
CN110191340A
Video image color depth conversion method, system and device
CN112689139A
Method and related circuit for color depth enhancement of displays
US20090251483A1
Spatio-temporal color luminance dithering techniques
US20120154428A1
