Full-color 3D printing error diffusion method

Through the genetic iterative algorithm, the diffusion factor and binarization threshold of full-color 3D printing are optimized, which solves the problems of uneven color reproduction and poor detail performance in 3D printing, and achieves high color reduction and clear texture effects.

CN120236041APending Publication Date: 2025-07-01SUZHOU FLASHFORGE 3D TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311848768.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2025-07-01

AI Technical Summary

Technical Problem

The existing full-color 3D printing technology has problems such as uneven distribution, poor stacking and detailed presentation in color reproduction, especially in 3D printing, which cannot be effectively solved by traditional 2D error diffusion algorithms.

Method used

The genetic iterative algorithm is used to calculate the optimal weight value and binarization threshold of the diffusion factor. Through voxel position factor, surface voxel factor, error number factor, color difference factor and printing layer position factor, combined with the characteristics of 3D printing, error diffusion is performed to ensure color reduction and texture details.

Benefits of technology

The high color reduction and clear texture details of the 3D printing model are achieved, and the printing effect is improved by optimizing the settings of diffusion factors and binarization thresholds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120236041A_ABST
    Figure CN120236041A_ABST
Patent Text Reader

Abstract

The invention discloses a full-color 3D printing error diffusion method which comprises the following steps: error diffusion coefficient calculation: selecting a corresponding diffusion factor for each gray value or partial gray value, and then calculating an optimal weight value and an optimal binarization threshold value corresponding to each diffusion factor according to a principle of minimum chromatic aberration through a genetic iterative algorithm; and 3D error diffusion: for each voxel point, selecting one channel, comparing the gray value of the channel with the corresponding optimal binarization threshold value to carry out binarization screening, calculating a diffusion coefficient according to the corresponding diffusion factor and the optimal weight value, and then diffusing the error to unprocessed adjacent voxels of the current layer and the next layer of the current voxel. The corresponding diffusion factor is selected according to the characteristics of 3D printing, the optimal diffusion factor weight and the threshold value of the diffusion factor are selected according to the genetic iterative algorithm, then 3D error diffusion is performed according to the obtained result, and the obtained 3D printing model is high in color reduction degree and clear in texture details.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of 3D printing, and particularly relates to a full-color 3D printing error diffusion method. Background Art

[0002] With the development of 3D technology, reproducing the rich colors of models has become a new development trend in 3D printing. Currently, full-color 3D printing more often uses the colorant subtractive color method similar to 2D printing or printing, and realizes color reproduction through printing channels cyan (C), magenta (M), yellow (Y), black (K) or other color reproduction channels. However, compared with 2D printing which has only one plane, the color reproduction complexity of 3D printing is higher, and color reproduction needs to be carried out on the entire model surface. When the traditional 2D error diffusion method (such as the Floyd error diffusion algorithm) is directly applied to 3D printing, due to the lack of consideration of the z direction, the color reproduction effect is not good, mainly manifested in uneven distribution, accumulation, and poor detail rendering effect. Therefore, it is necessary to make certain improvements to the two-dimensional error diffusion algorithm and extend it to 3D.

[0003] When performing full-color 3D printing, the entire printing can be divided into the following steps:

[0004] 1. Import a 3D model,

[0005] 2. Slice the 3D model to obtain 2D voxelized data,

[0006] 3. Color the 2D voxel data to obtain RGB data,

[0007] 4. Separate the 2D RGB data into colors and convert it into printing channel (such as CMYK) data,

[0008] 5. Screen the printing channel (such as CMYK) data to obtain printing data,

[0009] 6. Output the printing data to the printer for printing.

[0010] How to screen to obtain printing data in step 5 is the key to affecting the printing effect. The screening methods adopted by full-color 3D printing on the market vary, the printing effect is not ideal, and the color reduction degree and texture details, etc. need to be improved. Summary of the Invention

[0011] The purpose of the present invention is to provide a full-color 3D printing error diffusion method, so that the printing effect is rich in color, and the color reduction degree and texture details of the 3D model are guaranteed.

[0012] A full-color 3D printing error diffusion method includes the following steps:

