An inkjet printing halftone processing method based on cross-fade screen
By combining cross-gradient halftone screens and error diffusion methods, the problems of monotonous dot shapes and abrupt transitions in inkjet printing are solved, resulting in higher quality printing effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INGENIC SEMICON CO LTD
- Filing Date
- 2024-12-27
- Publication Date
- 2026-07-03
Smart Images

Figure CN122336030A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of digital image processing and printing technology, and specifically relates to a halftone processing method for inkjet printing based on a cross-gradient halftone screen. Background Technology
[0002] In the field of inkjet printing, halftone technology is a key technology for converting continuous-tone images into printable outputs. Traditional halftone methods typically use fixed-shape dot structures, such as circles and squares, which often have limitations in terms of print quality.
[0003] Common halftone processing methods currently include:
[0004] 1. Traditional dot screen;
[0005] 2. Square dot structure;
[0006] 3. Random diffusion method;
[0007] 4. Simple regular grid structure.
[0008] However, the problem with the existing technology is that:
[0009] 1. The dot shape is uniform, making it difficult to simulate the complex ink droplet diffusion characteristics;
[0010] 2. The transitions between dots are abrupt, easily creating a noticeable grainy texture;
[0011] 3. Lack of directional characteristics affects print quality;
[0012] 4. The sharp edges of the dots create a visual discontinuity.
[0013] In addition, the relevant technical terms are as follows:
[0014] Halftone: An image processing technique that converts a continuous-tone image into discrete points, using the density of ink dots to simulate different gray levels.
[0015] Screen: A threshold matrix used in halftone processing to determine whether a pixel needs to be printed with ink dots.
[0016] Error diffusion: An image processing algorithm that disperses quantization errors to surrounding pixels. CMYK: A four-color printing mode consisting of Cyan, Magenta, Yellow, and Key / Black.
[0017] Halftone basic unit: the smallest repeating unit used in halftone processing, specifically referring to a 7x7 cross-line shape unit in this invention.
[0018] Gradient halftone screen: A halftone screen structure in which the dots change in a gradient effect from the center outwards.
[0019] Overlap rate: The degree of overlap between adjacent grid cells, used to achieve a smooth transition.
[0020] Error diffusion: an image processing algorithm used to spread quantization errors to surrounding pixels. Summary of the Invention
[0021] To address the aforementioned problems, the present invention aims to provide a halftone processing method based on a cross-gradient halftone screen. By employing specially designed cross-line shape dots and an overlapping fill strategy, the method better simulates ink droplet diffusion characteristics and improves print quality.
[0022] Specifically, this method is an inkjet printing halftone processing method based on a cross-gradient halftone screen, the method comprising the following steps:
[0023] S1. Color Space Conversion: Converts the input BGR format image to the CMYK color space;
[0024] S2. Crossover screen generation, including:
[0025] S2.1. Basic Unit Design of Network Points:
[0026] Uses a 7x7 basic unit;
[0027] The central crossover design provides directional characteristics;
[0028] Gradient transition design simulates ink droplet diffusion, using gradient transition design code to simulate the effect of natural diffusion;
[0029] S2.2. Screen generation and filling, including:
[0030] S2.2.1, adopt a certain overlap ratio, overlap_ratio, which can be adjusted and changed according to the actual effect. Assume that 0.2 is used as the overlap ratio;
[0031] S2.2.2, Calculate the step distance to determine the number of overlapping grids between screens: step_size = block_size * (1 - overlap_ratio);
[0032] S2.2.3 achieves a smooth transition, the code implementation is as follows:
[0033] def smooth_transition(image,overlap_width):
[0034] height, width = image.shape
[0035] result=np.zeros_like(image,dtype=np.float32)
[0036] Create a gradient weight matrix:
[0037] x=np.linspace(0,1,overlap_width)
[0038] weight=0.5*(1-np.cos(np.pi*x))
[0039] Applying weights to achieve a smooth transition:
[0040] for iin range(0,width-overlap_width):
[0041] result[:,i:i+overlap_width]=weight*image[:,i:i+overlap_width] returns the result:
[0042] return result;
[0043] S2.2.4, Weight matrix normalization, the code implementation is as follows:
[0044] def normalize_weights(matrix):
[0045] return matrix / np.sum(matrix);
[0046] S3. Error Diffusion Processing: An optimized 12-direction error diffusion method is adopted, including:
[0047] S3.1, Apply error diffusion method to each color channel;
[0048] S3.2, based on the 12 predefined Jarvis-Judice-Ninke error spread coefficients, the quantization error is distributed to the surrounding pixels according to the set weights;
[0049] S4. Image Composition:
[0050] S4.1 merges the processed channels, as implemented in the code:
[0051] def merge_channels(c,m,y):
[0052] return np.dstack((c,m,y));
[0053] S4.2, generate the final halftone image.
[0054] Based on the channels merged in the previous step, the final image is generated using the following code: def generate_final_image(merged_channels):
[0055] return cv2.cvtColor(merged_channels,cv2.COLOR_CMY2BGR).
[0056] The code implementation for the conversion in step S1 is as follows:
[0057] BGR to CMY conversion implementation:
[0058] def bgr_to_cmyk(bgr_image):
[0059] Convert BGR to RGB:
[0060] rgb_image=cv2.cvtColor(bgr_image,cv2.COLOR_BGR2RGB);
[0061] Normalize to the 0-1 range: rgb_image = rgb_image.astype(np.float32) / 255.0; Conversion formula:
[0062] c = 1 - r;
[0063] m = 1 - g;
[0064] y = 1 - b;
[0065] Scale to the 0-255 range:
[0066] cmyk_image=np.dstack((c,m,y))*255;
[0067] return cmyk_image.astype(np.uint8).
[0068] In step S2.1, the gradient transition design simulates ink droplet diffusion by using a gradient transition design to simulate the effect of natural diffusion, including: direction control and density adjustment. The code implementation includes: creating intersecting line graphics.
[0069] def create_cross_pattern(cell_size = 7, line_thickness = 0.5):
[0070] cell = np.ones((cell_size, cell_size), dtype = np.uint8) * 255
[0071] center_x = cell_size / 2.0 - 0.5
[0072] center_y = cell_size / 2.0 - 0.5
[0073] for y in range(cell_size):
[0074] for x in range(cell_size):
[0075] Calculate the distance to the diagonal:
[0076] d1 = abs((y - x)) / np.sqrt(2)
[0077] d2 = abs((cell_size - 1 - y - x)) / np.sqrt(2)
[0078] The minimum distance: min_distance = min(d1, d2)
[0079] If the minimum distance is less than the line width, that is: if min_distance < line_thickness, then execute:
[0080] cell[y, x] = 0
[0081] Otherwise else, then execute:
[0082] Gradient calculation:
[0083] dx = x - center_x
[0084] dy = y - center_y
[0085] Calculate the square root: center_distance = np.sqrt(dx * dx + dy * dy)
[0086] distance_factor = min_distance / max_distance
[0087] center_factor=center_distance / max_distance
[0088] combined_factor=(distance_factor*0.7+center_factor*0.3)
[0089] In the combined_factor, 0.7 and 0.3 are empirical values, representing the weights of the distance factor and the center factor, respectively.
[0090] threshold=int(255*(combined_factor**1.5))
[0091] The 1.5 power parameter is used to control the non-linearity of the gradient effect. These parameters can be adjusted according to the actual printing effect.
[0092] cell[y,x]=np.clip(threshold,0,255).
[0093] The code implementation for step S3.1, applying the error diffusion method to each color channel, is as follows: `def apply_error_diffusion(channel):`
[0094] height, width = channel.shape
[0095] Create the output image and temporary buffer:
[0096] output=np.zeros_like(channel)
[0097] buffer=channel.astype(float)
[0098] Pixel-by-pixel processing:
[0099] for y in range(height):
[0100] for x in range(width):
[0101] Get the current pixel value:
[0102] old_pixel = buffer[y,x]
[0103] Binarization:
[0104] new_pixel=255if old_pixel>127else 0
[0105] output[y,x] = new_pixel
[0106] Calculate the quantization error:
[0107] error = old_pixel-new_pixel
[0108] Error allocation according to Jarvis-Judice-Ninke model:
[0109] The first point on the right: if x+1 <width:
[0110] buffer[y,x+1] += error * 7 / 48
[0111] The second point on the right: if x+2 <width:
[0112] buffer[y,x+2] += error * 5 / 48
[0113] Next line: if y+1 <height:
[0114] for dx in [-2,-1,0,1,2]:
[0115] if 0 <= x + dx <width:
[0116] if dx in [-2,2]:
[0117] buffer[y+1,x+dx]+=error*3 / 48
[0118] elif dx in[-1,1]:
[0119] buffer[y+1,x+dx]+=error*5 / 48
[0120] else:
[0121] The next two lines after buffer[y+1,x+dx]+=error*7 / 48: if y+2 <height:
[0122] for dx in [-2,-1,0,1,2]:
[0123] if 0 <= x + dx <width:
[0124] if dx in [-2,2]:
[0125] buffer[y+2,x+dx]+=error*1 / 48
[0126] elif dx in[-1,1]:
[0127] buffer[y+2,x+dx]+=error*3 / 48
[0128] else:
[0129] buffer[y+2,x+dx]+=error*5 / 48 Return output: output;
[0130] Apply to the CMY channels respectively:
[0131] def process_channels(c,m,y):
[0132] c_processed=apply_error_diffusion(c)
[0133] m_processed=apply_error_diffusion(m)
[0134] y_processed=apply_error_diffusion(y)
[0135] return c_processed,m_processed,y_processed.
[0136] Step S3.2 further includes:
[0137] S3.2.1 First, obtain the actual grayscale value of the pixel by directly accessing the pixel through the NumPy index, which ranges from 0 to 255. Let's assume it's 128.
[0138] S3.2.2, compare this value with the threshold at the corresponding position of the halftone screen, and obtain the threshold from the corresponding position of the previously generated halftone screen matrix. The threshold is assumed to be 100.
[0139] S3.2.3, Since 128 is greater than 100, the final value of this point is 255. Taking 255 when it is greater than the threshold is to ensure that the ink dots cover the area during printing. Taking 0 when it is less than or equal to the threshold means that the position will not be printed. This binarization process is the basic principle of halftone.
[0140] S3.2.4, the error generated at this time is: actual gray value -255, i.e., 128 - 255 = -127;
[0141] In S3.2.5, the -127 error needs to be distributed among the surrounding 12 pixels. The first pixel on the right receives 7 / 48 of the error, the second pixel on the right receives 5 / 48, and the next row of five pixels receives 3 / 48, 5 / 48, 7 / 48, 5 / 48, and 3 / 48 respectively from left to right. The next two rows of five pixels receive 1 / 48, 3 / 48, 5 / 48, 3 / 48, and 1 / 48 respectively from left to right. The rule for this error distribution is: the sum of the distribution coefficients is 1, decreasing from the center outwards to ensure the smoothness of error propagation, and other error values are distributed according to the same proportional coefficient.
[0142] The beneficial effects of this invention include: 1. The advantages of this method in terms of basic technology:
[0143] Precise color space conversion;
[0144] Stable error propagation control;
[0145] A reliable channel processing mechanism;
[0146] 2. Advantages of this method in terms of innovation:
[0147] Intersecting points provide better directionality;
[0148] Gradient transitions reduce the graininess;
[0149] Overlapping padding ensures smoothness. Attached Figure Description
[0150] The accompanying drawings, which are provided to further illustrate the invention and form part of this application, are not intended to limit the scope of the invention.
[0151] Figure 1 This is a flowchart illustrating the method used in this application.
[0152] Figure 2 This is a schematic diagram of the code conversion in step S1 of this method.
[0153] Figure 3 This is a schematic diagram of the simulated ink droplet diffusion in step S2.1 of this method.
[0154] Figure 4 This is a schematic diagram of the code implementation for simulating ink droplet diffusion in step S2.1 of this method.
[0155] Figure 5 This is a schematic diagram of the code implementation for achieving a smooth transition in step S2.2 of this method.
[0156] Figure 6 This is a schematic diagram of the code implementation of applying the error diffusion method to each color channel in step S3.1 of this method.
[0157] Figure 7 This is a schematic diagram of Jarvis-Judice-Ninke error propagation in step S4 of this method. Detailed Implementation
[0158] To better understand the technical content and advantages of the present invention, the present invention will now be described in further detail with reference to the accompanying drawings.
[0159] This invention relates to a halftone processing method for inkjet printing based on a cross-gradient halftone screen. The main implementation steps of the method are as follows, and the overall process is as follows: Figure 1 As shown, although in Figure 1 Steps S1 and S2 are shown as parallel, but in actual execution, color space conversion is performed first (step S1), and then halftone generation is performed (step S2). Figure 1 The diagram only shows that these two steps are relatively independent:
[0160] Step S1. Color space conversion:
[0161] The input BGR format image is converted to the CMYK color space. CMY is a tri-color mode that uses only cyan (C), magenta (M), and yellow (Y). CMYK has an additional black (K) channel. This application is mainly for ordinary inkjet printing, which does not require black separation, so CMY is sufficient here. The code is as follows: Figure 2 As shown, it includes:
[0162] BGR to CMY conversion implementation:
[0163] def bgr_to_cmyk(bgr_image):
[0164] Convert BGR to RGB:
[0165] rgb_image=cv2.cvtColor(bgr_image,cv2.COLOR_BGR2RGB);
[0166] Normalize to the 0-1 range: rgb_image = rgb_image.astype(np.float32) / 255.0; Conversion formula:
[0167] c = 1 - r;
[0168] m = 1 - g;
[0169] y = 1 - b;
[0170] Scale to the 0-255 range:
[0171] cmyk_image=np.dstack((c,m,y))*255;
[0172] return cmyk_image.astype(np.uint8).
[0173] Step S2. Generation of crossover netting, including:
[0174] Step S2.1, Basic Unit Design of Network Points:
[0175] Uses a 7x7 basic unit;
[0176] The central crossover design provides directional characteristics;
[0177] Gradient transition design to simulate ink droplet diffusion, such as Figure 3 As shown, ink droplet diffusion is a technical term in the printing industry, referring to the phenomenon of ink spreading on paper. The code simulates this natural diffusion effect through a gradient transition design, including: direction control, density adjustment, etc.; the code is as follows... Figure 4 As shown, it includes:
[0178] Create a cross line graphic:
[0179] def create_cross_pattern(cell_size=7,line_thickness=0.5):
[0180] cell=np.ones((cell_size,cell_size),dtype=np.uint8)*255
[0181] center_x = cell_size / 2.0 - 0.5
[0182] center_y = cell_size / 2.0 - 0.5
[0183] for y in range(cell_size):
[0184] for x in range(cell_size):
[0185] Calculate the distance to the diagonal:
[0186] d1 = abs((yx)) / np.sqrt(2)
[0187] d2=abs((cell_size-1-yx)) / np.sqrt(2)
[0188] Minimum distance: min_distance = min(d1, d2)
[0189] If the minimum distance is less than the line width, expressed as: if min_distance < line_thickness, then execute:
[0190] cell[y, x] = 0
[0191] Otherwise else, then execute:
[0192] Gradient calculation:
[0193] dx = x - center_x
[0194] dy = y - center_y
[0195] center_distance = np.sqrt(dx * dx + dy * dy)
[0196] distance_factor = min_distance / max_distance
[0197] center_factor = center_distance / max_distance
[0198] combined_factor = (distance_factor * 0.7 + center_factor * 0.3)
[0199] threshold = int(255 * (combined_factor ** 1.5))
[0200] cell[y, x] = np.clip(threshold, 0, 255)
[0201] Step S2.2. Screen generation and filling:
[0202] S2.2.1, Use an overlap ratio of 0.2 (which can be adjusted according to the actual effect).
[0203] S2.2.2, Calculate the step distance for determining the number of overlapping grids between screens: step_size = block_size * (1 - overlap_ratio);
[0204] S2.2.3, Achieve smooth transition; The code implementation is as Figure 5 shown;
[0205] def smooth_transition(image,overlap_width):
[0206] height, width = image.shape
[0207] result=np.zeros_like(image,dtype=np.float32)
[0208] Create a gradient weight matrix:
[0209] x=np.linspace(0,1,overlap_width)
[0210] weight=0.5*(1-np.cos(np.pi*x))
[0211] Applying weights to achieve a smooth transition:
[0212] for iin range(0,width-overlap_width):
[0213] result[:,i:i+overlap_width]=weight*image[:,i:i+overlap_width] returns the result:
[0214] return result;
[0215] S2.2.4, Weight matrix normalization;
[0216] Step S3. Error diffusion processing:
[0217] An optimized 12-direction error diffusion method is employed:
[0218] S3.1, apply the error diffusion method to each color channel, the code implementation is as follows: Figure 6 Shown: def apply_error_diffusion(channel):
[0219] height, width = channel.shape
[0220] Create the output image and temporary buffer:
[0221] output=np.zeros_like(channel)
[0222] buffer=channel.astype(float)
[0223] Pixel-by-pixel processing:
[0224] for y in range(height):
[0225] for x in range(width):
[0226] Get the current pixel value:
[0227] old_pixel = buffer[y,x]
[0228] Binarization:
[0229] new_pixel=255if old_pixel>127else 0
[0230] output[y,x] = new_pixel
[0231] Calculate the quantization error:
[0232] error = old_pixel-new_pixel
[0233] Error allocation according to Jarvis-Judice-Ninke model:
[0234] The first point on the right: if x+1 <width:
[0235] buffer[y,x+1] += error * 7 / 48
[0236] The second point on the right: if x+2 <width:
[0237] buffer[y,x+2] += error * 5 / 48
[0238] Next line: if y+1 <height:
[0239] for dx in [-2,-1,0,1,2]:
[0240] if 0 <= x + dx <width:
[0241] if dx in [-2,2]:
[0242] buffer[y+1,x+dx]+=error*3 / 48
[0243] elif dx in[-1,1]:
[0244] buffer[y+1,x+dx]+=error*5 / 48
[0245] else:
[0246] The next two lines after buffer[y+1,x+dx]+=error*7 / 48: if y+2 <height:
[0247] for dx in [-2,-1,0,1,2]:
[0248] if 0 <= x + dx <width:
[0249] if dx in [-2,2]:
[0250] buffer[y+2,x+dx]+=error*1 / 48
[0251] elif dx in[-1,1]:
[0252] buffer[y+2,x+dx]+=error*3 / 48
[0253] else:
[0254] buffer[y+2,x+dx]+=error*5 / 48 Return output: output;
[0255] Apply to the CMY channels respectively:
[0256] def process_channels(c,m,y):
[0257] c_processed=apply_error_diffusion(c)
[0258] m_processed=apply_error_diffusion(m)
[0259] y_processed=apply_error_diffusion(y)
[0260] return c_processed,m_processed,y_processed.
[0261] S3.2, using the 12-directional Jarvis-Judice-Ninke error diffusion coefficient (e.g. Figure 7 As shown), the quantization error is distributed to surrounding pixels according to a set weight (e.g., ...). Figure 7 (As shown), the steps are as follows:
[0262] S3.2.1 First, obtain the actual grayscale value of the pixel, for example, 128;
[0263] S3.2.2, compare this value with the threshold (e.g., 100) at the corresponding position of the screen;
[0264] S3.2.3, since 128 is greater than 100, the final value of this point is 255;
[0265] S3.2.4, the error generated at this time is: 128-255=-127;
[0266] S3.2.5, this -127 error needs to be distributed among the surrounding 12 pixels. The first pixel on the right is assigned 7 / 48 of the error, the second pixel on the right is assigned 5 / 48 of the error, the next row of five pixels is assigned 3 / 48, 5 / 48, 7 / 48, 5 / 48, and 3 / 48 of the error from left to right, and the next two rows of five pixels are assigned 1 / 48, 3 / 48, 5 / 48, 3 / 48, and 1 / 48 of the error from left to right.
[0267] Step S4. Image Combining:
[0268] S4.1 merges the processed channels, as implemented in the code:
[0269] def merge_channels(c,m,y):
[0270] return np.dstack((c,m,y));
[0271] S4.2, Generate the final halftone image;
[0272] Based on the channels merged in the previous step, the final image is generated using the following code: def generate_final_image(merged_channels):
[0273] return cv2.cvtColor(merged_channels,cv2.COLOR_CMY2BGR).
[0274] In summary, this method is characterized by:
[0275] This method is based on the halftone processing method of cross-gradient halftone screens. Through specially designed cross-line shape dots and overlapping fill strategy, it can better simulate the ink droplet diffusion characteristics and improve print quality.
[0276] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations can be made to the embodiments of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. An inkjet printing halftone processing method based on cross-fade screen, characterized by, The method includes the following steps: S1. Color Space Conversion: Converts the input BGR format image to the CMYK color space; S2. Crossover screen generation, including: S2.
1. Basic Unit Design of Network Points: Uses a 7x7 basic unit; The central crossover design provides directional characteristics; Gradient transition design simulates ink droplet diffusion, using gradient transition design code to simulate the effect of natural diffusion; S2.
2. Screen generation and filling, including: S2.2.1, adopt a certain overlap ratio, overlap_ratio, which can be adjusted and changed according to the actual effect. Assume that 0.2 is used as the overlap ratio; S2.2.2, Calculate the step distance to determine the number of overlapping grids between screens: step_size=block_size*(1-overlap_ratio); S2.2.3 achieves a smooth transition, and the code implementation is as follows: def smooth_transition(image,overlap_width): height, width = image.shape result=np.zeros_like(image,dtype=np.float32) Create a gradient weight matrix: x=np.linspace(0,1,overlap_width) weight=0.5*(1-np.cos(np.pi*x)) Applying weights to achieve a smooth transition: for iin range(0,width-overlap_width): result[:,i:i+overlap_width]=weight*image[:,i:i+overlap_width] returns the result: return result; S2.2.4, Weight matrix normalization, the code implementation is as follows: def normalize_weights(matrix): return matrix / np.sum(matrix); S3. Error Diffusion Processing: An optimized 12-direction error diffusion method is adopted, including: S3.1, Apply error diffusion method to each color channel; S3.2, based on the 12 predefined Jarvis-Judice-Ninke error spread coefficients, the quantization error is distributed to the surrounding pixels according to the set weights; S4. Image Composition: S4.1 merges the processed channels, as implemented in the code: def merge_channels(c,m,y): return np.dstack((c,m,y)); S4.2, Generate the final halftone image; Based on the channels merged in the previous step, the final image is generated using the following code: def generate_final_image(merged_channels): return cv2.cvtColor(merged_channels,cv2.COLOR_CMY2BGR).
2. The inkjet printing halftone processing method based on a cross-gradient halftone screen according to claim 1, characterized in that, The code implementation for the conversion in step S1 is as follows: BGR to CMY conversion implementation: def bgr_to_cmyk(bgr_image): Convert BGR to RGB: rgb_image=cv2.cvtColor(bgr_image,cv2.COLOR_BGR2RGB); Normalize to the 0-1 range: rgb_image = rgb_image.astype(np.float32) / 255.0; Conversion formula: c=1-r; m = 1 - g; y = 1 - b; Scale to the 0-255 range: cmyk_image=np.dstack((c,m,y))*255; return cmyk_image.astype(np.uint8).
3. The inkjet printing halftone processing method based on a cross-gradient halftone screen according to claim 1, characterized in that, In step S2.1, the gradient transition design simulates ink droplet diffusion by using a gradient transition design to simulate the natural diffusion effect, including: direction control and density adjustment. The code implementation includes: Create a cross line graphic: Calculate the distance to the diagonal: d1 = abs((yx)) / np.sqrt(2) d2=abs((cell_size-1-yx)) / np.sqrt(2) Minimum distance: min_distance = min(d1, d2) If the minimum distance is less than the line width, it is expressed as: if min_distance <line_thickness, Then execute: cell[y,x]=0 Otherwise, execute: Gradient calculation: dx = x - center_x dy = y - center_y Calculate the square root: center_distance = np.sqrt(dx*dx + dy*dy) distance_factor=min_distance / max_distance center_factor=center_distance / max_distance combined_factor = (distance_factor * 0.7 + center_factor * 0.3) where 0.7 and 0.3 in combined_factor are empirical values, representing the weights of the distance factor and the center factor, respectively; threshold=int(255*(combined_factor**1.5)) The 1.5 power parameter is used to control the non-linearity of the gradient effect. These parameters can be adjusted according to the actual printing effect. cell[y,x]=np.clip(threshold,0,255).
4. The inkjet printing halftone processing method based on a cross-gradient halftone screen according to claim 1, characterized in that, The code implementation for step S3.1, which applies the error diffusion method to each color channel, is as follows: def apply_error_diffusion(channel): height, width = channel.shape Create the output image and temporary buffer: output=np.zeros_like(channel) buffer=channel.astype(float) Pixel-by-pixel processing: for y in range(height): for x in range(width): Get the current pixel value: old_pixel = buffer[y,x] Binarization: new_pixel=255if old_pixel>127else 0 output[y,x] = new_pixel Calculate the quantization error: error = old_pixel-new_pixel Error allocation according to Jarvis-Judice-Ninke model: The first point on the right: if x+1 <width: buffer[y,x+1] += error * 7 / 48 The second point on the right: if x+2 <width: buffer[y,x+2] += error * 5 / 48 Next line: The next two lines: Return output: return output; Apply to the CMY channels separately: def process_channels(c,m,y): c_processed=apply_error_diffusion(c) m_processed=apply_error_diffusion(m) y_processed=apply_error_diffusion(y) return c_processed,m_processed,y_processed.
5. The inkjet printing halftone processing method based on a cross-gradient halftone screen according to claim 1, characterized in that, Step S3.2 further includes: S3.2.1 First, obtain the actual grayscale value of the pixel by directly accessing the pixel through the NumPy index, which ranges from 0 to 255. Let's assume it's 128. S3.2.2, compare this value with the threshold at the corresponding position of the halftone screen, and obtain the threshold from the corresponding position of the previously generated halftone screen matrix. The threshold is assumed to be 100. S3.2.3, Since 128 is greater than 100, the final value of this point is 255. Taking 255 when it is greater than the threshold is to ensure that the ink dots cover the area during printing. Taking 0 when it is less than or equal to the threshold means that the position will not be printed. This binarization process is the basic principle of halftone. S3.2.4, the error generated at this time is: actual gray value -255, i.e., 128 - 255 = -127; In S3.2.5, the -127 error needs to be distributed among the surrounding 12 pixels. The first pixel on the right is assigned 7 / 48 of the error, the second pixel on the right is assigned 5 / 48 of the error, the next row of five pixels is assigned 3 / 48, 5 / 48, 7 / 48, 5 / 48, and 3 / 48 of the error from left to right, and the next two rows of five pixels are assigned 1 / 48, 3 / 48, 5 / 48, 3 / 48, and 1 / 48 of the error from left to right. The rule for this error distribution is: the sum of the distribution coefficients is 1, decreasing from the center outwards to ensure the smoothness of error propagation, and other error values are distributed according to the same proportional coefficient.
6. The inkjet printing halftone processing method based on a cross-gradient halftone screen according to claim 1, characterized in that, The method described is applicable to ordinary inkjet printing where black separation is not required and CMY can be used instead.