Color ink screen display effect optimization method, device, color ink screen and medium
By diffusing errors and lowering the color images of the color ink screen, and mapping pixel values according to their color masks, the problem of poor color images displayed by color ink screens is solved, achieving a more natural and smooth image display effect.
Patent Information
- Application Number
- CN202410731698.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2044-06-06
AI Technical Summary
When color ink screens directly display color images, color blocks, non-smoothing and color distortion are prone to problems, and cannot effectively display systems that support 16777216 colors included in RGB 888.
By performing error diffusion and downgrade processing on the original color image, a downgrade image is obtained; according to the color mask arrangement of the color ink screen, the pixel values of the downgrade image are mapped into brightness values to obtain a brightness image; the error diffusion processing is performed on the brightness image to generate a target color image, and finally the color ink screen displays the target image.
The color levels are effectively reduced, and the initial smoothing effect of the color is achieved, making the processed image more close to the actual display ability of the color ink screen in color, improving the detailed expression of the image, and presenting a more natural and smooth visual effect.
Smart Images

Figure CN118506742B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of display technology, and in particular to a method and device for optimizing the display effect of a color ink screen, a color ink screen, and a medium. Background Art
[0002] The ink screen can only display 16-level grayscale color images. In a system that supports the 16,777,216 colors included in RGB 888, if the color image is displayed directly on the ink screen without being processed, problems such as color blocks and unevenness will occur.
[0003] Since the principle of Kaleido color ink screen is to cover a layer of color mask (ColorFilter Array) on the black and white ink screen, use 3 pixels to represent 1 pixel, and then realize color display based on the color mixing principle of human eyes, therefore, the conventional color image smoothing method cannot achieve the best display effect. Summary of the invention
[0004] In view of this, the present application provides a method, device, color ink screen and storage medium for optimizing the display effect of a color ink screen to solve the technical problem of poor effect of directly displaying color images on a color ink screen.
[0005] A first aspect of the present application provides a method for optimizing a color ink screen display effect, the method comprising:
[0006] Perform error diffusion and order reduction processing on the original color image to obtain a reduced-order image;
[0007] According to the color mask arrangement of the color ink screen, the pixel values of the reduced-order image are mapped to brightness values to obtain a brightness image; and the brightness image is subjected to error diffusion processing to obtain a target color image;
[0008] Control the color ink screen to display the target color image.
[0009] Optionally, performing error diffusion and order reduction processing on the original color image to obtain the reduced-order image includes:
[0010] Traversing a plurality of pixel points of the original color image according to a preset traversal order;
[0011] For each pixel point traversed, obtain the original pixel grayscale value of the pixel point in each color channel;
[0012] Determining a diffusion error corresponding to the original pixel grayscale value;
[0013] Calculating a first pixel grayscale value based on the original pixel grayscale value and the corresponding diffusion error;
[0014] Performing downscaling processing on the first pixel grayscale value to obtain a second pixel grayscale value;
[0015] performing error diffusion processing on the second pixel grayscale value difference according to a preset error diffusion path;
[0016] When the traversal is finished, the reduced-order image is obtained according to each of the second pixel grayscale values.
[0017] Optionally, the performing downscaling processing on the first pixel grayscale value to obtain the second pixel grayscale value includes:
[0018] Obtaining the grayscale level of the color ink screen;
[0019] Using a first preset formula, calculating based on the first pixel grayscale value and the grayscale number, to obtain an intermediate pixel grayscale value;
[0020] A second preset formula is used to calculate based on the intermediate pixel grayscale value and the grayscale level to obtain the second pixel grayscale value.
[0021] Optionally, the using a first preset formula to calculate based on the first pixel grayscale value and the grayscale level to obtain the intermediate pixel grayscale value includes:
[0022] Determine an offset according to the grayscale number;
[0023] Obtaining an offset pixel value based on the first pixel grayscale value and the offset;
[0024] The first preset formula is used to calculate based on the offset pixel value and the grayscale level to obtain the intermediate pixel grayscale value.
[0025] Optionally, determining the diffusion error corresponding to the original pixel grayscale value includes:
[0026] Determine a plurality of error diffusion source pixel grayscale values corresponding to the original pixel grayscale value;
[0027] Based on the diffusion error corresponding to the grayscale value of each error diffusion source pixel and a preset weight ratio, the diffusion error corresponding to the original pixel grayscale value is determined.
[0028] Optionally, mapping the pixel values of the reduced-order image to brightness values according to the color mask arrangement of the color ink screen to obtain the brightness image includes:
[0029] Determining a plurality of second pixel points in the reduced-order image corresponding to each first pixel point of the color ink screen;
[0030] Determining a color mask corresponding to each first pixel according to the color mask arrangement of the color ink screen;
[0031] Obtaining a color component value of each second pixel corresponding to the first pixel in a color channel corresponding to the color mask, and obtaining a brightness value based on a plurality of the color component values;
[0032] The brightness value corresponding to each first pixel point of the color ink screen is used to obtain a brightness image.
[0033] Optionally, before performing error diffusion and order reduction processing on the original color image, the method further includes:
[0034] The data format of the original color image is converted into a specified format.
[0035] A second aspect of the present application provides a device for optimizing the display effect of a color ink screen, the device comprising:
[0036] A diffusion and order reduction module is used to perform error diffusion and order reduction processing on the original color image to obtain a reduced-order image;
[0037] A pixel mapping module, used to map the pixel values of the reduced-order image into brightness values according to the color mask arrangement of the color ink screen, so as to obtain a brightness image;
[0038] An error diffusion module, used for performing error diffusion processing on the brightness image to obtain a target color image;
[0039] An image display module is used to control the color ink screen to display the target color image.
[0040] A third aspect of the present application provides a color ink screen, comprising:
[0041] a memory storing a computer program;
[0042] The processor implements the steps of the color ink screen display effect optimization method when executing the computer program.
[0043] The fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the color ink screen display effect optimization method.
[0044] The color ink screen display effect optimization method, device, color ink screen and medium provided in the embodiments of the present application effectively reduce the color levels by performing error diffusion and order reduction processing on the original color image, and achieve a preliminary color smoothing effect, so that the processed reduced-order image is closer to the actual display capability of the color ink screen in color; according to the color mask arrangement of the color ink screen, the pixel values of the reduced-order image are mapped to brightness values, and a brightness image matching the display characteristics of the color ink screen can be obtained; secondary error diffusion processing is performed on the brightness image, which can further smooth the color transition in the image, reduce color faults and quantization noise, and help improve the detail expression of the image, so that the image presents a more natural and smooth visual effect on the ink screen. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 It is a flow chart of a method for optimizing the display effect of a color ink screen shown in an embodiment of the present application;
[0046] Figure 2 It is a functional module diagram of a color ink screen display effect optimization device shown in an embodiment of the present application;
[0047] Figure 3 This is a structural diagram of the color ink screen shown in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to any or all possible combinations comprising one or more of the listed items.
[0049] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0050] Original color images are usually high-resolution, high-color-depth digital images, where the color of each pixel is represented by the values of three color channels: red, green, and blue (RGB). The value of each color channel is usually an integer between 0 and 255 (for 8-bit depth), so that each pixel can represent more than 16 million different colors.
[0051] However, color ink screens, such as Kaleido ink screens, can only display a limited number of colors due to the limitations of their display technology, and these colors are presented in the form of grayscale color images with 16 grayscale levels. This means that if the original color image is directly displayed on a Kaleido color ink screen, the following problems may occur:
[0052] 1) Color blocks: Since the Kaleido color ink screen cannot display all the colors in the original image, it may use similar colors to replace the original colors, resulting in obvious color blocks on the screen.
[0053] 2) Unsmooth: Due to the limitation of the number of colors, the transition and gradient of the image may not be displayed smoothly, causing the image to look jagged or unsmooth.
[0054] 3) Color distortion: Some colors in the original image may not be accurately represented on the Kaleido color ink screen, resulting in color distortion.
[0055] In order to overcome at least one of the above problems, the original color image needs to be processed so as to better adapt to the display characteristics of the color ink screen, thereby achieving a more accurate and smoother display effect on the color ink screen.
[0056] It should be noted that before processing the original color image, it is necessary to first identify the data format of the original color image. If the data format of the original color image is a pre-specified data format, for example, RGB 888 format, there is no need to convert the data format of the original color image. If the data format of the original color image is not a pre-specified data format, it is necessary to use an image processing library or tool to convert the data format of the original color image to a specified format (for example, from RGB 565 to RGB 888). The data format of the original color image can be identified by reading the metadata of the original color image.
[0057] Since the RGB 888 format provides sufficient color depth and precision, it can represent very rich colors. In addition, since each color channel is represented by 8 bits, the RGB 888 format is very easy to process and calculate. The present application first converts the original color image into the RGB 888 format to ensure that the subsequent processing steps can fully utilize the advantages of the RGB 888 format, thereby generating a high-quality output image.
[0058] See also Figure 1 As shown, a method for optimizing the display effect of a color ink screen is provided in an embodiment of the present application, and the method for optimizing the display effect of a color ink screen specifically includes the following steps.
[0059] S11, performing error diffusion and order reduction processing on the original color image to obtain a reduced-order image.
[0060] Each pixel of the original color image can be traversed, and each time a pixel is traversed, the pixel is subjected to error diffusion and order reduction processing, and the next pixel is traversed after the error diffusion and order reduction processing is completed. The next pixel traversed is also subjected to error diffusion and order reduction processing until all the pixels are traversed.
[0061] In an optional implementation, the performing error diffusion and order reduction processing on the original color image to obtain the reduced-order image includes:
[0062] Traversing a plurality of pixel points of the original color image according to a preset traversal order;
[0063] For each pixel point traversed, obtain the original pixel grayscale value of the pixel point in each color channel;
[0064] Determining a diffusion error corresponding to the original pixel grayscale value;
[0065] Calculating a first pixel grayscale value based on the original pixel grayscale value and the corresponding diffusion error;
[0066] Performing downscaling processing on the first pixel grayscale value to obtain a second pixel grayscale value;
[0067] performing error diffusion processing on the second pixel grayscale value difference according to a preset error diffusion path;
[0068] When the traversal is finished, the reduced-order image is obtained according to each of the second pixel grayscale values.
[0069] The preset traversal order is a preset order for indicating how to traverse multiple pixel points of the original color image. The preset traversal order can be from left to right and from top to bottom. That is, starting from the first pixel point of the first row of the original color image, traverse rightward one by one to the last pixel point of the first row; then move to the first pixel point of the second row, and continue to traverse rightward to the last pixel point of the second row; and so on, until the last pixel point of the last row of the original color image is traversed, at which time the traversal ends.
[0070] The preset error diffusion path is a preset position for indicating the position of the traversed original pixel grayscale value for error diffusion, that is, the original pixel grayscale value to which the traversed original pixel grayscale value will be error diffused next.
[0071] In an optional embodiment, the preset error diffusion path is error diffusion to one or more positions to the right of the neighbor, or error diffusion to one or more positions below the neighbor, or error diffusion to one or more positions to the right and below the neighbor at the same time. The error diffusion path can be set and adjusted according to actual needs, and this application does not impose any restrictions here.
[0072] For each pixel point traversed each time, the pixel grayscale value (original pixel grayscale value) of the pixel point in the three color channels of R, G, and B is obtained. For the original pixel grayscale value of each pixel point in each color channel, a diffusion error related to the original pixel grayscale value is determined. According to the sum of the original pixel grayscale value and the corresponding diffusion error, the first pixel grayscale value is calculated.
[0073] Since the pixel value of each pixel of the original color image includes the pixel grayscale values of the three color channels R, G, and B, it is necessary to perform downscaling processing on the original pixel grayscale value of each pixel of the original color image in each color channel to obtain a corresponding second pixel grayscale value. The main purpose of downscaling is to reduce the color depth of the original color image, that is, to reduce the value of each color channel from 8 bits to a grayscale suitable for color ink screen display (for example, to 4 bits or less) to reduce the number of colors.
[0074] For each color channel of each pixel, a "diffusion error" is calculated based on the second pixel grayscale value and a possible error diffusion algorithm (such as the Floyd-Steinberg algorithm). Then, this diffusion error is distributed to the surrounding pixels according to a preset error diffusion path.
[0075] When traversing the next pixel of the original color image, it is necessary to first add the diffusion error from other pixels, and then perform the reduction process. This process is repeated until all pixels of the original color image are traversed and processed, and a reduced-order image is generated based on the second pixel grayscale value of each pixel. The reduced-order image may differ from the original color image in color depth, grayscale level, or other image quality parameters, but it will maintain a certain visual similarity.
[0076] In an optional implementation, determining the diffusion error corresponding to the original pixel grayscale value includes:
[0077] Determine a plurality of error diffusion source pixel grayscale values corresponding to the original pixel grayscale value;
[0078] Based on the diffusion error corresponding to the grayscale value of each error diffusion source pixel and a preset weight ratio, the diffusion error corresponding to the original pixel grayscale value is determined.
[0079] In the error diffusion process, the pixel gray value of a pixel will not only affect its own output, but also its adjacent pixels. These adjacent pixels may become the source of error diffusion for other pixels in subsequent iterations. That is, the calculation of the pixel gray value of the current pixel is not only based on its original pixel gray value, but also affected by the gray values of other pixels in its adjacent or specific positions. These pixels in adjacent or other specific positions that affect the gray value of the current pixel are called error diffusion source pixels. Exemplarily, when the preset error diffusion path is to the right, downward, lower left and lower right, then, for each pixel, it will be affected by the error diffusion of pixels from the left, above, upper left and upper right.
[0080] In the error diffusion process, when the grayscale value of a pixel is quantized or processed, a certain error may be generated (i.e. the difference between the original pixel grayscale value and the quantized pixel grayscale value). This error will not be simply discarded, but will diffuse to adjacent pixels according to certain rules to reduce the quantization error of the overall image.
[0081] Therefore, when calculating the grayscale value of a pixel, not only its original grayscale value but also the error diffused from its error diffusion source pixel should be considered. The grayscale values of these error diffusion source pixels, plus their respective diffusion errors (calculated according to a certain weight ratio or rule), jointly determine the final grayscale value of the current pixel (i.e., the first pixel grayscale value).
[0082] The preset weight ratio may be a value set based on experimental experience, and is used to determine the degree of influence of different error diffusion source pixels on the grayscale value of the current pixel. The preset weight ratio may be adjusted based on the relative position between pixels, color differences, or other factors.
[0083] For each error diffusion source pixel, it is necessary to know the diffusion error generated in the previous iteration. This diffusion error may be a specific value, representing the gray value difference that was not fully processed in the previous iteration. After determining the diffusion error and corresponding weight ratio of each error diffusion source pixel, these errors can be multiplied by the weight and the results can be added to obtain the total diffusion error corresponding to the original pixel gray value.
[0084] It should be understood that, since the error diffuses to the right and / or downward, the original pixel grayscale value of the first pixel point of the original color image in each color channel has no error diffusion source pixel, then the diffusion error corresponding to the original pixel grayscale value of the first pixel point of the original color image in each color channel is 0, and the first pixel grayscale value of the first pixel point in each color channel is the original pixel grayscale value. In other words, the first pixel point of the original color image can be directly reduced to obtain the second pixel grayscale value. For the second pixel point of the original color image, the diffusion error from the first pixel point is first determined, the first pixel grayscale value is calculated, and then the calculated first pixel grayscale value is reduced.
[0085] In the above optional implementation, the diffusion error corresponding to the original pixel grayscale value can be calculated more accurately, and the diffusion error can be better processed in subsequent iterations, thereby obtaining a smoother and more natural image effect.
[0086] In an optional implementation, the step of reducing the grayscale value of the first pixel to obtain the second pixel grayscale value includes:
[0087] Obtaining the grayscale level of the color ink screen;
[0088] Using a first preset formula, calculating based on the first pixel grayscale value and the grayscale number, to obtain an intermediate pixel grayscale value;
[0089] A second preset formula is used to calculate based on the intermediate pixel grayscale value and the grayscale level to obtain the second pixel grayscale value.
[0090] Grayscale S refers to the number of gray levels that the color ink screen can display, which represents the display capability of the color ink screen. Even if the color ink screen displays a color image, the brightness of each color channel (such as red, green, and blue) is still expressed through different grayscale levels. For a color ink screen with S-level grayscale, it means that each color channel can display S different brightness levels from the darkest to the lightest.
[0091] Optionally, the first preset formula is expressed as follows: R1=r0 / / S, where “ / / ” represents integer division, S represents the grayscale number of the color ink screen, r0 represents the pixel grayscale value of the R color channel, that is, the first pixel grayscale value (the sum of the original pixel grayscale value and the corresponding diffusion error), and R1 represents the intermediate pixel grayscale value. The first pixel grayscale value (usually in the range of 0-255) is preliminarily quantized to a range that matches the grayscale number S of the color ink screen. For S-level grayscale, the first pixel grayscale value is divided by the grayscale number by the preset first formula and the integer part is taken (that is, the integer division of the grayscale number), and an integer between 0 and (S-1) (that is, the intermediate pixel grayscale value) is obtained. The intermediate pixel grayscale value represents the position of the original pixel grayscale value in the S grayscale levels.
[0092] Optionally, S can be 16. 16-level grayscale means there are only 16 different gray levels, each corresponding to an integer. By dividing the original pixel gray value by 16, the range of the original pixel gray value (0-255) is actually divided into 16 equal-width intervals, each corresponding to a gray level.
[0093] Although an integer value matching the grayscale number is calculated by the first preset formula, this value may not be one of the grayscale levels that the color ink screen can actually display (because the grayscale levels of the color ink screen are usually discrete, such as 0, 16, 32, ..., 240). Therefore, it is necessary to multiply the quantized intermediate pixel grayscale value by the grayscale number to convert it back to an actual grayscale value to ensure that the obtained pixel value is one of the grayscale levels that the color ink screen can actually support, thereby avoiding problems such as color distortion or unevenness during display.
[0094] Optionally, the second preset formula is expressed as follows: R2=R1*S, where R2 represents a second pixel grayscale value suitable for display on a color ink screen.
[0095] After obtaining the second pixel grayscale value corresponding to each pixel point in each color channel of the original color image, the second pixel grayscale value corresponding to each pixel point in each color channel can be combined to obtain a downscaled image. The grayscale level of the downscaled image is less than or equal to the grayscale level of the original color image.
[0096] Exemplarily, it is assumed that the original color image includes the following pixels:
[0097] rgb_0 rgb_1 rgb_2 rgb_3 rgb_4 rgb_5 rgb_6 rgb_7 rgb_8
[0098] In the original color image, the original pixel corresponding to the R color channel in the nth pixel point rgb_n is the r value; the original pixel corresponding to the G color channel is the g value; and the original pixel corresponding to the B color channel is the b value.
[0099] Taking the R color channel as an example, the G color channel and the B color channel are processed according to the R color channel. Assume that the original pixel grayscale value of the R color channel of the original color image is as follows:
[0100] r_0 r_1 r_2 r_3 r_4 r_5 r_6 r_7 r_8
[0101] Since the color ink screen only supports 16 grayscales physically, that is, the grayscale value only supports discrete points {0, 16, 32, 48, ..., 240}. Therefore, the r value of the original color image is divided by 16 and then multiplied by 16, that is, R = (r / / 16)*16, so that the r value of the original color image can be converted to the R value supported by the color ink screen.
[0102] In the above optional implementation, by obtaining the grayscale number of the color ink screen, understanding the display capability of the color ink screen, and calculating according to the first preset formula and the second preset formula, the original pixel grayscale value RGB value of each pixel point of the original color image will be replaced with a new RGB value (intermediate pixel grayscale value), thereby obtaining a downgraded image. This ensures that the color information in the original color image is correctly mapped to the grayscale level that the color ink screen can display, which helps to avoid color distortion, color blocks or unevenness that may occur when displaying the original image on the color ink screen, thereby improving the display quality of the image on the color ink screen.
[0103] When performing downscaling, directly dividing the original pixel grayscale value may cause the loss of color information, resulting in uneven distribution of pixel values after downscaling, especially when the original pixel grayscale value is close to between two adjacent grayscale levels. This is because directly dividing by the grayscale level (for example, 16) may cause some pixel values to be "discarded" or "merged".
[0104] In order to reduce this loss and ensure that the grayscale value of the first pixel can be more accurately mapped to the closest grayscale level, the grayscale value of the first pixel may be offset.
[0105] In an optional implementation, the using a first preset formula to calculate based on the first pixel grayscale value and the grayscale level to obtain the intermediate pixel grayscale value includes:
[0106] Determine an offset according to the grayscale number;
[0107] Obtaining an offset pixel value based on the first pixel grayscale value and the offset;
[0108] The first preset formula is used to calculate based on the offset pixel value and the grayscale level to obtain the intermediate pixel grayscale value.
[0109] According to the grayscale number S, a suitable offset Y is selected. The offset Y is used to adjust the original pixel grayscale value so that the pixel value distribution after downscaling is more uniform, reducing the "discarding" or "merging" phenomenon caused by direct division.
[0110] Optionally, half of the grayscale level may be determined as the offset Y. That is, Y=S / 2, the purpose is to "center" the distribution of the original pixel grayscale values and simulate the effect of rounding.
[0111] Add the original pixel gray value r0 to the offset Y to get the offset pixel value. The offset pixel value represents the degree of offset of the original pixel gray value relative to its closest gray level. Divide the offset pixel value by the gray scale number S to get the intermediate pixel gray value R1 = (r0 + Y) / / S. The intermediate pixel gray value will be within the new gray scale range and as close as possible to the color represented by the original pixel gray value.
[0112] Exemplarily, assuming that the grayscale number S=16, the offset Y=8, then the intermediate pixel grayscale value R1=(r0+8) / / 16, the second pixel grayscale value R2=((r0+8) / / 16)*16. This means that when downgrading to the 16-level grayscale, 8 is added to each original pixel grayscale value, and then divided by 16, in order to make the distribution of the original pixel grayscale value more evenly mapped to the 16-level grayscale. In addition, the purpose of adding 8 can also achieve the "centering" distribution of the original pixel grayscale value. Assuming that the range of the original pixel grayscale value is 0-255 (8 bits), then adding 8 and then dividing by 16 is equivalent to mapping the original range to 0-15 (4 bits), that is, the midpoint of the original range (128) will be mapped to the midpoint of the downgraded range (8). Furthermore, by determining half of the grayscale number as the offset Y, the effect of rounding can be simulated in the downgrading process. In this way, the obtained offset pixel value will be closer to the actual value of the original pixel grayscale value, thereby reducing the loss of color information.
[0113] The above optional implementation method can reduce the loss of color information caused by rounding off or rounding by determining the offset and calculating the offset pixel value, thereby reducing the color distortion of the image when it is displayed on the color ink screen; the intermediate pixel grayscale value is calculated based on the offset pixel value and the grayscale level using the first preset formula, which can ensure that the original pixel grayscale value is more accurately mapped to the closest grayscale level, thereby improving the color accuracy of the image displayed on the color ink screen. Due to the improvement in color accuracy and color distortion, the pixel value distribution of the image after the downscaling process is more uniform, and it will have a better visual effect when displayed on the color ink screen, making the image look smoother and more natural.
[0114] In order to make the inventive concept of performing error diffusion and order reduction processing on the original color image in the present application more clear, the present application provides examples for illustration.
[0115] Assuming that the error diffusion path is: one position to the right, one position to the bottom, one position to the lower left, and one position to the lower right, the corresponding weight ratios are shown in the following table:
[0116] E_1 E_1*7 / 16 E_1*3 / 16 E_1*5 / 16 E_1*1 / 16
[0117] Taking the R color channel as an example, for the pixel Pixel_1 of the original color image, the R value (R_1) supported by the color ink screen is subtracted from the r value (r_1) of Pixel_1 to obtain the error value E_1 = R_1 – r_1. The error value E_1 is diffused to the surrounding pixels according to the error diffusion path and its corresponding weight ratio, so that the pixel is more uniform with the surrounding pixels.
[0118] Next, when processing pixel Pixel_2, the error diffused from Pixel_1 needs to be added first, and then the order reduction process is performed. That is, the second pixel grayscale value corresponding to Pixel_2 is R_2 = ((r_2+(E1*7 / 16)+Y) / / S)*S.
[0119] For Pixel_2, the difference between the R_2 value and r_2 is the error value E_2 of Pixel_2. The error value E_2 is diffused to the surrounding pixels according to the error diffusion path and its corresponding weight ratio.
[0120] Next, when processing pixel Pixel_3, the error diffused from Pixel_2 needs to be added first, and then the order reduction process is performed. That is, the second pixel grayscale value corresponding to Pixel_3 is R_3 = ((r_3 + (E2*7 / 16) + Y) / / S) * S.
[0121] When all the pixels are traversed, the error diffusion process of the R channel is completed. Similarly, the error diffusion process and the order reduction process are performed on the G channel and the B channel to obtain a preliminarily smoothed reduced-order image.
[0122] S12, mapping the pixel values of the reduced-order image into brightness values according to the color mask arrangement of the color ink screen to obtain a brightness image.
[0123] The color ink screen adds a layer of R, G, B color mask (Color FilterArray) on the black and white ink screen, uses three black and white pixels to represent one color pixel, and uses the color mixing principle of the human eye to obtain a simulated color image. In order to map the pixel value of the reduced-order image to the brightness value of the color ink screen, it is necessary to process each RGB pixel group in the reduced-order image according to the color mask arrangement order of the color ink screen to obtain the color arrangement supported by the color ink screen.
[0124] In an optional implementation, mapping the pixel values of the reduced-order image to brightness values according to the color mask arrangement of the color ink screen to obtain the brightness image includes:
[0125] Determining a plurality of second pixel points in the reduced-order image corresponding to each first pixel point of the color ink screen;
[0126] Determining a color mask corresponding to each first pixel according to the color mask arrangement of the color ink screen;
[0127] Obtaining a color component value of each second pixel corresponding to the first pixel in a color channel corresponding to the color mask, and obtaining a brightness value based on a plurality of the color component values;
[0128] The brightness value corresponding to each first pixel point of the color ink screen is used to obtain a brightness image.
[0129] Color mask arrangement refers to how color masks are arranged in pixels.
[0130] For ease of description, the pixel points in the color ink screen are taken as the first pixel points, and the pixel points in the reduced-order image are taken as the second pixel points. First, determine which pixel points in the reduced-order image will be used to generate the brightness value of each pixel point on the color ink screen. Then, based on the physical characteristics of the color ink screen (i.e., its color mask arrangement), determine the color mask corresponding to each pixel point of the color ink screen. From the reduced-order image, extract multiple pixel points corresponding to the pixel points of the color ink screen, and obtain the color component values of these pixel points in the color channel corresponding to the color mask. Use one or more algorithms (such as weighted average or other color-to-brightness conversion algorithms) to calculate a brightness value based on the acquired color component values. Combine the brightness values corresponding to each pixel point of the color ink screen to form a final brightness image.
[0131] For example, it is assumed that the reduced-order image obtained after preliminary smoothing is as follows:
[0132] RGB_0 RGB_1 RGB_2 RGB_3 RGB_4 RGB_5 RGB_6 RGB_7 RGB_8 RGB_9 RGB_10 RGB_11 RGB_12 RGB_13 RGB_14 RGB_15 RGB_16 RGB_17
[0133] The color masks of the color ink screen are arranged as follows:
[0134] Red (R) Green (G) Blue (B) Red (R) Green (G) Blue (B) Blue (B) Red (R) Green (G) Blue (B) Red (R) Green (G) Green (G) Blue (B) Red (R) Green (G) Blue (B) Red (R)
[0135] The first pixel point P0 in the first row and first column of the color ink screen corresponds to multiple second pixel points RGB_0, RGB_1, and RGB_2 in the reduced-order image. Since the color mask corresponding to the first pixel point P0 is red, the color component values R_0, R_1, and R_2 of the second pixel points RGB_0, RGB_1, and RGB_2 in the red channel are obtained respectively, and the brightness value L0 = (R_0+R_1+R_2) / 3 is obtained based on the average value of the obtained color component values R_0, R_1, and R_2.
[0136] The first pixel point P1 in the first row and second column of the color ink screen corresponds to multiple second pixel points RGB_0, RGB_1, and RGB_2 in the reduced-order image. Since the color mask corresponding to the first pixel point P1 is green, the color component values G_0, G_1, and G_2 of the second pixel points RGB_0, RGB_1, and RGB_2 in the green channel are obtained respectively, and the brightness value L1 = (G_0+G_1+G_2) / 3 is obtained based on the average value of the obtained color component values G_0, G_1, and G_2.
[0137] The first pixel point P2 in the first row and third column of the color ink screen corresponds to multiple second pixel points RGB_0, RGB_1, and RGB_2 in the reduced-order image. Since the color mask corresponding to the first pixel point P2 is blue, the color component values B_0, B_1, and B_2 of the second pixel points RGB_0, RGB_1, and RGB_2 in the blue channel are obtained respectively, and the brightness value L2 = (B_0+B_1+B_2) / 3 is obtained based on the average value of the obtained color component values B_0, B_1, and B_2.
[0138] The first pixel point P3 in the first row and fourth column of the color ink screen corresponds to multiple second pixel points RGB_3, RGB_4, and RGB_5 in the reduced-order image. Since the color mask corresponding to the first pixel point P3 is red, the color component values R_3, R_4, and R_5 of the second pixel points RGB_3, RGB_4, and RGB_5 in the red channel are obtained respectively, and the brightness value L3 = (R_3+R_4+R_5) / 3 is obtained based on the average value of the obtained color component values R_3, R_4, and R_5.
[0139] It can be seen that every three second pixels in the reduced-order image correspond to three first pixels on the color ink screen, and the color component values of the three second pixels in the three color channels just correspond to the brightness values of the three first pixels.
[0140] S13, performing error diffusion processing on the brightness image to obtain a target color image.
[0141] Since the brightness value is calculated by taking the average value or weighted mean value or other methods, the brightness value obtained may not directly correspond to the discrete grayscale value of the color ink screen and cannot meet the grayscale display requirements of the color ink screen. That is, the brightness value does not necessarily fall within the discrete points of {0, S, 2S, 3S, 4S, ..., NS}. Therefore, it is necessary to smooth these brightness values through error diffusion processing so that they can better adapt to the display capabilities of the color ink screen.
[0142] You can choose a suitable error diffusion kernel, such as the Floyd-Steinberg kernel or other similar kernels. The error diffusion kernel defines how to distribute the error (i.e., the difference between the brightness value and the closest discrete grayscale value) to adjacent pixels. Traverse each pixel in the brightness image. For each traversed pixel, calculate the difference between its brightness value and the closest discrete grayscale value to obtain the error value. Distribute the error value to adjacent pixels according to the weight of the error diffusion kernel. That is, add part of the error to the brightness value of the current pixel, and disperse the rest to the surrounding pixels. Update the brightness value of each pixel based on the result of the error diffusion. Repeat the above steps until all brightness values have been processed.
[0143] The error diffusion process can also be performed on the brightness image according to the process of performing error diffusion process on the pixels of the original color image in each color channel. That is, the process of performing error diffusion process on the brightness image is the same as the process of performing error diffusion process on the pixels of the original color image in each color channel, and this application will not be described in detail.
[0144] S14, controlling the color ink screen to display the target color image.
[0145] By traversing all the pixels of the target color image, the corresponding grayscale image transmitted to the color ink screen can be obtained. Even if the original color image is 256 grayscales, it can be displayed very evenly on the color ink screen.
[0146] Since the color ink screen is covered with a color mask, the conventional color smoothing algorithm is used for image processing, resulting in poor display effects. This application first performs error diffusion and downscaling on each color channel of the original color image, effectively reducing the color levels in the image and achieving a preliminary color smoothing effect, so that the processed downscaled image is closer to the actual display capability of the color ink screen in color, laying the foundation for subsequent image processing. Then, according to the unique color mask arrangement of the color ink screen, the pixel values of the downscaled image are accurately mapped to brightness values, ensuring that the generated brightness image is highly matched with the display characteristics of the color ink screen, thereby ensuring that the brightness performance of the image on the ink screen is more in line with the visual habits of the human eye. Finally, the brightness image is subjected to secondary error diffusion processing to further smooth the color transition in the image, effectively reducing color faults and quantization noise, so that the image presents a more natural and smooth visual effect on the ink screen.
[0147] Figure 2 It is a structural diagram of the color ink screen display effect optimization device provided in an embodiment of the present application.
[0148] In some embodiments, the color ink screen display effect optimization device 20 may include multiple functional modules composed of computer program segments. The computer programs of each program segment in the color ink screen display effect optimization device 20 may be stored in the memory of the color ink screen and executed by at least one processor to execute (see Figure 1 Description) This function optimizes the display effect of the color ink screen.
[0149] In this embodiment, the color ink screen display effect optimization device 20 can be divided into multiple functional modules according to the functions it performs. The functional modules may include: a diffusion reduction module 201, a pixel mapping module 202, an error diffusion module 203, an image display module 204 and a format conversion module 205. The module referred to in this application refers to a series of computer program segments that can be executed by at least one processor and can perform fixed functions, which are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
[0150] The diffusion and order reduction module 201 is used to perform error diffusion and order reduction processing on the original color image to obtain a reduced-order image;
[0151] The pixel mapping module 202 is used to map the pixel values of the reduced-order image into brightness values according to the color mask arrangement of the color ink screen to obtain a brightness image;
[0152] The error diffusion module 203 is used to perform error diffusion processing on the brightness image to obtain a target color image;
[0153] The image display module 204 is used to control the color ink screen to display the target color image.
[0154] Optionally, the diffusion and order reduction module 201 performs error diffusion and order reduction processing on the original color image to obtain a reduced-order image including:
[0155] Traversing a plurality of pixel points of the original color image according to a preset traversal order;
[0156] For each pixel point traversed, obtain the original pixel grayscale value of the pixel point in each color channel;
[0157] Determining a diffusion error corresponding to the original pixel grayscale value;
[0158] Calculating a first pixel grayscale value based on the original pixel grayscale value and the corresponding diffusion error;
[0159] Performing downscaling processing on the first pixel grayscale value to obtain a second pixel grayscale value;
[0160] performing error diffusion processing on the second pixel grayscale value difference according to a preset error diffusion path;
[0161] When the traversal is finished, the reduced-order image is obtained according to each of the second pixel grayscale values.
[0162] Optionally, the diffusion reduction module 201 performs reduction processing on the first pixel grayscale value to obtain a second pixel grayscale value including:
[0163] Obtaining the grayscale level of the color ink screen;
[0164] Using a first preset formula, calculating based on the first pixel grayscale value and the grayscale number, to obtain an intermediate pixel grayscale value;
[0165] A second preset formula is used to calculate based on the intermediate pixel grayscale value and the grayscale level to obtain the second pixel grayscale value.
[0166] Optionally, the diffusion order reduction module 201 uses a first preset formula to perform calculation based on the first pixel grayscale value and the grayscale order to obtain an intermediate pixel grayscale value including:
[0167] Determine an offset according to the grayscale number;
[0168] Obtaining an offset pixel value based on the first pixel grayscale value and the offset;
[0169] The first preset formula is used to calculate based on the offset pixel value and the grayscale level to obtain the intermediate pixel grayscale value.
[0170] Optionally, the diffusion order reduction module 201 determines the diffusion error corresponding to the original pixel gray value including:
[0171] Determine a plurality of error diffusion source pixel grayscale values corresponding to the original pixel grayscale value;
[0172] Based on the diffusion error corresponding to the grayscale value of each error diffusion source pixel and a preset weight ratio, the diffusion error corresponding to the original pixel grayscale value is determined.
[0173] Optionally, the pixel mapping module 202 maps the pixel values of the reduced-order image to brightness values according to the color mask arrangement of the color ink screen, and obtains the brightness image including:
[0174] Determining a plurality of second pixel points in the reduced-order image corresponding to each first pixel point of the color ink screen;
[0175] Determining a color mask corresponding to each first pixel according to the color mask arrangement of the color ink screen;
[0176] Obtaining a color component value of each second pixel corresponding to the first pixel in a color channel corresponding to the color mask, and obtaining a brightness value based on a plurality of the color component values;
[0177] The brightness value corresponding to each first pixel point of the color ink screen is used to obtain a brightness image.
[0178] The format conversion module 205 is used to convert the data format of the original color image into a specified format before performing error diffusion and order reduction processing on the original color image.
[0179] It should be understood that the various variations and specific embodiments of the color ink screen display effect optimization method provided in the above-mentioned embodiment are also applicable to the color ink screen display effect optimization device in this embodiment. Through the detailed description of the aforementioned color ink screen display effect optimization method, those skilled in the art can clearly know the implementation process of the color ink screen display effect optimization device in this embodiment. For the sake of brevity of the specification, it will not be described in detail here.
[0180] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, all or part of the steps of the color ink screen display effect optimization method are implemented.
[0181] See also Figure 3 FIG. 2 is a schematic diagram of the structure of the color ink screen provided in the embodiment of the present application. In a preferred embodiment of the present application, the color ink screen 3 includes a memory 31 , at least one processor 32 , and at least one communication bus 33 .
[0182] Those skilled in the art should understand that Figure 3 The structure of the color ink screen shown does not constitute a limitation of the embodiments of the present application. The color ink screen 3 may also include more or less other hardware or software than shown in the figure, or a different arrangement of components.
[0183] In some embodiments, the color ink screen 3 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, and embedded devices. The color ink screen 3 may also include a client device, which includes but is not limited to any electronic product that can interact with a client through a keyboard, mouse, remote control, touchpad, or voice-controlled device, such as a personal computer, tablet computer, smart phone, digital camera, etc.
[0184] It should be noted that the color ink screen 3 is only an example. Other existing or future electronic products that are suitable for the present application should also be included in the protection scope of the present application and included here by reference.
[0185] In some embodiments, the memory 31 stores a computer program, and when the computer program is executed by the at least one processor 32, all or part of the steps in the color ink screen display effect optimization method as described above are implemented. The memory 31 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc read-on memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data. Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, and the like.
[0186] In some embodiments, the at least one processor 32 is the control core (Control Unit) of the color ink screen 3, and uses various interfaces and lines to connect the various components of the entire color ink screen 3, and executes various functions and processes data of the color ink screen 3 by running or executing the program or module stored in the memory 31, and calling the data stored in the memory 31. For example, when the at least one processor 32 executes the computer program stored in the memory, it implements all or part of the steps of the color ink screen display effect optimization method described in the embodiment of the present application; or implements all or part of the functions of the color ink screen display effect optimization device. The at least one processor 32 can be composed of an integrated circuit, for example, it can be composed of a single packaged integrated circuit, or it can be composed of multiple integrated circuits with the same function or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips.
[0187] In some embodiments, the at least one communication bus 33 is configured to realize connection and communication between the memory 31 and the at least one processor 32, etc. Although not shown, the color ink screen 3 may also include a power supply (such as a battery) to power each component. Preferably, the power supply may be logically connected to the at least one processor 32 through a power management device, so as to realize functions such as management of charging, discharging, and power consumption management through the power management device. The power supply may also include any components such as one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, etc. The color ink screen 3 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0188] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a color ink screen (which can be a personal computer, a color ink screen, or a network device, etc.) or a processor to execute part of the method described in each embodiment of the present application.
[0189] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0190] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Claims
1. A method for optimizing the display effect of a color ink screen, characterized in that: The method comprises: Perform error diffusion and order reduction processing on the original color image to obtain a reduced-order image; According to the color mask arrangement of the color ink screen, the pixel values of the reduced-order image are mapped to brightness values to obtain a brightness image; Perform error diffusion processing on the brightness image to obtain the target color image; Controlling the color ink screen to display the target color image; The step of performing error diffusion and order reduction processing on the original color image to obtain the reduced-order image comprises: Traversing a plurality of pixel points of the original color image according to a preset traversal order; For each pixel point traversed, obtain the original pixel grayscale value of the pixel point in each color channel; Determining a diffusion error corresponding to the original pixel grayscale value; Calculating a first pixel grayscale value based on the original pixel grayscale value and the corresponding diffusion error; Performing downscaling processing on the first pixel grayscale value to obtain a second pixel grayscale value; performing error diffusion processing on the second pixel grayscale value according to a preset error diffusion path; When the traversal is finished, a reduced-order image is obtained according to each of the grayscale values of the second pixels; The step of reducing the grayscale value of the first pixel to obtain the second grayscale value of the second pixel includes: Get the grayscale level of the color ink screen; Using a first preset formula, calculating based on the first pixel grayscale value and the grayscale number, to obtain an intermediate pixel grayscale value; The first preset formula is: R1=r0 / / S, " / / " represents integer division, R1 is the gray value of the intermediate pixel; r0 is the gray value of the first pixel, and S is the gray scale number; Using a second preset formula, calculating based on the intermediate pixel grayscale value and the grayscale number, to obtain the second pixel grayscale value; The second preset formula is: R2=R1*S, where R2 is the gray value of the second pixel; Mapping the pixel values of the reduced-order image to brightness values according to the color mask arrangement of the color ink screen to obtain the brightness image includes: Determine a plurality of second pixel points in the reduced-order image corresponding to each first pixel point of the color ink screen, and use the pixel points in the reduced-order image as the second pixel points; Determine the color mask corresponding to each of the first pixels according to the color mask arrangement of the color ink screen; Obtaining a color component value of each of the second pixels corresponding to the first pixel in a color channel corresponding to the color mask, and obtaining a brightness value based on a plurality of the color component values; The brightness value corresponding to each of the first pixel points of the color ink screen is obtained to obtain a brightness image.
2. The method for optimizing the display effect of a color ink screen according to claim 1, characterized in that: The using of the first preset formula to calculate based on the first pixel grayscale value and the grayscale level to obtain the intermediate pixel grayscale value includes: Determine an offset according to the grayscale number; Obtaining an offset pixel value based on the first pixel grayscale value and the offset; The first preset formula is used to calculate based on the offset pixel value and the grayscale level to obtain the intermediate pixel grayscale value.
3. The method for optimizing the display effect of a color ink screen according to claim 1, characterized in that: Determining the diffusion error corresponding to the original pixel grayscale value comprises: Determine a plurality of error diffusion source pixel grayscale values corresponding to the original pixel grayscale value; Based on the diffusion error corresponding to the grayscale value of each error diffusion source pixel and a preset weight ratio, the diffusion error corresponding to the original pixel grayscale value is determined.
4. The method for optimizing the display effect of a color ink screen according to claim 1, characterized in that: Before the error diffusion and order reduction processing is performed on the original color image, the method further comprises: The data format of the original color image is converted into a specified format.
5. A color ink screen display effect optimization device, characterized in that: The method applied to any one of claims 1 to 4 above, wherein the device comprises: A diffusion and order reduction module is used to perform error diffusion and order reduction processing on the original color image to obtain a reduced-order image; A pixel mapping module is used to map the pixel values of the reduced-order image to brightness values according to the color mask arrangement of the color ink screen to obtain a brightness image; The error diffusion module is used to perform error diffusion processing on the brightness image to obtain a target color image; The image display module is used to control the color ink screen to display the target color image.
6. A color ink screen, characterized in that: include: a memory storing a computer program; The processor implements the steps of the color ink screen display effect optimization method according to any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the steps of the method for optimizing the display effect of the color ink screen according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Image processing method and device, and display control card
CN107154233A
Picture conversion method of ink screen equipment, electronic equipment and storage medium
CN114820370A
Image display method, device and equipment of color ink screen and storage medium
CN116597789A
Image display method of color electronic ink screen all-in-one machine and related equipment
CN117198233A