[0013] Error diffusion coefficient calculation: For each grayscale value or part of the grayscale values, select the corresponding diffusion factor, and then through the genetic iteration algorithm, calculate the optimal weight value and the optimal binarization threshold corresponding to each diffusion factor according to the principle of the minimum color difference.

[0014] 3D error diffusion: For each voxel, select one of its channels and compare the grayscale value of this channel with the corresponding optimal binarization threshold for binary screening. After calculating the diffusion coefficient according to the corresponding diffusion factor and the optimal weight value, diffuse the error to the unprocessed adjacent voxels in the current layer and the next layer of the current voxel.

[0015] Furthermore, the diffusion factors include voxel position factor, surface voxel factor, error times factor, color difference factor, and printing layer position factor, and the factor values of all diffusion factors range from [0, 1].

[0016] Furthermore, the method for selecting the voxel position factor value is as follows:

[0017] The voxel position factor selects the 8 points around the current layer where the voxel point is located and the 9 points corresponding to this voxel in the next layer. The closer the voxel is to the voxel point, the larger the voxel position factor value.

[0018] Furthermore, the method for selecting the factor value of the surface voxel factor is as follows:

[0019] When one of the four voxels adjacent to the top, bottom, left, and right of this voxel is empty, this voxel is a surface voxel, and its surface distance is 0;

[0020] The non-surface valid voxels adjacent to the surface voxels are internal voxels. Taking the surface voxel as the seed and searching in a breadth-first manner, obtain the first internal voxels, and their surface distance is 1; loop to take the first internal voxels as the seeds and search in a breadth-first manner to obtain the second internal elements, and their surface distance is 2; repeat this way until all voxels are searched or the maximum surface distance is reached. According to the absolute value of the difference in surface distance between the current voxel and the adjacent voxels, the larger the absolute value, the smaller the surface voxel factor value of the current layer, and the surface voxel factor value of the next layer is smaller than that of the current layer.

[0021] Furthermore, the method for selecting the error times factor value is as follows: When a voxel point is diffused multiple times, counted by the number of diffusions, the more times of diffusion, the smaller the error times factor value.

[0022] Furthermore, the method for selecting the color difference factor value is as follows: During diffusion, the smaller the color difference between the adjacent voxel and the current voxel, the larger the factor for accepting diffusion, and the larger the color difference between the adjacent voxel and the current voxel, the smaller the factor for accepting diffusion. The color difference factor value = (255 - |△Color|) / 255, where △Color is the color difference of each channel.

[0023] Further, the method for selecting the printing layer position factor is as follows: During diffusion, the degrees of diffusion received by the current layer and the next layer are set to be different, and the printing layer position factor of the current layer is greater than that of the next layer.

[0024] Further, the method for selecting the binarization threshold is as follows: During the diffusion process, color binarization processing needs to be performed to convert it into printing nozzle data. Different threshold settings for different color grayscales have different effects. Set the binarization threshold to = 220 + Rnd(-20~20), where Rnd is a random value, and the binarization threshold is a random value between 200 and 240.

[0025] Further, the genetic iteration algorithm includes the following steps:

[0026] Initialize all populations, and randomly set the weight value of each diffusion factor and the binarization threshold for each grayscale value;

[0027] Use the 3D error diffusion method to calculate the corresponding printing data and calculate the color difference using the standard color difference formula;

[0028] According to the color difference, save the smaller color difference as the better solution;

[0029] Randomly cross - exchange the weights and binarization thresholds of different factors;

[0030] Randomly change one or several weights or binarization thresholds;

[0031] Increase the number of iterations, and repeat the above steps of the genetic iteration algorithm until the set number of iterations is reached to obtain the optimal weight value and the optimal factor binarization threshold corresponding to this grayscale value.

[0032] Repeat the above process for each grayscale value, or repeat the above process after selecting some grayscale values, and calculate other grayscale values through linear interpolation and other methods.

[0033] Further, the specific method of 3D error diffusion is as follows:

[0034] Color channel selection: For each voxel point, the color value is CMYK. Sort the CMYK values of the color channel data from largest to smallest, and set them as follows: When there is only one maximum value in the CMYK values, select the channel corresponding to this value; when there are multiple identical maximum values in the CMYK values, randomly select a channel corresponding to one of the identical maximum values;

