Color image processing method, device, electronic ink screen and storage medium
By converting color image data into multiple color image data, the problem of insufficient display capabilities of the e-ink screen is solved, maximizing information retention and improving user experience.
Patent Information
- Application Number
- CN202011439489.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-07
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2040-12-07
AI Technical Summary
Existing electronic ink screens can only display black and white or a small number of colors, and it is difficult to effectively convert color image data into multiple color image data, resulting in information loss and inability to fully utilize the display capabilities of the electronic ink screen.
By obtaining the original color data of pixels in the original image, converting it into the set color data in the set color space, and determining the target color according to the color proportion allocation table, generating the target image, and adjusting it using the HSV color space and error diffusion algorithm Color saturation enables multiple color display of color image data.
The original image information is retained to the greatest extent, and the color image data is converted into multiple color image data, which improves the display capability and user experience of the electronic ink screen.
Smart Images

Figure CN112598585B
Abstract
Description
Technical Field
[0001] The present application relates to the field of display, and in particular to a color image processing method, a color image processing device, an electronic ink screen and a storage medium. Background Art
[0002] With the development of electronic technology, electronic ink screen display technology is being used more and more widely. At present, most electronic ink screens usually only support the display of black and white colors. If you need to display, the image processor of the electronic ink screen will convert the color image into a halftone black and white display image according to a certain algorithm, and then display it on the electronic ink screen. In the related technology, electronic ink screens that support multiple colors are proposed, but ink screens that support multiple colors can only display black and white images. Therefore, how to convert color image data into multiple color image data and preserve the information in the original image to the greatest extent to give full play to the capabilities of the electronic ink screen has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] In view of this, the present application provides a color image processing method, a color image processing device, an electronic ink screen and a storage medium.
[0004] The color image processing method of the embodiment of the present application includes:
[0005] Acquire an original image and convert original color data of pixels in the original image into corresponding set color data in a set color space;
[0006] Determine a target color corresponding to the pixel point among a plurality of set colors according to the set color data corresponding to the pixel point and a color ratio allocation table; and
[0007] A target image is generated according to the target color.
[0008] In some embodiments, the set color data includes first attribute data, second attribute data, and third attribute data, and the color image processing method includes:
[0009] determining a first color distribution ratio of a plurality of the set colors according to a range of the first attribute data;
[0010] Determining a second color distribution ratio of a plurality of the set colors according to the first color distribution ratio and the second attribute data; and
[0011] The color ratio allocation table is obtained by determining a third color allocation ratio of the plurality of set colors according to the second color allocation ratio and the third attribute data.
[0012] In some embodiments, the set color space includes an HSV color space, the first attribute data includes hue data, the second attribute data includes saturation data, and the third attribute data includes brightness data.
[0013] In some embodiments, determining the target color corresponding to the pixel point among a plurality of set colors according to the set color data corresponding to the pixel point and a color ratio distribution table comprises:
[0014] Determine a third color allocation ratio corresponding to each of the set colors according to the set color data corresponding to the pixel point and the color ratio allocation table;
[0015] The set color with the largest third color allocation ratio is determined as the target color.
[0016] In some embodiments, the plurality of set colors include black and white and any one or more of red, orange, yellow, green, and blue.
[0017] In some embodiments, the color image processing method further comprises:
[0018] Determining a target RGB value of the target color;
[0019] Calculating an error value between the target RGB value and the initial RGB value; and
[0020] Performing error truncation on the error value according to a preset Norm parameter to adjust the color saturation of the target color image; and
[0021] The error value is error diffused using a preset error diffusion algorithm.
[0022] In some implementations, the preset error diffusion algorithm includes: a Floyd-Steinberg dithering algorithm and a JFJarvis dithering algorithm.
[0023] The color image processing device of the embodiment of the present application includes:
[0024] An acquisition module, which can be used to acquire an original image and convert the original color data of the pixel points in the original image into corresponding set color data in a set color space;
[0025] A determination module, the determination module can be used to determine a target color corresponding to the pixel point among a plurality of set colors according to the set color data corresponding to the pixel point and a color ratio distribution table; and
[0026] A generation module, wherein the generation module can be used to generate a target image according to the target color.
[0027] The electronic ink screen of this application includes:
[0028] processor, memory; and
[0029] One or more programs, wherein the one or more programs are stored in the memory and executed by the processor, and the programs include instructions for executing any one of the color image processing methods described above.
[0030] The present application also provides a non-volatile computer-readable storage medium of a computer program. When the computer program is executed by one or more processors, the processors execute any one of the color image processing methods described above.
[0031] In the color image processing method, color image processing device, electronic ink screen and computer storage medium of the embodiment of the present application, the original color data of the original image is converted into the corresponding set color data in the set color space, and the target color corresponding to the pixel point in multiple set colors is determined according to the set color data and the color ratio distribution table, and the original color data of the pixel point is replaced according to the target color to obtain the target object. In this way, the color image data is converted into multiple color image data, and the information in the original image is retained to the greatest extent.
[0032] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0034] Figure 1 is a schematic flow chart of a color image processing method according to certain embodiments of the present application;
[0035] Figure 2 is a module schematic diagram of a color image processing device in some embodiments of the present application;
[0036] Figure 3 is a schematic diagram of a module of an electronic ink screen in some embodiments of the present application;
[0037] Figure 4 It is a schematic diagram of a module in which a storage medium and a processor are connected in certain embodiments of the present application;
[0038] Figure 5 is a schematic diagram of the RGB color space and the HSV color space of certain embodiments of the present application;
[0039] Figure 6 is a schematic diagram of comparison between an original image and a target image in certain embodiments of the present application;
[0040] Figure 7 is a schematic flow chart of a color image processing method in certain embodiments of the present application;
[0041] Figure 8 It is a color alternation diagram of the HSV space of certain embodiments of the present application.
[0042] Fig. 9 is a schematic diagram of the RGB color space and the HSV color space of certain embodiments of the present application;
[0043] Fig.10 is a schematic diagram of a color image processing method according to certain embodiments of the present application;
[0044] Fig.11 is a schematic flow chart of a color image processing method according to certain embodiments of the present application;
[0045] Fig.12 It is a schematic diagram of comparison between an original image and a target image generated by truncating the error accuracy using parameter Norm in certain embodiments of the present application;
[0046] Fig.13 It is a schematic diagram of the effect after processing using the Floyd-Steinberg dithering algorithm in certain embodiments of the present application;
[0047] Fig.14 It is a schematic diagram of the effect after using the JF Jarvis dithering algorithm in certain embodiments of the present application.
[0048] Description of main component symbols:
[0049] Color image processing device 10 , acquisition module 12 , determination module 14 , generation module 16 , calculation module 18 , adjustment module 19 , electronic ink screen 100 , processor 20 , memory 30 , program 32 , storage medium 40 , computer program 42 . DETAILED DESCRIPTION
[0050] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0051] With the development of electronic technology, electronic ink screen display technology has achieved rapid development and more and more widespread applications in the past few years. For example, some e-book readers, electronic paper, shelf labels, electronic table signs and other products have made extensive use of electronic ink screens.
[0052] Among them, electrophoretic display (EPD) has become one of the popular choices for electronic ink screens due to some superior characteristics. First, the electrophoretic display is a reflective display, which is more comfortable to read than a transmissive display. Secondly, the electrophoretic display is bistable, which can maintain the image on the viewing screen when no power is provided, and consumes power only when the user refreshes the image. Electrophoretic displays can be mainly divided into wet-type electrophoretic displays (which are realized by microcapsule or microcup technology) and dry-type quick-response liquid powder displays (QR-LPD). However, due to the special display mode of the ink screen, unlike traditional liquid crystal displays, the color gamut of the electrophoretic display is much lower than the color gamut of the standard RGB (SRGB) color space. It can only support the display of a small number of colors, for example, the supported colors include black and white, black and white and red, etc.
[0053] Currently, the most common method is to convert color images into black and white, which can be done simply by threshold binarization. If display is required, the image processor of the electronic ink screen will usually convert the color image into a halftone black and white display image according to a certain algorithm, and then display it on the electronic ink screen.
[0054] In the related technology, an electronic ink screen that supports multiple colors is proposed, but the ink screen that supports multiple colors can only display black and white images. Therefore, how to convert image data into multi-color image data while preserving the information in the original image to the greatest extent to give full play to the capabilities of the electronic ink screen has become a technical problem that needs to be solved urgently.
[0055] In view of this, please refer to Figure 1 The present application provides a color image processing method, the color image processing method comprising the steps of:
[0056] S12, acquiring an original image and converting original color data of pixels in the original image into corresponding set color data in a set color space;
[0057] S14, determining a target color corresponding to the pixel point among a plurality of set colors according to the set color data corresponding to the pixel point and a color ratio distribution table; and
[0058] S16, generating a target image according to the target color.
[0059] See also Figure 2 The embodiment of the present application further provides a color image processing device 10. The color image processing device 10 includes an acquisition module 12, a determination module 14, and a generation module 16.
[0060] S12 may be implemented by the acquisition module 12 , S14 may be implemented by the determination module 14 , and S16 may be implemented by the generation module 16 .
[0061] In other words, the acquisition module 12 can be used to acquire the original image and convert the original color data of the pixels in the original image into corresponding set color data in the set color space.
[0062] The determination module 14 may be configured to determine a target color corresponding to a pixel point among a plurality of set colors according to the set color data corresponding to the pixel point and a color ratio distribution table.
[0063] The generating module 16 may be configured to generate a target image according to a target color.
[0064] See also Figure 3 The electronic ink screen 100 of the present application also includes one or more processors 20, a memory 30; and one or more programs 32, wherein the one or more programs 32 are stored in the memory 30 and executed by one or more processors 20, and the program 32 is executed by the processor 20 to execute the instructions of the above-mentioned color image processing method.
[0065] See also Figure 4 The embodiment of the present application also provides a non-volatile computer-readable storage medium 40, which stores a computer program 42. When the computer program 42 is executed by one or more processors 20, the processor 20 executes the above-mentioned color image processing method.
[0066] In the color image processing method, color image processing device 10, electronic ink screen 100 and storage medium 40 of the embodiment of the present application, the original color data of the original image is converted into corresponding set color data in the set color space, and the target color corresponding to the pixel point in multiple set colors is determined according to the set color data and the color ratio distribution table, and the original color data of the pixel point is replaced according to the target color to obtain the target object. In this way, the color image data is converted into multiple color image data, and the information in the original image is retained to the greatest extent.
[0067] In some embodiments, the electronic ink screen 100 may be an electrophoretic display screen, and may be applied to electronic devices such as electronic book readers, electronic paper, shelf labels, and electronic table signs. For example, the electronic ink screen 100 in the present application may be applied to an electronic book reader, so that the electronic book reader can display images in multiple colors, thereby improving the user experience.
[0068] In some embodiments, the color image processing device 10 may be a part of the electronic ink screen 100 . In other words, the electronic ink screen 100 includes the color image processing device 10 .
[0069] In some embodiments, the color image processing device 10 may be discrete components assembled in a certain manner to have the aforementioned functions, or a chip having the aforementioned functions in the form of an integrated circuit, or a computer software code segment that enables the computer to have the aforementioned functions when running on the computer.
[0070] In some embodiments, as hardware, the color image processing device 10 can be independently or as an additional peripheral component added to a computer or computer system. The color image processing device 10 can also be integrated into a computer or computer system. For example, when the color image processing device 10 is part of the electronic ink screen 100, the color image processing device 10 can be integrated into the processor 20.
[0071] In some implementations where the color image processing device 10 is a part of the electronic ink screen 100, as software, the code segments corresponding to the color image processing device 10 can be stored in the memory 30 and executed by the processor 20 to implement the aforementioned functions. In other words, the color image processing device 10 includes the aforementioned one or more programs 32, or the aforementioned one or more programs 32 include the color image processing device 10.
[0072] In some embodiments, the computer-readable storage medium 40 may be a storage medium built into the electronic ink screen 100 , such as a memory 30 , or a storage medium that can be plugged into the electronic ink screen 100 , such as an SD card.
[0073] It should be noted that, since the RGB mode is the physical color mode of the display, as long as it is displayed on the display, the image finally appears in RGB mode, and the display image is used to display in the electronic ink screen 100, so the original color data is RGB color data. That is, the original color data of the pixel in the original image is RGB color data. RGB is designed based on the principle of color luminescence. RGB includes three color channels: red, green, and blue. Each color is divided into 256 levels of brightness. At 0, the "light" is the weakest - it is turned off, and at 255, the "light" is the brightest. When the grayscale values of the three colors are the same, gray tones with different grayscale values are generated, that is, when the grayscale of the three colors is 0, it is the darkest black tone; when the grayscale of the three colors is 255, it is the brightest white tone. RGB value refers to brightness and is represented by integers. Usually, RGB has 256 levels of brightness, which are represented by numbers from 0, 1, 2...254, 255.
[0074] It should also be noted that the number of pixels in an image can be one or more. For multiple pixels, the multiple pixels are processed separately to obtain corresponding original color data.
[0075] Those skilled in the relevant art can understand that color space refers to a color space also called a color model (also called a color space or a color system), which is used to describe colors in a generally acceptable manner under certain standards. Color spaces include RGB color space, CMY color space, HSV color space, and HSI color space, etc. It can be understood that a set color space refers to a predefined color space. Since in this application, a color image needs to be converted into an image consisting of only a few colors, therefore, converting the original color data into the corresponding set color data in the set color space can better process the color of the pixel.
[0076] In this application, the color space is set to the HSV color space. That is, in this application, the conversion of the original color data of the pixel in the original image into the corresponding set color data in the set color space means: converting the RGB color data of the pixel in the original image into the HSV color data.
[0077] Please participate Figure 5 The HSV color space is a color space proposed for better digital color processing, also known as the Hexcone Model. The HSV color space is defined with hue (H), saturation (S), and value (V). Among them, hue H is measured by angle, and its value is between 0 and 360 degrees. Starting from red and counting in a counterclockwise direction, red is 0 degrees, green is 120 degrees, and blue is 240 degrees. Their complementary colors are: yellow is 60 degrees, cyan is 180 degrees, and magenta is 300 degrees.
[0078] Saturation S indicates the degree to which a color is close to a spectral color. A color can be seen as the result of a mixture of a certain spectral color and white. The greater the proportion of the spectral color, the closer the color is to the spectral color, and the higher the saturation of the color. The higher the saturation, the deeper and brighter the color. The white light component of the spectral color is 0, and the saturation reaches the highest. The value range is usually 0% to 100%. The larger the value, the more saturated the color.
[0079] Lightness V indicates the brightness of a color. For light source color, the lightness value is related to the brightness of the light source; for object color, this value is related to the transmittance or reflectance of the object. The value range is usually 0% (black) to 100% (white).
[0080] The conversion formula for converting RGB color data to HSV color data is as follows:
[0081]
[0082]
[0083]
[0084]
[0085] V=C max
[0086] It should also be noted that the color ratio allocation table is used to classify and allocate the set color data to generate the target color. The color ratio allocation table is configured with multiple set colors, and the multiple set colors include more than three colors. Through the color ratio allocation table, the set color data can be mapped to the set colors configured in the color ratio allocation table.
[0087] The number of pixel points can be one or more. For more than one pixel points, the multiple pixel points are processed separately, and the color of at least one of the latter is set.
[0088] Furthermore, the set colors configured in the color ratio distribution table include black and white, and the set colors also include any one or more of red, orange, yellow, green or blue.
[0089] For example, in this application, the set colors configured by the color ratio allocation table include seven colors, namely, red, orange, yellow, green, blue, black and white. That is, this application can map any set color data into the corresponding color among red, orange, yellow, green, blue, black and white.
[0090] The set color data can be processed as one or more. For more than one set color data, the multiple set color data are mapped into corresponding set colors according to the color ratio allocation table.
[0091] In addition, it can be seen from the above example that in the color image processing method of the present application, the color image is converted into seven colors as an example. It can be understood that the above is only an example of the color image processing method, and does not strictly limit the object to which the color image processing method in the embodiment of the present invention is applied.
[0092] Please combine Figure 6 After the target color is generated, the image of the initial image is traversed to replace the initial color data of each pixel with the corresponding target color until all positions are processed and the target image is generated, which can be displayed on the electronic ink screen 100. In this way, the color image data can be converted into multi-color image data to preserve the information in the original image to the greatest extent, giving full play to the capabilities of the electronic ink screen and improving the user experience.
[0093] See also Figure 7 In some embodiments, the color data is set to include first attribute data, second attribute data and third attribute data, and before step S14, the color image processing method further includes the steps of:
[0094] S11, determining a first color distribution ratio of a plurality of set colors according to a range of the first attribute data;
[0095] S13, determining a second color distribution ratio of a plurality of set colors according to the first color distribution ratio and the second attribute data; and
[0096] S15, determining a third color distribution ratio of a plurality of set colors according to the second color distribution ratio and the third attribute data to obtain a color ratio distribution table.
[0097] Please further combine Figure 2 In some embodiments, step S11, step S13 and step S15 can be implemented by the determination module 14. That is, the determination module 14 can be used to determine the first color distribution ratio of multiple set colors according to the range of the first attribute data. The determination module 14 can also be used to determine the second color distribution ratio of multiple set colors according to the first color distribution ratio and the second attribute data, and determine the third color distribution ratio of multiple set colors according to the second color distribution ratio and the third attribute data to obtain a color ratio distribution table.
[0098] Please further combine Figure 3, in some embodiments, the processor 20 may be used to determine the first color allocation ratio of multiple said set colors according to the range of the first attribute data, determine the second color allocation ratio of multiple said set colors according to the first color allocation ratio and the second attribute data, and determine the third color allocation ratio of multiple said set colors according to the second color allocation ratio and the third attribute data to obtain the color ratio allocation table.
[0099] It should be noted that since the set color data is HSV data, and the HSV value is composed of hue H, saturation S, and value V. Therefore, it can be understood that the first attribute data is the hue data H, the second attribute data includes the saturation data S, and the third attribute data includes the value data V.
[0100] Please combine Figure 8 , it should also be noted that in the HSV color space, the saturation S and value V of the five colors of red, orange, yellow, green, and blue are both 100%. According to the H value, the distribution ranges of red, orange, yellow, green, and blue when the saturation and value are both 100% can be locked. When H = 0, it is red; when H = 30, it is orange; when H = 60, it is yellow; when H = 120, it is green; when H = 240, it is blue. When 0 < H < 30, the intermediate color can be obtained by the alternating appearance of red and orange, and as the H value increases, the probability of red appearance decreases and the probability of orange appearance increases. When 30 < H < 60, the intermediate color can be obtained by the alternating appearance of orange and yellow, and as the H value increases, the probability of orange appearance decreases and the probability of yellow appearance increases. And so on. The intermediate color between two adjacent colors, that is, the intermediate mixed color of two adjacent colors, should be formed by the alternating mixture of two adjacent colors, and the mixing ratio is determined according to the proximity of the H value. In addition, as the saturation S decreases, the proportion of white appearance increases, and as the value V decreases, the proportion of black appearance increases. Therefore, the processor 20 can calculate the proportion of each color according to the hue data H, saturation data S, and value data V of the set color through the color ratio allocation table Ratio.
[0101] Specifically, the color ratio allocation table includes a first color ratio allocation table Ratio[H], where Ratio[H] is a 360×7 two-dimensional matrix. Ratio[i][0] represents the ratio of red when H=i, S=100, and V=100, Ratio[i][1] represents the ratio of orange when H=i, S=100, and V=100, Ratio[i][2] represents the ratio of yellow when H=i, S=100, and V=100, Ratio[i][3] represents the ratio of green when H=i, S=100, and V=100, Ratio[i][4] represents the ratio of blue when H=i, S=100, and V=100, Ratio[i][5] represents the ratio of white when H=i, S=100, and V=100, Ratio[i][6] represents the ratio of black when H=i, S=100, and V=100, 0≤i≤359, and i is a positive integer.
[0102] After generating the set color data, the processor 20 determines the range of the hue data H, saturation data S, and lightness V of the set color data, and first calculates the first color distribution ratio of each set color according to the hue data through the first color ratio distribution table. The specific calculation formula is as follows:
[0103] When 0≤H<30, Ratio[i][0]=1-H / 29, Ratio[i][1]=H / 29, Ratio[i][2]=0, Ratio[i][3]=0, Ratio[i][4]=0, Ratio[i][5]=0, Ratio[i][6]=0.
[0104] When 30≤H<60, Ratio[i][0]=0, Ratio[i][1]=1-(H-30) / 29, Ratio[i][2]=(H-30) / 29, Ratio[i][3]=0, Ratio[i][4]=0, Ratio[i][5]=0, Ratio[i][6]=0.
[0105] When 60≤H<120, Ratio[i][0]=0, Ratio[i][1]=0, Ratio[i][2]=1-(H-60) / 59, Ratio[i][3]=(H-60) / 59, Ratio[i][4]=0, Ratio[i][5]=0, Ratio[i][6]=0.
[0106] When 120≤H<240, Ratio[i][0]=0, Ratio[i][1]=0, Ratio[i][2]=0, Ratio[i][3]=1-H / 119, Ratio[i][4]=H / 119, Ratio[i][5]=0, Ratio[i][6]=0.
[0107] 240≤H<360, Ratio[i][0]=(H-240) / 119, Ratio[i][1]=0, Ratio[i][2]=0, Ratio[i][3]=0, Ratio[i][4]=1-(H-240) / 119, Ratio[i][5]=0, Ratio[i][6]=0.
[0108] Furthermore, the color ratio allocation table also includes a second color ratio allocation table Ratio
[360] [7] S , the processor can use the second color ratio allocation table Ratio
[360] [7] S The second color distribution ratio of the plurality of set colors is calculated according to the first color distribution ratio and the saturation of the set color data, and the second color ratio distribution table Ratio
[360] [7] is S The specific calculation formula is as follows:
[0109] Ratio[H][0] S =Ratio[H][0]*S / 100
[0110] Ratio[H][1] S =Ratio[i][1]*S / 100
[0111] Ratio[H][2] S =Ratio[i][2]*S / 100
[0112] Ratio[H][3] s =Ratio[i][3]*S / 100
[0113] Ratio[H][4] S =Ratio[i][4]*S / 100
[0114] Ratio[H][5] S =Ratio[i][5]*S / 100+(1-S / 100)
[0115] Ratio[H][6] S =Ratio[i][6]*S / 100
[0116] Among them, Ratio[H][0] S is the proportion of red in the second color ratio, Ratio[H][1] S is the proportion of orange in the second color ratio, Ratio[H][2] S is the proportion of yellow in the second color ratio, Ratio[H][3] S is the proportion of green in the second color ratio, Ratio[H][4] S is the proportion of blue in the second color ratio, Ratio[H][5] S is the proportion of black in the second color ratio, Ratio[H][6] S It is the proportion of white in the second color ratio.
[0117] Furthermore, the color ratio allocation table also includes a third color ratio allocation table Ratio
[360] [7] SV , calculate the third color distribution ratio of the plurality of set colors according to the second color distribution ratio and the brightness of the set color data, the third color ratio distribution table Ratio
[360] [7] SV The specific calculation formula is as follows:
[0118] Ratio[H][0] SV =Ratio[H][0] S *V / 100
[0119] Ratio[H][1] SV =Ratio[i][1] S *V / 100
[0120] Ratio[H][2] SV =Ratio[i][2] S *V / 100
[0121] Ratio[H][3] SV =Ratio[i][3] S *V / 100
[0122] Ratio[H][4] SV =Ratio[i][4] S *V / 100
[0123] Ratio[H][5] SV =Ratio[i][5] S *V / 100
[0124] Ratio[H][6] SV =Ratio[i][6] S*V / 100+(1-V / 100)
[0125] Among them, Ratio[H][0] SV is the proportion of red in the third color ratio, Ratio[H][1] SV is the proportion of orange in the third color ratio, Ratio[H][2] SV is the proportion of yellow in the third color ratio, Ratio[H][3] SV is the proportion of green in the third color ratio, Ratio[H][4] SV is the proportion of blue in the third color ratio, Ratio[H][5] SV is the proportion of black in the third color ratio, Ratio[H][6] SV It is the proportion of white in the third color ratio.
[0126] Please combine Fig. 9 In this way, the proportions of the seven corresponding colors can be directly indexed according to the values of the hue data H, saturation data S and brightness data V of the set color data.
[0127] In addition, it should be noted that the color ratio distribution table in the above-discussed implementation shows the distribution ratios corresponding to the seven colors. In other implementations, if the set colors are converted to colors other than seven colors, a corresponding ratio distribution table can be designed based on the number and distribution of the set colors.
[0128] See also Fig.10 In some embodiments, step S14 further comprises the steps of:
[0129] S142: Determine a third color distribution ratio corresponding to each set color according to the set color data corresponding to the pixel point and the color ratio distribution table;
[0130] S144: Determine the set color with the largest third color allocation ratio as the target color.
[0131] Please further combine Figure 2 In some implementations, steps S142 and S144 may be implemented by the determination module 14 .
[0132] In other words, the determination module 14 may be configured to determine the third color allocation ratio corresponding to each set color according to the set color data corresponding to the pixel point and the color ratio allocation table.
[0133] The determination module 14 may also be used to determine a set color with the largest third color allocation ratio as a target color.
[0134] In some embodiments, the processor 20 can be used to determine the third color allocation ratio corresponding to each set color according to the set color data corresponding to the pixel point and the color ratio allocation table. The processor 20 can also be used to determine the set color with the largest third color allocation ratio as the target color.
[0135] It is understandable that when converting the original image into the target image, the target image needs to be restored to the greatest extent and retain the original information, that is, each original color in the original image needs to be converted into the corresponding closest color. The third color allocation ratio is calculated by the hue, saturation and brightness of the set color data, and the larger the third color allocation ratio of the set color, the closer the color is to the set color. Therefore, the target color can be determined according to the third color allocation ratio. Specifically, after calculating the third color allocation ratio corresponding to each set color according to the third color ratio allocation table, the size of each third color allocation ratio is compared, and the set color with the largest third color allocation ratio is the target color.
[0136] For example, in some examples, the color data is set to (80, 100, 50), and according to the third color allocation ratio table, the following Ratio[H][0] is obtained: SV = 0. Ratio[H][1] SV = 0. Ratio[H][2] SV =(39 / 59)*(100 / 100)*(50 / 100)=39 / 118. Ratio[H][3] SV =(20 / 59)*(100 / 100)*(50 / 100)=10 / 59. Ratio[H][6] SV = 0. Ratio[H][5] SV = 0. Ratio[H][6] SV =(1-50 / 100). Ratio[H][2] SV maximum, and Ratio[H][2] SV The corresponding color is yellow, then the target color is yellow.
[0137] See also Fig.11 In some embodiments, the color image data processing method further comprises the steps of:
[0138] S17, determining a target RGB value of a target color;
[0139] S18, calculating the error between the target RGB value and the initial RGB value;
[0140] S19, performing error truncation on the error value according to a preset Norm parameter to adjust the color saturation of the target color image; and
[0141] S21, performing error diffusion on the error value using a preset error diffusion algorithm.
[0142] Please further combine Figure 2 In some embodiments, the color image processing device further includes a calculation module 18 and an adjustment module 19.
[0143] Step S17 may be implemented by the determination module 16 , step S18 may be implemented by the calculation module 18 , and step S19 and step S21 may be implemented by the adjustment module 19 .
[0144] In other words, the determination module 16 may also be used to determine the target RGB value of the target color.
[0145] The calculation module implementation 18 may be used to calculate an error value between a target RGB value and an initial RGB value.
[0146] The adjustment module 19 may be used to perform error truncation on the error value according to a preset Norm parameter to adjust the color saturation of the target color image and to perform error diffusion on the error value using a preset error diffusion algorithm.
[0147] In some embodiments, the processor 20 may be used to determine a target RGB value of a target color and calculate an error value between the target RGB value and the initial RGB value. The processor 20 may also be used to perform error truncation on the error value according to a preset Norm parameter to adjust the color saturation of the target color image, and perform error diffusion on the error value using a preset error diffusion algorithm.
[0148] It should be noted that after the original color data of the pixels in the original image is converted into the set color data and then mapped into the target color through the color ratio allocation table, the generated target image will have visual errors, which will bring a bad experience to the user. Therefore, it is necessary to adjust the target image to ensure that the target image can clearly reflect the visual information of the original image and improve the user experience.
[0149] Specifically, after generating the target image, the processor 20 may also determine the target RGB value of the target color and the initial RGB value of the original image data, and calculate the initial difference between the target RGB value and the corresponding initial RGB value according to a calculation formula.
[0150] Please combine Fig.12 Furthermore, the processor 20 includes a preset Norm parameter, which is used to truncate the accuracy of the initial difference to generate a target difference, so that the target image can be adjusted according to the target difference to achieve color saturation control and reduce the color jitter range of the target image. The specific calculation formula for truncating the initial difference is:
[0151] Target difference = floor (initial difference * Norm) * Norm
[0152] Among them, floor() is a rounding function, and Norm is a positive integer. The smaller Norm is, the stronger the truncation is. In this way, color jitter can be effectively reduced, thereby improving the granularity of the mapped image and increasing color saturation.
[0153] Furthermore, the window error is calculated for the target image. The error diffusion algorithm, also known as the dithering algorithm, is a method for performing image halftoning. It can distribute the quantization error of the central pixel to the neighboring positions around it that have not been processed. It is often used to convert multi-grayscale images into black-and-white images with only two grayscale levels. It can enhance the image boundary and make the image visually better.
[0154] The window error diffusion algorithm includes the Floyd-Steinberg dithering algorithm and the JF Jarvis dithering algorithm. The present application can process the target image (such as Fig.13 ) to adjust the target image and JF Jarvis dithering algorithm to process the target image (such as Fig.14 ) to adjust the target image.
[0155] Among them, the Floyd-Steinberg dithering algorithm was proposed by Robert W.Floyd and Louis Steinberg in 1976 and is widely used in image processing tools. The Floyd-Steinberg dithering algorithm can diffuse the quantization residual of the central pixel to the surrounding 4 pixels. The specific calculation formula is as follows:
[0156]
[0157] Among them, * refers to the value of the pixel currently being processed. If there is no pixel to the right of the pixel, only the pixels below and below the left are converted according to the above coefficients.
[0158] The JF Jarvis dithering algorithm can change the diffusion window to 5*5. Using a larger window can minimize the average error, thus making the target image have a better smoothing effect. The specific calculation formula of the Floyd-Steinberg dithering algorithm is as follows:
[0159]
[0160] Among them, * represents the value of the pixel currently being processed.
[0161] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0162] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0163] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A color image processing method, It is characterized in that include: Acquire an original image and convert original color data of pixels in the original image into corresponding set color data in a set color space; Determine a target color corresponding to the pixel point among a plurality of set colors according to the set color data corresponding to the pixel point and a color ratio distribution table; and generating a target image according to the target color; The set color data includes first attribute data, second attribute data and third attribute data, and the color image processing method further includes: determining a first color distribution ratio of a plurality of the set colors according to a range of the first attribute data; Determining a second color distribution ratio of a plurality of the set colors according to the first color distribution ratio and the second attribute data; and Determining a third color allocation ratio of a plurality of the set colors according to the second color allocation ratio and the third attribute data to obtain the color ratio allocation table; the set color space includes an HSV color space, the first attribute data includes hue data, the second attribute data includes saturation data, and the third attribute data includes brightness data; determining a target color corresponding to the pixel point among a plurality of set colors according to the set color data corresponding to the pixel point and the color ratio allocation table comprises: Determine a third color allocation ratio corresponding to each of the set colors according to the set color data corresponding to the pixel point and the color ratio allocation table; The set color with the largest third color allocation ratio is determined as the target color.
2. The color image processing method according to claim 1, It is characterized in that The plurality of set colors include black and white and any one or more of red, orange, yellow, green and blue.
3. The color image processing method according to claim 1, It is characterized in that The color image processing method further comprises: Determining a target RGB value of the target color; Calculate the error between the target RGB value and the initial RGB value of the original image; Performing error truncation on the error value according to a preset Norm parameter to adjust the color saturation of the target image; and The error value is error diffused using a preset error diffusion algorithm.
4. The color image processing method according to claim 3, It is characterized in that The preset error diffusion algorithms include: Floyd-Steinberg dithering algorithm and JF Jarvis dithering algorithm.
5. A color image processing device, It is characterized in that include: An acquisition module, which can be used to acquire original color data of an original image and convert the original color data of a pixel point in the original image into corresponding set color data in a set color space; A determination module, the determination module can be used to determine a target color corresponding to the pixel point among a plurality of set colors according to the set color data corresponding to the pixel point and a color ratio distribution table; and A generating module, wherein the generating module can be used to generate a target image according to the target color; Wherein, the set color data includes first attribute data, second attribute data and third attribute data, and the color image processing method further includes: determining a first color distribution ratio of a plurality of the set colors according to a range of the first attribute data; Determining a second color distribution ratio of a plurality of the set colors according to the first color distribution ratio and the second attribute data; and Determining a third color allocation ratio of a plurality of the set colors according to the second color allocation ratio and the third attribute data to obtain the color ratio allocation table; the set color space includes an HSV color space, the first attribute data includes hue data, the second attribute data includes saturation data, and the third attribute data includes brightness data; determining a target color corresponding to the pixel point among a plurality of set colors according to the set color data corresponding to the pixel point and the color ratio allocation table comprises: Determine a third color allocation ratio corresponding to each of the set colors according to the set color data corresponding to the pixel point and the color ratio allocation table; The set color with the largest third color allocation ratio is determined as the target color.
6. An electronic ink screen, It is characterized in that include: Processor and memory; and One or more programs, wherein the one or more programs are stored in the memory and executed by the processor, and the programs include instructions for executing the color image processing method according to any one of claims 1-4.
7. A non-volatile computer-readable storage medium containing a computer program, It is characterized in that When the computer program is executed by one or more processors, the processors are enabled to execute the color image processing method according to any one of claims 1 to 4.
