A multi-level halftoning method and system based on image partition error diffusion
By dividing the image into flat and non-flat regions, and employing grayscale replacement quantization and edge preservation mechanisms, the problems of stripe artifacts and texture/edge degradation in multi-level halftone algorithms are solved, achieving high-quality halftone effects.
Patent Information
- Application Number
- CN202511417794.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-06-26
- Estimated Expiration
- 2045-09-30
Smart Images

Figure CN121280292B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of halftone technology, and in particular to a multi-level halftone method and system based on image partitioning error diffusion. Background Technology
[0002] Digital halftone is a technique that uses binary images to simulate continuous-tone images. Based on the low-pass characteristic of the Human Visual System (HSS), it makes the binary image appear similar to a continuous-tone image from a certain distance by rationally distributing and arranging the black and white pixels in the image. This technique is widely used in commercial printing, where printing equipment typically uses a two-level format (1 bit) to control whether the current pixel is printed, and whether there is an ink droplet. To achieve this goal, halftone research has evolved from early thresholding and ordered dithering to error diffusion compensation strategies, visual model-based optimization methods (Direct Binary Search), and deep neural network-based halftone models. These models suppress low-frequency energy, achieve spatial uniformity and isotropy in point distribution, and thus balance subjective quality with computational efficiency. However, the reconstructed result obtained through simple two-level quantization inevitably suffers from severe distortion compared to the original image. With the development of printing technology, modern laser / inkjet printers can output multiple ink volume (intensity) levels on a monochrome channel by adjusting laser power or controlling the number / size of ink droplets. This naturally extends the traditional two-level halftone to multi-level halftone, significantly reducing quantization noise and improving tonal similarity with the original image. Current industry multi-level halftone methods are basically extensions of two-level halftone directly to multi-level quantization, such as multi-level error diffusion.
[0003] As multi-level output and higher resolution printing become commonplace, application demands have expanded from "overall tone similarity" to faithful reproduction of texture, edges, and material feel. However, this has also exposed new types of distortion and the impact of device physics on printing quality (such as dot gain and ink diffusion)—typically, banding is prominent in large, flat areas, and there are perceptible quality degradation issues such as image contour expansion or thinning due to mechanical / physical noise. These problems are forcing algorithms to evolve from simple signal processing towards content adaptation (e.g., texture / edge protection) and device model awareness.
[0004] Among various multi-level halftone algorithms, Multi-Level Ordered Dithering (M-OD) algorithms are fast, but suffer from significant detail loss. Multi-Level Error Diffusion (M-ED) is an efficient halftone algorithm that uses a designed compensation strategy to propagate the error generated by the quantization of the current pixel to neighboring pixels, thereby improving the overall visual effect of the image. Multi-Level Iterative Halftone algorithms achieve the best results, realizing the best point distribution characteristics and visual effects through an iterative search strategy, but due to their high computational cost, they are not suitable for practical halftone applications. In applications where speed and quality are paramount, M-ED offers halftone quality second only to M-DBS, while significantly outperforming it in processing efficiency, thus gaining widespread application in actual printing.
[0005] M-ED directly introduces multi-level thresholds during the quantization stage and is currently the most widely deployed multi-level halftone scheme in engineering systems. However, this algorithm has several drawbacks: it is prone to banding artifacts in flat, large areas; and in textured / edge regions, error diffusion causes texture detail / edge degradation. Banding refers to the phenomenon where the same grayscale pixel is concentrated in the same area, resulting in a sparse distribution of other black and white pixels in that area, creating a noticeable banding distortion that is highly visible to the human eye. Texture edge degradation, on the other hand, is caused by point gain issues, preventing the formation of sharp, continuous textures in halftone images.
[0006] Therefore, existing halftone algorithms mainly revolve around two types of distortion: one is the banding artifacts commonly found in flat areas, and the other is the degradation of details at textures and edges. The former often uses multi-scale processing, overmodulation, tone swapping, and other methods to "break up" pixels that would otherwise be quantized to the same gray level, thereby weakening the structural nature of the banding; the latter uses texture / edge detection to reduce the error diffusion intensity in these areas or change the quantization strategy, thereby preserving details and sharpness as much as possible.
[0007] The Multi-Level Multi-Scale Error Diffusion (M-MSED) proposed by Sarailidis and Katsavounidis is a representative work addressing the striping problem. Its core approach involves first decomposing the image by scale, then rearranging the pixel processing flow at different scales and spatial orders, and performing overmodulation before quantization. This makes it easier to assign pixels near the intermediate quantization level to adjacent levels, thereby weakening the striping pattern in flat regions. However, multi-scale propagation and overmodulation also introduce significant noise, and this method does not provide systematic constraints for texture and edge degradation.
[0008] The "tone replacement error diffusion" proposed by Guo et al. directly replaces pixels prone to banding at the quantization level within the error diffusion framework. By adjusting some pixels from the optimal quantization level to the suboptimal level, a distribution closer to blue noise is created, thereby reducing banding. However, if the replacement pixel ratio is not properly controlled, it will lead to a decrease in overall tone similarity (such as a decrease in HPSNR), and it also does not solve the problem of detail preservation in texture and edge areas.
[0009] Yu et al. proposed a modulation function based on ordered dithering (M-OD), which performs a nonlinear mapping on pixel values before quantization to disperse pixels around the intermediate quantization levels, thus suppressing stripe artifacts to some extent. However, since this type of method still relies on a fixed threshold matrix, its periodic artifacts and insufficient adaptability to image content remain significant problems, and the overall halftone quality is difficult to compare with error diffusion or direct binary search methods.
[0010] To address texture and edge degradation, Fung, Chan, Li, and others first detect high-frequency structural regions and then reduce error diffusion intensity or employ double quantization strategies within these regions to reduce edge blurring and improve structure preservation. On the other hand, Pang, Lee, Shi & Li, and others, addressing the phenomenon that "weak textures are easily smoothed out by quantization," proposed preserving weak textures during the quantization process. While these methods can achieve better detail in specific areas, they often lack a design-driven approach to addressing banding issues, and some strategies may even violate the principle of maintaining average grayscale in halftones.
[0011] However, existing technologies often favor one over the other in terms of "banding suppression" or "texture / edge protection." The former is prone to introducing additional noise or sacrificing tonal consistency, while the latter often ignores banding in flat areas or disrupts the preservation of average grayscale. Although these methods have achieved certain results in their respective problems, there is still a lack of a universal halftone solution that can balance banding suppression and texture / edge protection while maintaining the linear complexity of traditional error propagation and engineering feasibility. Summary of the Invention
[0012] Therefore, the technical problem to be solved by the present invention is to overcome the difficulty in the prior art of simultaneously alleviating stripe artifacts in flat areas and protecting texture and edge details.
[0013] To address the aforementioned technical problems, this invention provides a multi-level halftone method based on image partitioning error diffusion, comprising:
[0014] The original image is input into the texture region detector, which divides each pixel into flat and non-flat regions to obtain a texture region information mask.
[0015] The original image is processed pixel-by-pixel based on a texture region information mask to obtain a halftone image, including:
[0016] If the current pixel is a pixel in a flat region, add the current pixel value to the current pixel's cumulative error to obtain the quantized input pixel value of the current pixel; perform grayscale replacement quantization on the current pixel's quantized input pixel value to obtain the current pixel's quantized output pixel value; subtract the quantized output pixel value from the current pixel's quantized input pixel value to obtain the current pixel's quantization error, and spread the quantization error to the pixels to be processed in the current pixel's neighborhood based on the error diffusion weight kernel;
[0017] If the current pixel is in a non-flat region, calculate the cumulative weight error of the current pixel based on the texture information of the current pixel in the texture region information mask and the cumulative error of the current pixel; add the cumulative weight error of the current pixel to the pixel value of the current pixel to obtain the quantized input pixel value of the current pixel; quantize the quantized input pixel value of the current pixel to obtain the quantized output pixel value of the current pixel; subtract the quantized output pixel value from the quantized input pixel value of the current pixel to obtain the quantization error of the current pixel; add the propagation error to the quantization error to obtain the total error; spread the total error to the pixels to be processed in the neighborhood of the current pixel based on the error diffusion weight kernel;
[0018] A halftone image of the original image is constructed based on the quantized output pixel values of each pixel.
[0019] Preferably, the original image is input into a texture region detector, and each pixel is divided into flat and non-flat regions to obtain a texture region information mask, including:
[0020] Calculate the local pixel differences for each pixel in the original image;
[0021] Calculate the global pixel differences of the original image;
[0022] Determine whether each pixel in the original image is a flat region and obtain a flat region mask, including: if the local pixel difference of the current pixel is less than the product of the global pixel difference and the judgment parameter, then mark it as a flat region;
[0023] Sobel filtering is used to process each pixel in the non-flat region of the original image to obtain the edge density of each pixel in the non-flat region; based on the edge density, the standard deviation of the edges of adjacent pixels in the neighborhood of each pixel in the non-flat region is calculated; based on the standard deviation of the edges of adjacent pixels in the neighborhood of each pixel in the non-flat region, the texture information of each pixel in the non-flat region is calculated.
[0024] The flat region mask and the texture information of all pixels in the non-flat region are merged into a texture region information mask.
[0025] Preferably, the local pixel difference of each pixel in the original image is calculated using the following formula:
[0026] ;
[0027] in, For local pixel differences, This represents the number of neighboring pixels in the current pixel's neighborhood. The value of the m-th adjacent pixel. It is the average value of the neighboring pixels in the current pixel's neighborhood.
[0028] Preferably, the global pixel difference of the original image is calculated using the following formula:
[0029] ;
[0030] in, For global pixel differences, The total number of pixels in the original image. For the nth pixel, This is the average value of all pixels in the original image.
[0031] Preferably, the texture information of each pixel in the non-flat region is calculated based on the standard deviation of the edges of adjacent pixels in the neighborhood of each pixel in the non-flat region, using the following formula:
[0032] ;
[0033] ;
[0034] in, For pixels Texture information, For pixel coordinates, For edge density, For pixels Standard deviation of adjacent pixel edges within the neighborhood. The S-curve function, For rate parameters, These are the translation parameters.
[0035] Preferably, the quantized input pixel value of the current pixel is subjected to grayscale replacement quantization to obtain the quantized output pixel value of the current pixel, including:
[0036] Search for the initial output quantization level of the current pixel in the set of q-level halftone gray levels such that the error between the initial output quantization level and the quantized input pixel value is minimized.
[0037] If the replacement condition is met, the target output quantization level is searched again in the set of gray levels of the q-level halftone after removing the initial output quantization level, so that the error between the target output quantization level and the quantized input pixel value is minimized, and the target output quantization level is used as the quantized output pixel value of the current pixel.
[0038] If the replacement condition is not met, the initial output quantization level will be used as the quantized output pixel value of the current pixel.
[0039] The replacement conditions are: the initial output quantization level does not belong to the maximum and minimum gray levels of the halftone output fixed gray level, the pixel value mapped to the preset constant gray level image mask of the current pixel is equal to 1, and the independent probability parameter RAND(0,1) is less than the preset probability of tone replacement.
[0040] Preferably, the cumulative weight error of the current pixel is calculated based on the texture information of the current pixel in the texture region information mask and the cumulative error of the current pixel, using the following formula:
[0041] ;
[0042] in, For pixels The cumulative weighted error, For pixel coordinates, For pixels The cumulative error, For edge weights, Pixels in the texture region information mask The value of .
[0043] Preferably, the formula for calculating the propagation error is:
[0044] ;
[0045] in, For pixels propagation error, For pixel coordinates, For pixels The cumulative error, For edge weights, Pixels in the texture region information mask The value of .
[0046] Preferably, the quantization error or total error is diffused to the pixels to be processed in the neighborhood of the current pixel based on the error diffusion weight kernel, including:
[0047] Construct the error diffusion weight kernel:
[0048] ;
[0049] in, As the error diffusion weight kernel, For multi-level quantization series; Preset the probability for color tone replacement; For indexing the weight combinations, For edge weights, , , and These are the weights of the four pixels to be processed in the neighborhood;
[0050] The optimized error diffusion weight kernel is calculated using the following formula:
[0051] ;
[0052] in, The optimized error diffusion kernel, The total number of images in the dataset. For quality assessment function, For the k-th original image, This is the halftone image obtained from the k-th original image based on the error diffusion weight kernel;
[0053] The optimized error diffusion weight kernel diffuses the quantization error or total error to the pixels to be processed in the neighborhood of the current pixel.
[0054] The present invention also provides a multi-level halftone system based on image partitioning error diffusion, comprising:
[0055] The region detection module is used to input the original image into the texture region detector, divide each pixel into flat regions and non-flat regions, and obtain a texture region information mask.
[0056] The halftone module is used to process the original image pixel by pixel based on a texture region information mask to obtain a halftone image, including:
[0057] The flat region halftone unit is used to, if the current pixel is a pixel in a flat region, add the cumulative error of the current pixel to the pixel value of the current pixel to obtain the quantized input pixel value of the current pixel; perform grayscale replacement quantization on the quantized input pixel value of the current pixel to obtain the quantized output pixel value of the current pixel; subtract the quantized output pixel value from the quantized input pixel value of the current pixel to obtain the quantization error of the current pixel, and spread the quantization error to the pixels to be processed in the neighborhood of the current pixel based on the error diffusion weight kernel;
[0058] The non-flat region halftone unit is used to calculate the cumulative weight error of the current pixel if the current pixel is a pixel in a non-flat region, based on the texture information of the current pixel in the texture region information mask and the cumulative error of the current pixel; add the cumulative weight error of the current pixel to the pixel value of the current pixel to obtain the quantized input pixel value of the current pixel; quantize the quantized input pixel value of the current pixel to obtain the quantized output pixel value of the current pixel; subtract the quantized output pixel value from the quantized input pixel value of the current pixel to obtain the quantization error of the current pixel; add the propagation error to the quantization error to obtain the total error; and propagate the total error to the pixels to be processed in the neighborhood of the current pixel based on the error propagation weight kernel.
[0059] The output module is used to construct a halftone image of the original image based on the quantized output pixel values of each pixel.
[0060] Compared with the prior art, the above-described technical solution of the present invention has the following advantages:
[0061] This invention discloses a multi-level halftone method based on image partitioning error diffusion. The input original image is divided into flat and non-flat regions. In the flat regions, gray-level replacement quantization is used to increase the high-frequency blue noise characteristics of the halftone result, forming a distribution close to blue noise to reduce banding distortion observable by the human eye. In the non-flat regions, an edge-preserving mechanism is introduced. Cumulative weighted errors are calculated according to the texture information in the texture region information mask, and propagation errors are introduced into the total error to prevent edge pixels from being affected by the errors of adjacent pixels, thus protecting edge details and preventing edge detail degradation. This invention can alleviate banding artifacts in flat regions, preserve texture and edge details, provide near-ideal halftone characteristics, and improve the output quality of halftone images. Attached Figure Description
[0062] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings, wherein:
[0063] Figure 1 This is a flowchart of a multi-level halftone method based on image partitioning error diffusion according to the present invention;
[0064] Figure 2 This is a flowchart of grayscale replacement quantization;
[0065] Figure 3 This is a comparison chart of the average image quality of different multi-level halftone algorithms at different quantization levels;
[0066] Figure 4 This is a comparison chart of the average processing time of different multi-level halftone algorithms at different quantization levels;
[0067] Figure 5 This is a comparison chart showing the results of different multi-level halftone algorithms processing natural images under four-level halftone. Figure 5 Image (a) in the image is the halftone result of M-DBS. Figure 5 (b) in the image is the halftone result of M-BN. Figure 5 (c) in the image is the halftone result of M-ED. Figure 5 (d) in the image represents the halftone result of the M-OD. Figure 5 (e) in the image is the halftone result of M-ODLA. Figure 5 In the image, (f) is the halftone result of M-MSED. Figure 5 (g) in the figure represents the halftone result image of the present invention;
[0068] Figure 6 These are the four-level halftone results for texture regions obtained by different multi-level halftone algorithms, among which... Figure 6 Image (a) in the image is the halftone result of M-DBS. Figure 6 Image (b) in the image is the halftone result of M-ED. Figure 6 (c) in the image is the halftone result of M-MSED. Figure 6 (d) in the figure represents the halftone result of the present invention. Detailed Implementation
[0069] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.
[0070] Reference Figure 1 As shown, this invention provides a multi-level halftone method based on Distinct Region Error Diffusion (DRED), comprising:
[0071] S1: Input the original image into the texture region detector, divide each pixel into flat regions and non-flat regions, and obtain the texture region information mask;
[0072] S2: The original image is processed pixel by pixel based on a texture region information mask to obtain a halftone image, including:
[0073] S21: If the current pixel is a pixel in a flat region, add the current pixel value to the current pixel's cumulative error to obtain the current pixel's quantized input pixel value; perform grayscale replacement quantization on the current pixel's quantized input pixel value to obtain the current pixel's quantized output pixel value; subtract the quantized output pixel value from the current pixel's quantized input pixel value to obtain the current pixel's quantization error, and spread the quantization error to the pixels to be processed in the current pixel's neighborhood based on the error diffusion weight kernel;
[0074] S22: If the current pixel is a pixel in a non-flat region, calculate the cumulative weight error of the current pixel based on the texture information of the current pixel in the texture region information mask and the cumulative error of the current pixel; add the cumulative weight error of the current pixel to the pixel value of the current pixel to obtain the quantized input pixel value of the current pixel; quantize the quantized input pixel value of the current pixel to obtain the quantized output pixel value of the current pixel; subtract the quantized output pixel value from the quantized input pixel value of the current pixel to obtain the quantization error of the current pixel; add the propagation error to the quantization error to obtain the total error; propagate the total error to the pixels to be processed in the neighborhood of the current pixel based on the error propagation weight kernel;
[0075] S3: Construct a halftone image of the original image based on the quantized output pixel values of each pixel.
[0076] Specifically, in S1, the original image is input into the texture region detector, and each pixel is divided into flat regions and non-flat regions to obtain a texture region information mask, including:
[0077] S11: Calculate the local pixel difference of each pixel in the original image, using the following formula:
[0078] ;
[0079] in, For local pixel differences, This represents the number of neighboring pixels in the current pixel's neighborhood. The value of the m-th adjacent pixel. It is the average value of the neighboring pixels in the current pixel's neighborhood.
[0080] In this embodiment, the pixel neighborhood is an eight-neighborhood, that is, the value of P is 8.
[0081] S12: Calculate the global pixel difference of the original image, using the following formula:
[0082] ;
[0083] in, For global pixel differences, The total number of pixels in the original image. For the nth pixel, This is the average value of all pixels in the original image.
[0084] S13: Determine whether each pixel in the original image is a flat region, and obtain the flat region mask. This includes: if the local pixel difference of the current pixel is less than the product of the global pixel difference and the judgment parameter, then mark it as a flat region.
[0085] The formula for determining pixels in a flat region is expressed as:
[0086] ;
[0087] in, To determine the parameters, pixels that satisfy the above formula are marked as 0, i.e., marked as flat regions.
[0088] S14: Use Sobel filtering to process each pixel in the non-flat region of the original image to obtain the edge density of each pixel in the non-flat region. Based on edge density, calculate the standard deviation of the edges of adjacent pixels in the neighborhood of each pixel in a non-flat region. Based on the standard deviation of the edges of adjacent pixels in the neighborhood of each pixel in the non-flat region, the texture information of each pixel in the non-flat region is calculated, with a value of (0,1).
[0089] Specifically, the texture information of each pixel in the non-flat region is calculated based on the standard deviation of the edges of adjacent pixels in the neighborhood of each pixel, using the following formula:
[0090] ;
[0091] ;
[0092] in, For pixels Texture information, For pixel coordinates, For edge density, For pixels Standard deviation of adjacent pixel edges within the neighborhood. The S-curve function, For rate parameters, These are the translation parameters.
[0093] S15: Merge the texture information of all pixels in the flat region mask and the non-flat region into a texture region information mask. .
[0094] In the texture region information mask, pixels with a value of 0 represent pixels in flat regions, while pixels with a value other than 0 represent pixels in non-flat regions.
[0095] Specifically, refer to Figure 2 As shown, in S21, the quantized input pixel value of the current pixel is... Perform grayscale replacement quantization to obtain the quantized output pixel value of the current pixel. ,include:
[0096] S211: Search for the initial output quantization level of the current pixel in the set of gray levels (QT) of the q-level halftone. This minimizes the error between the initial output quantization level and the quantized input pixel value, as expressed by the formula:
[0097] ;
[0098] in, For the initial output quantization level, It is a set of gray levels for q-level halftone. The input pixel value is used for quantization of the current pixel. For pixel coordinates, for Any element in.
[0099] S212: Determine whether grayscale value replacement should be performed on the current pixel, including:
[0100] If the replacement condition is met, grayscale value replacement is performed. This involves re-searching for the target output quantization level in the set of q-level halftone grayscale levels after removing the initial output quantization level, minimizing the error between the target output quantization level and the quantized input pixel value, and then replacing the target output quantization level. The quantized output pixel value of the current pixel ;
[0101] If the replacement conditions are not met, grayscale value replacement will not be performed, meaning the initial output quantization level will be changed. The quantized output pixel value of the current pixel ;
[0102] The replacement conditions are: the initial output quantization level does not belong to the maximum and minimum gray levels of the halftone output fixed gray level, the pixel value mapped to the preset constant gray level image mask of the current pixel is equal to 1, and the independent probability parameter RAND(0,1) is less than the preset probability of tone replacement.
[0103] The formula for this step is expressed as follows:
[0104] ;
[0105] in, The result of the judgment on whether to perform grayscale value replacement is when When, it indicates that grayscale value replacement is performed. When the grayscale value is not replaced, it indicates that the grayscale value replacement will not be performed. and These represent the maximum and minimum gray levels for halftone output with a fixed gray level, respectively. Map the current pixel to the pixel value in a preset constant grayscale image mask, where , This represents the coordinates within a preset constant grayscale image mask. and These are the height and width of a preset constant grayscale image mask, respectively, to handle input images of different sizes; This is an independent probability parameter used to control the degree of overall pixel grayscale replacement.
[0106] To ensure that two adjacent gray levels that may be replaced can be used correctly, the replacement conditions must meet the following conditions: Not belonging to .
[0107] Specifically, the target output quantization level is re-searched within the set of q-level halftone grayscale levels after removing the initial output quantization level, to minimize the error between the target output quantization level and the quantized input pixel value. The formula is as follows:
[0108] ;
[0109] in, Output quantization level for the target. .
[0110] The grayscale alternation method uses adjacent suboptimal quantization levels. As the target output quantization level, replacing the initial output quantization level This effectively avoids the generation of stripe artifacts. The mixing ratio of gray levels is proportional to the original gray level, and the error diffusion strategy can compensate for the error introduced by gray level replacement.
[0111] Specifically, in S22, when the pixel value in the texture region information mask... When the pixel is located in a non-flat region, the specific processing steps include:
[0112] S221: Calculate the cumulative weight error of the current pixel based on the texture information of the current pixel in the texture region information mask and the cumulative error of the current pixel. The formula is as follows:
[0113] ;
[0114] in, For pixels The cumulative weighted error, For pixel coordinates, For pixels The cumulative error, For edge weights, Pixels in the texture region information mask The value of .
[0115] During the halftone process, each pixel receives errors from multiple previously processed pixels in its neighborhood through error diffusion. When processing the current pixel, all errors transmitted through error diffusion are summed to obtain the cumulative error of the current pixel.
[0116] S222: Add the cumulative weight error of the current pixel to the pixel value of the current pixel to obtain the quantized input pixel value of the current pixel. The formula is as follows:
[0117] ;
[0118] in, For pixels Quantized input pixel values, For pixels The pixel values in the original image.
[0119] S223: Quantize the quantized input pixel value of the current pixel to obtain the quantized output pixel value of the current pixel. The formula is as follows:
[0120] ;
[0121] in, For pixels The quantized output pixel values.
[0122] S224: Subtract the quantized output pixel value from the quantized input pixel value of the current pixel to obtain the quantization error of the current pixel, expressed by the formula:
[0123] ;
[0124] in, For pixels Quantization error.
[0125] S225: The total error is obtained by adding the quantization error to the propagation error, and the formula includes:
[0126] ;
[0127] ;
[0128] in, For pixels The total error, For pixels propagation error, For pixel coordinates, For pixels The cumulative error, For edge weights, Pixels in the texture region information mask The value of .
[0129] S226: Based on the error diffusion weight kernel, the total error is diffused to the pixels to be processed in the neighborhood of the current pixel.
[0130] Since the weight settings of the error diffusion kernel are crucial to the halftone effect of error diffusion, this invention retrains the error diffusion kernel for the newly proposed multi-level error diffusion algorithm to adapt to the halftone processing using pixel-level classification proposed in this invention. This step specifically includes:
[0131] Construct the error diffusion weight kernel:
[0132] ;
[0133] in, As the error diffusion weight kernel, For multi-level quantization series; Preset the probability for color tone replacement; For indexing the weight combinations, For edge weights, , , and These are the weights of the four pixels to be processed in the neighborhood;
[0134] The optimized error diffusion weight kernel is calculated using the following formula:
[0135] ;
[0136] in, The optimized error diffusion kernel, The total number of images in the dataset. This is a quality evaluation function used to measure the similarity between the halftone result and the original image; For the k-th original image, This is the halftone image obtained from the k-th original image based on the error diffusion weight kernel.
[0137] In theory, for the four common quantization series... And all possible and The optimal error diffusion kernel can be obtained in all cases. In this invention, each error diffusion weight is optimized in increments of 0.0001, trying all possible weight combinations.
[0138] The optimized error diffusion weight kernel diffuses the quantization error or total error to the pixels to be processed in the neighborhood of the current pixel.
[0139] Since the pixel neighborhood in this embodiment is an eight-neighborhood, and the halftone pixel-by-pixel processing is performed row by row starting from the top left of the image, the pixels to be processed in the current pixel neighborhood are the pixels directly to the right, bottom right, bottom right, and bottom left of the current pixel.
[0140] This invention addresses the stripe distortion that occurs only significantly in flat regions by introducing a grayscale replacement mechanism during the error diffusion quantization stage. Pixels close to the intermediate quantization level and easily quantized to the same output level are subject to controlled quantization. By limiting their selectable quantization range and replacing them among neighboring levels, a point distribution closer to the ideal halftone is formed, weakening the structural clustering of stripes at its source. For texture and edge degradation common in non-flat regions, this invention employs a texture-preserving halftone strategy. Error diffusion is suppressed and weighted based on edge / texture intensity, minimizing the error interference received by pixels in high-frequency structures from adjacent pixels, thereby maintaining edge sharpness and texture continuity.
[0141] To verify the superiority of this invention over related algorithms, this embodiment selects several mainstream algorithms for objective index, subjective evaluation, and runtime comparison, focusing on analyzing their superiority in eliminating banding effects and preserving image edge details.
[0142] This embodiment selects the following representative multi-level halftone contrast algorithms: Multi-level Direct Binary Search Halftone Algorithm (M-DBS), Multi-level Blue Noise Halftone Algorithm (M-BN), Multi-level Ordered Dithering Halftone Algorithm (M-OD), Overmodulated Multi-level Dithering Halftone Algorithm (M-OOD), Multi-level Floyd-Steinberg Error Diffusion Algorithm (M-ED), MSED Extended to Multi-level Halftone Algorithm (M-MSED), and the algorithm of this invention (M-DRED).
[0143] The average HPSNR results of different multi-level halftone algorithms on a test dataset of 930 images of size 512×512 are referenced. Figure 3 As shown, on the one hand, it can be seen that the method proposed in this invention exhibits higher HPSNR and hue similarity at each quantization level (q-level) compared to previously proposed multi-level halftone based on dithering and error diffusion. On the other hand, it also verifies that M-DBS and M-BN can provide optimal HPSNR results, but their processing time is too long. In contrast, the M-DRED proposed in this invention can provide hue similarity close to that of M-DBS while maintaining the efficiency of error diffusion processing.
[0144] Error diffusion-based halftone algorithms perform well in balancing image quality and time complexity. At different quantization levels, the average processing time of different multi-level halftone algorithms for a 512×512 image is as follows: Figure 4As shown, M-DBS and M-BN, due to their iterative search strategies, have processing times approximately 1000 times longer than other algorithms. M-MSED requires recursive generation of processing paths dependent on the original image, thus its processing time is approximately 30 to 40 times longer than other error diffusion algorithms. In contrast, the processing times of the remaining M-OD, M-OOD, M-ED, and M-DRED are sufficient for practical applications. Although M-DRED has a slightly longer time overhead due to its partitioning process, it balances halftone quality and computation time while providing good visual effects.
[0145] Figure 5 This image shows a comparison of the results of different multi-level halftone algorithms processing natural images under four-level halftone. Figure 5 Image (a) in the image is the halftone result of M-DBS. Figure 5 (b) in the image is the halftone result of M-BN. Figure 5 (c) in the image is the halftone result of M-ED. Figure 5 (d) in the image represents the halftone result of the M-OD. Figure 5 (e) in the image is the halftone result of M-ODLA. Figure 5 In the image, (f) is the halftone result of M-MSED. Figure 5 In the diagram, (g) represents the halftone result image of the present invention. For example... Figure 5 As shown in (a) and (b), the halftone of M-DBS and M-BN has strong high-frequency information, but poor detail representation. Figure 5 Images (c), (d), and (e) show the processing results for M-ED, M-OD, and M-ODLA, respectively. Striping artifacts are clearly visible, especially in the image background. Figure 5 In (f), although M-MSED eliminates distortion in the background compared to M-ED, it introduces significant noise problems.
[0146] Figure 6 The results of four-level halftone rendering for texture regions using different multi-level halftone algorithms are shown below. Figure 6 Image (a) in the image is the halftone result of M-DBS. Figure 6 Image (b) in the image is the halftone result of M-ED. Figure 6 (c) in the image is the halftone result of M-MSED. Figure 6Image (d) in the figure represents the halftone result of this invention. It can be seen that in complex texture areas, traditional M-DBS and M-ED methods fail to effectively preserve details, resulting in significant detail blurring in the textured areas. Especially in complex textures and high-contrast regions, image edges are not sharp enough, exhibiting a noticeable jagged effect, leading to edge degradation in the halftone result. In addition to significant noise distortion, M-MSED also shows blurred edges. In contrast, M-DRED excels in texture preservation in halftone images. By introducing texture preservation techniques, the algorithm of this invention effectively avoids detail loss in textured areas, especially in complex image textures and areas with dense details. It successfully preserves more detail and depth, avoiding the degradation problems of traditional methods. Qualitative comparative experiments show that M-DRED significantly outperforms M-DBS, M-ED, and M-MSED in texture preservation. Through an effective texture preservation strategy, M-DRED can reduce artifacts and preserve the realism of textured areas without losing detail, thus improving the visual quality of multi-level halftone images.
[0147] Therefore, compared to other halftone algorithms, the M-DRED algorithm of this invention can compress the low-frequency features of the halftone results and significantly improve anisotropy to provide near-ideal halftone characteristics. Furthermore, due to its simple processing flow, M-DRED's processing efficiency is essentially the same as that of the traditional M-ED algorithm, making it more practically valuable for multi-level halftone tasks.
[0148] This invention aims to maintain the high efficiency and easy deployment of traditional multi-level error diffusion halftone processing while eliminating stripe artifacts in flat areas and protecting texture and edge details. Through region-adaptive partitioning and grayscale replacement / edge-aware diffusion mechanisms, it achieves near-M-ED operational efficiency and lightweight implementation while approaching the visual quality of highly complex algorithms (such as M-DBS and deep learning methods), taking into account blue noise distribution, tone consistency, and rapid deployment on devices.
[0149] In summary, the multi-level halftone method based on image partitioning error diffusion described in this invention distinguishes the input original image into flat and non-flat regions. In the flat regions, gray-level replacement quantization is used to increase the high-frequency blue noise characteristics of the halftone result, forming a distribution close to blue noise to reduce banding distortion observable by the human eye. In the non-flat regions, an edge-preserving mechanism is introduced. The cumulative weight error is calculated according to the texture information in the texture region information mask, and propagation error is introduced into the total error to prevent edge pixels from being affected by the errors of adjacent pixels, thus protecting edge details and preventing edge detail degradation. This invention can alleviate the banding artifact phenomenon in flat regions, protect texture and edge details, provide near-ideal halftone characteristics, and improve the output quality of halftone images.
[0150] Based on the above-mentioned multi-level halftone method based on image partitioning error diffusion, the present invention also provides a multi-level halftone system based on image partitioning error diffusion, comprising:
[0151] The region detection module is used to input the original image into the texture region detector, divide each pixel into flat regions and non-flat regions, and obtain a texture region information mask.
[0152] The halftone module is used to process the original image pixel by pixel based on a texture region information mask to obtain a halftone image, including:
[0153] The flat region halftone unit is used to, if the current pixel is a pixel in a flat region, add the cumulative error of the current pixel to the pixel value of the current pixel to obtain the quantized input pixel value of the current pixel; perform grayscale replacement quantization on the quantized input pixel value of the current pixel to obtain the quantized output pixel value of the current pixel; subtract the quantized output pixel value from the quantized input pixel value of the current pixel to obtain the quantization error of the current pixel, and spread the quantization error to the pixels to be processed in the neighborhood of the current pixel based on the error diffusion weight kernel;
[0154] The non-flat region halftone unit is used to calculate the cumulative weight error of the current pixel if the current pixel is a pixel in a non-flat region, based on the texture information of the current pixel in the texture region information mask and the cumulative error of the current pixel; add the cumulative weight error of the current pixel to the pixel value of the current pixel to obtain the quantized input pixel value of the current pixel; quantize the quantized input pixel value of the current pixel to obtain the quantized output pixel value of the current pixel; subtract the quantized output pixel value from the quantized input pixel value of the current pixel to obtain the quantization error of the current pixel; add the propagation error to the quantization error to obtain the total error; and propagate the total error to the pixels to be processed in the neighborhood of the current pixel based on the error propagation weight kernel.
[0155] The output module is used to construct a halftone image of the original image based on the quantized output pixel values of each pixel.
[0156] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0157] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0158] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0159] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0160] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A multi-level halftone method based on image partitioning error diffusion, characterized in that, include: The original image is input into the texture region detector, which divides each pixel into flat and non-flat regions to obtain a texture region information mask. The original image is processed pixel-by-pixel based on a texture region information mask to obtain a halftone image, including: If the current pixel is a pixel in a flat region, add the current pixel value to the current pixel's cumulative error to obtain the quantized input pixel value of the current pixel; perform grayscale replacement quantization on the current pixel's quantized input pixel value to obtain the current pixel's quantized output pixel value; subtract the quantized output pixel value from the current pixel's quantized input pixel value to obtain the current pixel's quantization error, and spread the quantization error to the pixels to be processed in the current pixel's neighborhood based on the error diffusion weight kernel; If the current pixel is in a non-flat region, calculate the cumulative weight error of the current pixel based on the texture information of the current pixel in the texture region information mask and the cumulative error of the current pixel; add the cumulative weight error of the current pixel to the pixel value of the current pixel to obtain the quantized input pixel value of the current pixel; quantize the quantized input pixel value of the current pixel to obtain the quantized output pixel value of the current pixel; subtract the quantized output pixel value from the quantized input pixel value of the current pixel to obtain the quantization error of the current pixel; add the propagation error to the quantization error to obtain the total error; spread the total error to the pixels to be processed in the neighborhood of the current pixel based on the error diffusion weight kernel; The cumulative weighted error of the current pixel is calculated based on the texture information of the current pixel in the texture region information mask and the cumulative error of the current pixel. The formula is as follows: ; in, For pixels The cumulative weighted error, For pixel coordinates, For pixels The cumulative error, For edge weights, Pixels in the texture region information mask The value; The quantization error or total error is diffused to the pixels to be processed in the neighborhood of the current pixel based on the error diffusion weight kernel, including: Construct the error diffusion weight kernel: ; in, As the error diffusion weight kernel, For multi-level quantization series; Preset the probability for color tone replacement; For indexing the weight combinations, For edge weights, , , and These are the weights of the four pixels to be processed in the neighborhood; The optimized error diffusion weight kernel is calculated using the following formula: ; in, The optimized error diffusion kernel, The total number of images in the dataset. For quality assessment function, For the k-th original image, This is the halftone image obtained from the k-th original image based on the error diffusion weight kernel; The quantization error or total error is diffused to the pixels to be processed in the neighborhood of the current pixel based on the optimized error diffusion weight kernel; A halftone image of the original image is constructed based on the quantized output pixel values of each pixel.
2. The multi-level halftone method based on image partitioning error diffusion according to claim 1, characterized in that, The original image is input into a texture region detector, which divides each pixel into flat and non-flat regions to obtain a texture region information mask, including: Calculate the local pixel differences for each pixel in the original image; Calculate the global pixel differences of the original image; Determine whether each pixel in the original image is a flat region and obtain a flat region mask, including: if the local pixel difference of the current pixel is less than the product of the global pixel difference and the judgment parameter, then mark it as a flat region; Sobel filtering is used to process each pixel in the non-flat region of the original image to obtain the edge density of each pixel in the non-flat region; based on the edge density, the standard deviation of the edges of adjacent pixels in the neighborhood of each pixel in the non-flat region is calculated; based on the standard deviation of the edges of adjacent pixels in the neighborhood of each pixel in the non-flat region, the texture information of each pixel in the non-flat region is calculated. The flat region mask and the texture information of all pixels in the non-flat region are merged into a texture region information mask.
3. The multi-level halftone method based on image partitioning error diffusion according to claim 2, characterized in that, The formula for calculating the local pixel difference of each pixel in the original image is: ; in, For local pixel differences, This represents the number of neighboring pixels in the current pixel's neighborhood. The value of the m-th adjacent pixel. It is the average value of the neighboring pixels in the current pixel's neighborhood.
4. The multi-level halftone method based on image partitioning error diffusion according to claim 2, characterized in that, The formula for calculating the global pixel difference of the original image is: ; in, For global pixel differences, This represents the total number of pixels in the original image. For the nth pixel, This is the average value of all pixels in the original image.
5. The multi-level halftone method based on image partitioning error diffusion according to claim 2, characterized in that, The texture information of each pixel in the non-flat region is calculated based on the standard deviation of the edges of adjacent pixels in the neighborhood of each pixel. The formula is as follows: ; ; in, For pixels Texture information, For pixel coordinates, For edge density, For pixels Standard deviation of adjacent pixel edges within the neighborhood. The S-curve function, For rate parameters, These are the translation parameters.
6. The multi-level halftone method based on image partitioning error diffusion according to claim 1, characterized in that, The quantized input pixel value of the current pixel is subjected to grayscale replacement quantization to obtain the quantized output pixel value of the current pixel, including: Search for the initial output quantization level of the current pixel in the set of q-level halftone gray levels to minimize the error between the initial output quantization level and the quantized input pixel value; If the replacement condition is met, the target output quantization level is searched again in the set of gray levels of the q-level halftone after removing the initial output quantization level, so that the error between the target output quantization level and the quantized input pixel value is minimized, and the target output quantization level is used as the quantized output pixel value of the current pixel. If the replacement condition is not met, the initial output quantization level will be used as the quantized output pixel value of the current pixel. The replacement conditions are: the initial output quantization level does not belong to the maximum and minimum gray levels of the halftone output fixed gray level, the pixel value mapped to the preset constant gray level image mask of the current pixel is equal to 1, and the independent probability parameter RAND(0,1) is less than the preset probability of tone replacement.
7. The multi-level halftone method based on image partitioning error diffusion according to claim 1, characterized in that, The formula for calculating the propagation error is: ; in, For pixels Propagation error, For pixel coordinates, For pixels The cumulative error, For edge weights, Pixels in the texture region information mask The value of .
8. A multi-level halftone system based on image partitioning error diffusion, used to implement the multi-level halftone method based on image partitioning error diffusion as described in any one of claims 1 to 7, characterized in that, include: The region detection module is used to input the original image into the texture region detector, divide each pixel into flat regions and non-flat regions, and obtain a texture region information mask. The halftone module is used to process the original image pixel by pixel based on a texture region information mask to obtain a halftone image, including: The flat region halftone unit is used to, if the current pixel is a pixel in a flat region, add the cumulative error of the current pixel to the pixel value of the current pixel to obtain the quantized input pixel value of the current pixel; perform grayscale replacement quantization on the quantized input pixel value of the current pixel to obtain the quantized output pixel value of the current pixel; subtract the quantized output pixel value from the quantized input pixel value of the current pixel to obtain the quantization error of the current pixel, and spread the quantization error to the pixels to be processed in the neighborhood of the current pixel based on the error diffusion weight kernel; The non-flat region halftone unit is used to calculate the cumulative weight error of the current pixel if the current pixel is a pixel in a non-flat region, based on the texture information of the current pixel in the texture region information mask and the cumulative error of the current pixel; add the cumulative weight error of the current pixel to the pixel value of the current pixel to obtain the quantized input pixel value of the current pixel; quantize the quantized input pixel value of the current pixel to obtain the quantized output pixel value of the current pixel; subtract the quantized output pixel value from the quantized input pixel value of the current pixel to obtain the quantization error of the current pixel; add the propagation error to the quantization error to obtain the total error; and propagate the total error to the pixels to be processed in the neighborhood of the current pixel based on the error propagation weight kernel. The output module is used to construct a halftone image of the original image based on the quantized output pixel values of each pixel.
Citation Information
Patent Citations
Improved method for frequency-modulated half tone
JP1994070144A
Hybrid vector halftone screening and error diffusion
US20120106835A1