[0035] Binarization: Obtain the optimal binarization threshold according to the grayscale value of the selected channel. Compare the grayscale value of the selected channel with the optimal binarization threshold. When the grayscale value is greater than the optimal binarization threshold, set the corresponding color to be ejected from this channel, otherwise set the ejection of the filling material;

[0036] Error calculation: If the current voxel is the sprayed color, the error is the gray value of the voxel in this channel - 255, and the error in other channels is the gray value of the voxel in other channels; if the current voxel is the filling material, the error is the gray value of the voxel in this channel.

[0037] 3D diffusion: For the unprocessed adjacent voxels V of the current voxel in the current layer and the next layer i , calculate their diffusion coefficients f i , f i = W i / ∑W i , W i is the sum of the products of each diffusion factor and the corresponding optimal weight. For each V i , add the error values to the CMYK colors respectively. C’ = C + △C × f i , M’ = M + △M × f i , Y’ = Y + △Y × f i , K’ = K + △K × f i ,

[0038] Among them, C’ is the gray value of channel C after adding the error value, C is the current gray value of channel C, △C is the error of channel C, M’ is the gray value of channel M after adding the error value, M is the current gray value of channel M, △M is the error of channel M, Y’ is the gray value of channel Y after adding the error value, Y is the current gray value of channel Y, △Y is the error of channel Y, K’ is the gray value of channel K after adding the error value, K is the current gray value of channel K, and △K is the error of channel K;

[0039] Diffusion path: After adding the error value to the adjacent voxel, then select the color channel for this voxel point, and diffuse according to different diffusion paths. Repeat the above operations until all voxel points are binarized.

[0040] Due to the above technical solutions, the present invention has the following beneficial effects:

[0041] 1. Select the corresponding diffusion factors according to the characteristics of 3D printing. The genetic iterative algorithm selects the optimal diffusion factor weight and the threshold of the diffusion factor, and then performs 3D error diffusion according to the obtained results. The 3D printed model has a high color reduction degree and clear texture details.

[0042] 2. The 3D printing color effect is affected by factors such as the surface layer color, internal layer color, adjacent point color difference, printing layer position, color threshold, etc. The settings of the diffusion factor and the binarization threshold take these influences and importance into account, and the optimal solution is obtained as much as possible through the genetic iterative algorithm, so as to ensure the best color reduction effect. Description of the Drawings

[0043] The present invention will be further described below with reference to the accompanying drawings.

[0044] Figure 1 It is an example of a monochromatic picture in RGB format in Example 1.

[0045] Figure 2 It is an explanation of the voxel points of the current layer and the next layer.

[0046] Figure 3 For Figure 1 The result after diffusion of the shown picture.

[0047] Figure 4 It is a multicolor picture in RGB format in Example 2.

[0048] Figure 5 For Figure 4 The result after diffusion of the shown picture.

[0049] Figure 6 It is a multicolor picture in RGB format in Example 3.

[0050] Figure 7 For Figure 5 The result after diffusion of the shown picture. Specific implementation mode

[0051] When performing full-color 3D printing, the entire printing can be divided into the following steps:

[0052] 1. Import a 3D model.

[0053] 2. Slice the 3D model to obtain 2D voxelized data.

[0054] 3. Color the 2D voxel data to obtain RGB data.

[0055] 4. Separate the 2D RGB data into colors and convert it into printing channel (such as CMYK) data.

[0056] 5. Screen the printing channel (such as CMYK) data to obtain printing data.

[0057] 6. Output the printing data to a printer for printing.

[0058] Steps 1-4 and step 6 are all prior arts and will not be elaborated here. The present invention mainly makes improvements on step 5. How to screen the printing channel (such as CMYK) data to obtain printing data mainly adopts a full-color 3D printing error diffusion method, including the following steps:

[0059] 1. Error diffusion coefficient calculation

[0060] 1.1 There are relatively mature diffusion coefficients in 2D error diffusion, but it is difficult to directly apply these coefficients to 3D. During 3D printing, since the color of the model is usually determined by the voxels on the surface, we try to diffuse towards the surface as much as possible during diffusion, and adjacent voxels also try to diffuse towards voxels with similar colors. Therefore, for the grayscale value corresponding to each voxel point, a voxel position factor, a surface voxel factor, an error count factor, a color difference factor, a printing layer position factor, and a binarization threshold are introduced. The calculation methods of the aforementioned factor values are as follows:

[0061] 1.1.1 Voxel position factor value:

[0062] The voxel position factor selects 8 points around the current layer where the voxel point is located and 9 points corresponding to this voxel in the next layer. For example, its factor value can be set as follows:

[0063] Voxel position factor value of the current layer

[0064] Voxel position factor value of the next layer

[0065] Among them, the voxel position factor value of the point where the voxel is located is defined as 0, and the voxel position factor values of the corresponding points directly in front of, behind, to the left, to the right, and directly above it are defined as values within 0.9 - 1, such as 1; the remaining points in the current layer are defined as values within 0.3 - 0.7, such as 0.5; the voxel position factor values of the points directly in front of, behind, to the left, and to the right of the point with a voxel position factor value of 1 in the next layer are defined as values within 0.3 - 0.7, such as 0.5; the remaining points are defined as values within 0.1 - 0.5, such as 0.2. The voxel position factor value closer to the voxel point is larger.

[0066] The specific values here can also be adjusted according to the actual situation. The next layer refers to the next layer arranged in the printing order during the printing process. In fact, since 3D printing is a layer-by-layer stacking, from the Z-axis position, the next layer is located above the current layer.

[0067] 1.1.2 Surface voxel factor value

[0068] When one of the four voxels directly in front of, behind, to the left, and to the right adjacent to this voxel is empty, this voxel is a surface voxel, and the surface distance is defined as 0;

[0069] The non-surface valid voxels adjacent to the surface voxels are internal voxels. Taking the surface voxels as seeds and using the breadth-first method to search, the first set of internal voxels is obtained, and the surface distance is defined as 1; looping, taking the first set of internal voxels as seeds and using the breadth-first method to search to obtain the second set of internal voxels, and the surface distance is defined as 2; repeating like this until all voxels are searched or the maximum surface distance is reached. Usually, the maximum distance is set to 20 - 30, which is set according to the empirical value by the color transparency. According to the absolute value of the difference in surface distance between the current voxel and the adjacent voxels, the diffusion is divided into 4 types: outer-to-outer, inner-to-outer, outer-to-inner, and inner-to-inner. Outer-to-outer means the surface diffuses to the surface voxels, inner-to-outer means the internal voxels diffuse to the surface voxels, outer-to-inner means the surface voxels diffuse to the internal voxels, and inner-to-inner means the internal voxels diffuse to the internal voxels. Their corresponding differences are 0, 1, 2, 3 respectively, and the surface voxel factor values are set as follows:

[0070] The surface voxel factor value of the current layer posDisFactor0 = {1, 0.5, 0.25, 0.15}

[0071] The surface voxel factor value of the next layer posDisFactor1 = {0.8, 0.4, 0.15, 0.05}. For example, when the corresponding difference is 0, the surface voxel factor value of the current layer is 1, and the surface voxel factor value of the next layer is 0.8. When the corresponding difference is 1, the surface voxel factor value of the current layer is 0.5, and the surface voxel factor value of the next layer is 0.4. The greater the corresponding difference, the greater the surface distance difference, the smaller the surface voxel factor value of the current layer, and the smaller the surface voxel factor value of the next layer. The specific values here can also be adjusted according to the actual situation.

[0072] 1.1.3 Error number factor value:

[0073] When a voxel point is diffused multiple times, counting by the number of diffusions, the more the number of diffusions, the smaller the error number factor value. When the number of diffusions is 1, 2, 3, 4, 5 times respectively, the corresponding error number factor values errorFactor = {0.3, 0.25, 0.2, 0.15, 0.15}. After exceeding 5 times, the diffusion is no longer accepted, that is, the error number factor value is 0. The specific values here can also be adjusted according to the actual situation.

[0074] 1.1.4 Color difference factor value

[0075] During diffusion, the smaller the color difference between the adjacent voxel and the current voxel, the greater the factor for accepting diffusion, and the greater the color difference between the adjacent voxel and the current voxel, the smaller the factor for accepting diffusion. The color difference factor value colorFactor = (255 - |△Color|) / 255, where △Color is the color difference of each channel.

[0076] 1.1.5 Print layer position factor value

[0077] During diffusion, for the adjacent voxels in the current layer and the adjacent voxels for printing the next layer, the degrees of diffusion accepted by the current layer and the next layer are set to be different. In principle, the current layer diffuses more and the next layer diffuses less, and the printing layer position factor of the current layer is greater than that of the next layer. The values of the printing layer position factors layerFactor[2] for the current layer and the next layer can be = {0.7, 0.5} or {0.6, 0.2}, etc.

[0078] 1.1.6 Binarization Threshold

[0079] During the diffusion process, it is necessary to perform binarization processing on the color to convert it into printing nozzle data. Different settings of the binarization threshold for different color grayscales have different effects. The binarization threshold is set to = 220 + Rnd(-20~20). Rnd is a random value, and the binarization threshold is a random value between 200 and 240.

[0080] 1.2 After determining the factors, through the genetic iteration algorithm, calculate the optimal weight value and the optimal binarization threshold corresponding to each factor for each gray value according to the principle of the smallest color difference, which can be listed for query, and there is no need to repeat the calculation next time:

[0081] 1.2.1 Initialize the population, randomly set multiple groups of weights (more than 50 groups) and binarization thresholds corresponding to each diffusion factor, with the range within 0 - 500. For example, for gray value 64, initialize 100 groups of weight populations. As shown in Table 1, set the position factor weight, surface factor weight, diffusion times weight, color difference factor weight, and printing layer factor weight for group number 1 respectively, and the value of the binarization threshold is 173, 32, 31, 267, 210.

[0082] Table 1

[0083]

[0084]

[0085]

[0086] 1.2.2 For each group of weights, use the 3D error diffusion method to calculate the corresponding printing data and calculate the color difference using the standard color difference formula CIE76 / 2000, etc. If the population size is 100, 100 groups of color difference data can be obtained.

[0087] 12.3 Sort according to the color difference, and take the groups of weights with smaller color differences in the front as the new groups of weights, such as taking the front 50 groups.

[0088] 12.4 Cross - mutate the 50 groups of weights obtained in the previous step. Cross them randomly in pairs according to the crossover probability, and randomly change one or more weights according to the mutation probability, so that 50 new groups of weights can be obtained.

[0089] As shown in Table 2, randomly select the 1st group and the 18th group for crossover:

[0090] Table 2

[0091]

[0092] As shown in Table 3, the weight groups after crossover are as follows:

[0093] Table 3

[0094] Position factor weight Surface factor weight Diffusion times weight Color difference factor weight Printing layer factor weight Binarization threshold 283 66 18 267 17 210

[0095] As shown in Table 4, mutate it to get:

[0096] Table 4

[0097] Position factor weight Surface factor weight Diffusion times weight Color difference factor weight Printing layer factor weight Binarization threshold 283 66 90 267 17 210

[0098] 12.4 Return to 1.2.2 and loop again until the number of iterations exceeds the set value, then exit the loop.

[0099] 1.2.4 Obtain the best weight group and the best binarization threshold corresponding to this gray level. Repeat the above process for each gray level value, or repeat the above process after selecting some gray levels, and calculate other gray level values by methods such as linear interpolation.

[0100] Set the number of genetic iterations to 10, the crossover probability to 0.5, and the mutation probability to 0.2. The best weights and thresholds can be obtained as shown in Table 5:

[0101] Table 5

[0102] Position factor weight Surface factor weight Diffusion times weight Color difference factor weight Printing layer factor weight Binarization threshold 235 60 55 313 17 214

[0103] 2. 3D Error Diffusion:

[0104] 2.1 Color Channel Selection: For each voxel point, the color value is CMYK. When generating printing data, since in 3D printing one channel corresponds to one color or filling material (which can be transparent ink or support, etc.), each voxel point can only eject a certain amount of ink from one of the channels. Select one of the channels for binarization screening, that is, change the CYMK data to the printing data corresponding to whether each nozzle sprays or not. Sort the CMYK values of the color channel data from largest to smallest and set them as follows:

[0105] When only one of the CMYK values is at its maximum, select that channel; for example, if only C in CYMK is greater than the threshold, then spray cyan (C) at this voxel point.

[0106] When there are multiple CMYK values with the same maximum, randomly select one corresponding channel greater than the set threshold.

[0107] 2.2 Binarization: Obtain the optimal binarization threshold based on the grayscale value of the selected channel, compare the grayscale value of the selected channel with the optimal binarization threshold. When the grayscale value is greater than the optimal binarization threshold, set the corresponding color to be sprayed for this channel; otherwise, set the filling material to be sprayed.

[0108] 2.3 Error calculation: If the current voxel point is spraying a color, the error △Color = color - 255, where color is the grayscale value of this voxel point in this channel, and the error for other channels △Color = color, where color is the grayscale value of the voxel point in other channels. For example, for CYMK(245, 200, 120, 20), if the current channel is C = 245 and C > the binarization threshold 220, then the current voxel sprays C, △C = 245 - 255 = -10, △M = 200, △Y = 120, △K = 20; if the current voxel point is a filling voxel, the error is the grayscale value of this voxel point in this channel. For example, for CYMK(100, 130, 120, 20), the largest channel is M = 130 and M < the binarization threshold 220, then the current voxel is a filling voxel, and its error is △C = 100, △M = 130, △Y = 120, △K = 20.

[0109] 2.4 3D Diffusion: For the unprocessed adjacent voxels V i in the upper and lower layers of the current voxel, calculate their diffusion coefficients f i respectively, where f i = W i / ∑W i , and W i is the sum of the products of each diffusion factor and the corresponding optimal weight, and W i = posFactor * posFactorW + disFactor * disFactorW + errorFactor * errorFactorW + layerFctor * layerFactorW + colorFactor * colorFactorW.

[0110] posFactor refers to the voxel position factor value, posFactorW refers to the optimal weight of the voxel position factor, disFactor refers to the surface voxel factor value, disFactorW refers to the optimal weight of the surface voxel factor, errorFactor refers to the error count factor value, errorFactorW refers to the optimal weight of the error count factor, layerFctor refers to the printing layer position factor value, layerFactorW refers to the optimal weight of the printing layer position factor, colorFactor refers to the color difference factor value, and colorFactorW refers to the optimal weight of the color difference factor.

[0111] For each V i overlay the error value on the CMYK colors respectively, C = C + △C × f i , M = M + △M × f i , Y = Y + △Y × f i , K = K + △K × f i ;

[0112] 2.5 Diffusion path: After adding the error value to the adjacent voxel, select the color channel of this voxel point and diffuse it according to different diffusion paths. Repeat the above operations until all voxel points are binarized. The diffusion paths refer to common scanning paths such as zigzag and snake shape in 2D error diffusion. Different scanning paths are also adopted for each layer during 3D diffusion. For example, the first layer is from left to right and top to bottom, and the second layer is from right to left and bottom to top, etc., to avoid common diffusion defects in this way.

[0113] Example 1

[0114] Taking Figure 1 the monochromatic picture in Figure 2 as an example, its RGB value is (0, 160, 233). After conversion by the color separation algorithm, its CYMK value is (112, 16, 21, 200). As

[0115] shown in

[0116] Position factor weight Surface factor weight Diffusion times weight Color difference factor weight Printing layer factor weight Binarization threshold 311 60 99 100 92 142

[0117] Threshold comparison: The maximum channel 200 > threshold 142, set the value of the current voxel to K, that is, eject black (K).

[0118] Calculate the error of each channel: ΔK = 200 - 255 = -55, ΔC = 112, ΔM = 16, ΔY = 21.

[0119] Calculate the diffusion coefficient of adjacent points. It can be searched that the number of adjacent points is 7.

[0120] Calculate the diffusion coefficient according to the optimal weight and factor value. For each adjacent point, obtain the diffusion weight Wi according to the product of the position factor and the weight.

[0121] Wi = posFactor * posFactorW + disFactor * disFactorW + errFactor * errFactorW + layerFactor * layerFactorW + colorFactor * colorFactorW

[0122] The weight values of each adjacent point in the first layer are W1 = 398, W2 = 551, W3 = 339

[0123] The weight values of each adjacent point in the second layer are W4 = 299, W5 = 392, W6 = 234, W7 = 392

[0124] According to f i = W i / ∑W i Calculate the diffusion coefficient value as

[0125] f1 = 0.1525, f2 = 0.21, f3 = 0.13, f4 = 0.114, f5 = 0.150, f6 = 0.0899, f7 = 0.150

[0126] According to the above diffusion coefficient and error value, spread the error to 7 adjacent points in the current layer and the next layer.

[0127] For example, the calculation of the c - value error of the 3 voxel points in the first layer is as follows:

[0128] P1c = 112 + 0.1525 * ΔC = 129

[0129] P2c = 112 + 0.21 * ΔC = 135

[0130] P3c = 112 + 0.13 * ΔC = 126

[0131] Perform the same operation for each channel of all adjacent points. After adding the error value to the CYMK values of the 7 voxel points, then select the color channel for the voxel points. Repeat the above operations until all voxel points are binarized. Figure 1 The result after diffusion is as Figure 3 shown.

[0132] Example 2

[0133] The color picture is as Figure 4 shown, and the picture after diffusion according to the diffusion method is Figure 5 .

[0134] Example 3

[0135] The color picture is as Figure 6 shown, and the picture after diffusion according to the diffusion method is Figure 7 .

[0136] The above are only specific embodiments of the present invention, but the technical features of the present invention are not limited thereto. Any simple changes, equivalent replacements or modifications made based on the present invention to solve basically the same technical problems and achieve basically the same technical effects are all covered by the protection scope of the present invention.

Claims

1. A full-color 3D printing error diffusion method, characterized in that It includes the following steps: Error diffusion coefficient calculation: For each grayscale value or part of the grayscale values, select the corresponding diffusion factor, and then calculate the optimal weight value and the optimal binarization threshold corresponding to each diffusion factor through a genetic iterative algorithm according to the principle of the minimum color difference. 3D error diffusion: For each voxel, select one of its channels, compare the grayscale value of this channel with the corresponding optimal binarization threshold for binarization screening, calculate the diffusion coefficient according to the corresponding diffusion factor and the optimal weight value, and then diffuse the error to the unprocessed adjacent voxels in the current layer and the next layer of the current voxel.

2. The full-color 3D printing error diffusion method according to claim 1, wherein: The diffusion factors include voxel position factor, surface voxel factor, error times factor, color difference factor, and printing layer position factor, where the factor values of all diffusion factors range from [0, 1].

3. The full-color 3D printing error diffusion method according to claim 2, wherein: The method for selecting the voxel position factor value is as follows: The voxel position factor selects the 8 points around the current layer where the voxel point is located and the 9 points corresponding to this voxel in the next layer. The closer the voxel is to the voxel point, the larger the voxel position factor value.

4. The full-color 3D printing error diffusion method according to claim 2, wherein: The method for selecting the factor value of the surface voxel factor is as follows: When one of the four voxels adjacent to the top, bottom, left, and right of this voxel is empty, this voxel is a surface voxel, and its surface distance is 0; The non-surface effective voxels adjacent to the surface voxels are internal voxels. Taking the surface voxels as seeds and searching in a breadth-first manner, the first internal voxels are obtained, and their surface distance is 1; repeating with the first internal voxels as seeds and searching in a breadth-first manner to obtain the second internal elements, and their surface distance is 2; and so on, until all voxels are searched or the maximum surface distance is reached. According to the absolute value of the difference in surface distance between the current voxel and the adjacent voxels, the larger the absolute value, the smaller the surface voxel factor value of the current layer, and the surface voxel factor value of the next layer is less than that of the current layer.

5. The full-color 3D printing error diffusion method according to claim 2, wherein: The method for selecting the error times factor value is as follows: When a voxel point is diffused multiple times, counting by the number of diffusions, the more times of diffusion, the smaller the error times factor value.

6. The full-color 3D printing error diffusion method according to claim 2, wherein: The method for selecting the color difference factor value is as follows: During diffusion, the smaller the color difference between the adjacent voxel and the current voxel, the larger the factor for accepting diffusion, and the larger the color difference between the adjacent voxel and the current voxel, the smaller the factor for accepting diffusion. The color difference factor value = (255 - |△Color|) / 255, where △Color is the color difference of each channel.

7. The full-color 3D printing error diffusion method according to claim 2, wherein: The method for selecting the printing layer position factor is as follows: During diffusion, it is set that the degrees of accepting diffusion of the current layer and the next layer are different, and the printing layer position factor of the current layer is greater than that of the next layer.

8. The full-color 3D printing error diffusion method according to claim 2, wherein: The method for selecting the binarization threshold is as follows: During the diffusion process, color binarization processing is required to convert it into print head data. Different threshold settings for different color grayscales have different effects. Set the binarization threshold to = 220 + Rnd(-20~20), where Rnd is a random value, and the binarization threshold is a random value between 200 and 240.

9. The full-color 3D printing error diffusion method according to claim 1, wherein: The genetic iteration algorithm includes the following steps: Initialize all populations, and randomly set the weight value of each diffusion factor and the binarization threshold for each grayscale value. Use the 3D error diffusion method to calculate the corresponding print data and calculate the color difference using the standard color difference formula. According to the color difference, save the solution with a smaller color difference as the better solution. Randomly cross and swap the weights and binarization thresholds of different factors. Randomly change one or several weights or binarization thresholds. Increase the number of iterations, and repeat the above steps of the genetic iteration algorithm until the set number of iterations is reached to obtain the optimal weight value and the optimal binarization threshold corresponding to this grayscale value.

10. The full-color 3D printing error diffusion method according to claim 9, characterized in that: The specific method of 3D error diffusion is as follows: Color channel selection: For each voxel, the color value is CMYK. Sort the CMYK values of the color channel data from largest to smallest, and set them as follows: When there is only one maximum value in the CMYK values, select the channel corresponding to this value at this time. When there are multiple identical maximum values in the CMYK values, randomly select a channel corresponding to one of the identical maximum values at this time. Binarization: Obtain the optimal binarization threshold according to the grayscale value of the selected channel, compare the grayscale value of the selected channel with the optimal binarization threshold. When the grayscale value is greater than the optimal binarization threshold, set the corresponding color to be ejected from this channel, otherwise set the filling material to be ejected. Error calculation: If the current voxel is ejecting color, the error is the grayscale value of this voxel in this channel - 255, and the errors of other channels are the grayscale values of the voxel in other channels. If the current voxel is a filling material, the error is the grayscale value of this voxel in this channel. 3D Diffusion: For the unprocessed adjacent voxels V of the current voxel in the current layer and the next layer i , calculate their diffusion coefficients f respectively i , f i = W i / ∑W i, W i is the sum of the products of each diffusion factor and the corresponding optimal weight. For each V i , superimpose the error values on the CMYK colors respectively. C’ = C + △C × f i , M’ = M + △M × f i , Y’ = Y + △Y × f i , K’ = K + △K × f i , Where C’ is the grayscale value of channel C after superimposing the error value, C is the current grayscale value of channel C, △C is the error of channel C, M’ is the grayscale value of channel M after superimposing the error value, M is the current grayscale value of channel M, △M is the error of channel M, Y’ is the grayscale value of channel Y after superimposing the error value, Y is the current grayscale value of channel Y, △Y is the error of channel Y, K’ is the grayscale value of channel K after superimposing the error value, K is the current grayscale value of channel K, and △K is the error of channel K. Diffusion path: After adding the error value to the adjacent voxel, then perform color channel selection for this voxel point, and diffuse according to different diffusion paths. Repeat the above operations until all voxel points are binarized.