Image edge smoothing processing method based on ink droplet diffusion principle
By combining the principle of ink droplet diffusion with morphological operations and filtering techniques, the problem of image edge protrusions and depressions was solved, achieving high-quality edge smoothing processing and improving image clarity and accuracy.
Patent Information
- Application Number
- CN202511051918.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2025-11-18
AI Technical Summary
Existing image edge smoothing methods struggle to eliminate both protrusions and depressions at image edges while maintaining overall contour and ensuring edge sharpness and fine texture. Furthermore, traditional methods are prone to causing image distortion or excessive blurring.
By combining the principle of ink droplet diffusion with morphological operations and filtering techniques, high-quality smoothing of image edges is achieved through steps such as local closing operation, differential connected component analysis, bilinear interpolation, and Gaussian blurring.
It effectively fills small depressions, limits contour distortion caused by large-scale closing operations, preserves the original design geometry, improves image clarity and eliminates jagged artifacts, achieving industrial-grade precision and visual quality.
Smart Images

Figure CN120976048A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer image vision, and in particular relates to an image edge smoothing method based on the principle of ink droplet diffusion. Background Technology
[0002] With the development of industrial automation and intelligent manufacturing, digital images are widely used in printing plate making, textile template making, packaging design, and other fields. In the color separation plate making process of textile templates, it is often necessary to import the design graphics into a computer digital system and create a physical template using a cutting machine or inkjet equipment to guide subsequent plate cutting or dyeing. However, in the actual plate making process, digital images often suffer from jagged edges, unevenness, and other defects due to resolution, pixel quantization, and other factors. These defects not only affect the visual effect of the finished product but also lead to cutting path deviations, reduce the matching accuracy between the template and the actual fabric pattern, and consequently affect dyeing quality and product consistency.
[0003] Existing image edge smoothing methods can be mainly divided into two categories: one is filtering-based smoothing algorithms, such as Gaussian filtering and median filtering; the other is morphological structured operations, such as dilation, erosion, opening, and closing operations. Filtering algorithms can reduce noise and jagged edges to a certain extent, but they struggle to balance edge sharpness and fine texture, often resulting in excessive blurring or loss of detail. Morphological operations, by defining structuring elements to erode or dilate the foreground region, can effectively eliminate small holes or fill depressions. However, when dealing with unevenness at different scales, it is often necessary to manually adjust the size of the structuring elements or the order of operations. Furthermore, closing operations can easily cause overall shape distortion, causing the graphic outline to deviate from the original design.
[0004] In traditional printing and digital inkjet printing, the principle of "ink droplet diffusion" is used to control the diffusion behavior of ink on the printing medium to achieve smooth edges and color blocks. Ink droplets diffuse and gradually merge on the surface of fibers or porous materials, forming a gradient transition that preserves color saturation while eliminating hard boundaries. This physical process offers new inspiration for digital image processing: if the diffusion mechanism of ink droplets on a two-dimensional plane can be simulated, and the diffusion principle combined with morphological operations and filtering techniques, it may be possible to achieve more natural and refined edge smoothing while maintaining the overall contour. Summary of the Invention
[0005] The purpose of this invention is to provide an image edge smoothing method based on the principle of ink droplet diffusion. Referring to the principle of ink droplet diffusion, various graphics processing methods and super-resolution models are introduced to eliminate the protrusions and depressions of image edges, thereby achieving high-quality smoothing of image edges.
[0006] An image edge smoothing method based on the principle of ink droplet diffusion includes the following steps:
[0007] Image masking preprocessing and bulge removal involve preprocessing the input original image to perform preliminary smoothing operations. The image masking preprocessing and bulge removal include:
[0008] The image is converted to grayscale, mapping the three color channels of the image to a single channel;
[0009] The image is binarized using the Otsu method (OTSU) to divide it into foreground and background parts.
[0010] Median filtering is performed by taking the median value of a 5x5 neighborhood for each pixel to remove small noise.
[0011] Perform an opening operation, first eroding and then dilating. The erosion operation eliminates minor noise, and the dilation operation restores the main body.
[0012] Connectivity analysis is used to remove relatively small noise that cannot be eliminated by the above operations.
[0013] Furthermore, the process of filling and filtering concave areas involves performing a local closing operation on the preprocessed image to fill in concave regions, while simultaneously filtering to remove concave fills that cause significant image distortion. This filling and filtering process includes:
[0014] Design an elliptical structural element B′ slightly larger than the expected concavity, preset to 15*15. Perform a local closing operation on the image using B′;
[0015] The difference between the image after the closing operation and the original image is calculated. Connectivity analysis is performed on the difference image to retain smaller connected components, so as to ensure that the image is not significantly distorted.
[0016] Furthermore, image edge anti-aliasing and retouching are performed on the image to further improve the smoothness of image edges. The image edge anti-aliasing and retouching include:
[0017] Bilinear interpolation is performed on the image to calculate the magnified pixel values, ensuring a smooth transition at the edges;
[0018] Apply Gaussian blur to the image with a convolution kernel size of 5*5 and an automatically selected standard deviation σ;
[0019] The Real-ESRGAN model is used to enhance the image resolution, resulting in better edge smoothing.
[0020] By adopting the above-described technical solution, the present invention has the following advantages and positive effects compared with the prior art:
[0021] By combining local closing operations with differential connected component analysis, this invention significantly fills small depressions in image masks while strictly limiting the filling area to avoid contour distortion caused by large-scale closing operations. This scheme eliminates unevenness while preserving the original geometric shape to the greatest extent, achieving a smooth effect of "local repair, global invariance." By using preset elliptical structural elements (e.g., 15×15) for local closing operations, supplemented by area threshold filtering, the size of the structural elements and threshold parameters can be easily adjusted according to different resolutions and graphic complexities, achieving precise filling of small depressions while avoiding interference with large-scale details. This parametric design offers high flexibility and is easy to deploy and optimize quickly in practical engineering. After filling the depressions, this invention also introduces two-stage anti-aliasing processing: bilinear interpolation and adaptive Gaussian blur, to finely soften the magnified edges and eliminate jagged artifacts. Subsequently, the Real-ESRGAN super-resolution model is used to reconstruct the image for high definition, significantly improving image clarity while better restoring edge details, resulting in an industrial-grade precision and visual quality in the final output. Attached Figure Description
[0022] Figure 1 This is a flowchart of the image edge smoothing processing method based on the principle of ink droplet diffusion according to the present invention. Detailed Implementation
[0023] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined by the appended claims.
[0024] An image edge smoothing method based on the principle of ink droplet diffusion includes the following steps:
[0025] Step S1: Image mask preprocessing and protrusion removal: Perform corresponding preprocessing on the input original image to carry out preliminary smoothing operations;
[0026] Step S1.1: Perform grayscale processing on the image, mapping the three color channels of the image to a single channel, and calculate the weighted formula as shown in formula (1):
[0027] Gray(x,y)=0.299R+0.587G+00.114B(1)
[0028] Step S1.2: Perform OTSU binarization on the image to divide it into foreground and background parts;
[0029] Step S1.2.1: Calculate the gray-level histogram of the image and the proportion P of each gray-level pixel. i ;
[0030] Step S1.2.2: For each possible threshold t, calculate the total probability w0(t) of class 0 pixels under threshold t, the total probability w1(t) of class 1 pixels under threshold t, the average gray value μ0(t) of all pixels in class 0, and the average gray value μ1(t) of all pixels in class 1. The specific formulas are shown in formulas (3.1), (3.2), (3.3), and (3.4).
[0031]
[0032] Step S1.2.3: Calculate the average gray level of all data. Calculate the between-class variance The specific formula is shown in formula (4):
[0033]
[0034] Step S1.2.4: Find the threshold that maximizes the inter-class variance. When I gray (x,y)>t * When I, the pixel value is 255; when I gray (x,y) <t * When the threshold is set, the pixel value is 0. This method can automatically binarize images without requiring manual threshold setting.
[0035] Step S1.3: Perform median filtering, taking the median of the 5*5 neighborhood for each pixel to remove small noise. The specific formula is shown in formula (2), where I is the input binary image. med This is the filtered image; median(·) means taking the median of the set; i and j represent the coordinates of the neighboring pixels in the image around the current pixel (x,y);
[0036] I med (x,y)=median{I(i,j)|∣ix∣≤2,∣jy∣≤2}(2)
[0037] Step S1.4: Perform the opening operation, first erosion and then dilation. The erosion operation eliminates minor noise, and the dilation operation restores the main body.
[0038] Step S1.5: Connectivity analysis to remove relatively small noise that cannot be eliminated by the above operations.
[0039] Step S2: Filling and filtering of concave areas: Perform local closing operation on the preprocessed image to fill in concave areas, and at the same time filter to delete concave fills that cause significant image distortion.
[0040] Step S2.1: Design an elliptical structural element B′ slightly larger than the expected concavity, preset to 15*15. Perform a local closing operation on the image using B′, where A is the original binary image to be processed, and the specific formula is shown in formula (5), to locally fill the concave area;
[0041]
[0042] Step S2.2: Subtract the image after the closing operation from the original image, perform connected component analysis on the difference graph, and retain smaller connected components to ensure that the image is not significantly distorted;
[0043] Step S3: Image edge anti-aliasing and retouching: Perform anti-aliasing and retouching operations on the image to further improve the smoothness of the image edges.
[0044] Step S3.1: Perform bilinear interpolation on the image to calculate the magnified pixel values, ensuring a smooth transition at the edges;
[0045] Step S3.1.1: Obtain the coordinates of the four pixels surrounding the pixel (x, y).
[0046] Step S3.1.2: Calculate the interpolation weights α = x - x0, β = y - y0 in the horizontal and vertical directions, where (1-α) and (1-β) are the inverse distance weights, respectively;
[0047] Step S3.1.3: Set the gray values I(x) of the four neighboring points. i ,y j To calculate the weighted average, the specific formula is shown in formula (7).
[0048] Shown: I′(u,v)=(1-α)(1-β)I(x0,y0)+α(1-β)I(x1,y0)+(1-α)βI(x0,y1)+αβI(x1,y1)(7)
[0049] Step S3.2: Perform Gaussian blur on the image with a convolution kernel size of 5*5 and an automatically selected standard deviation σ. The specific formula is shown in formula (6):
[0050]
[0051] Step S3.3: Use the Real-ESRGAN model to perform high-resolution processing on the image to achieve better edge smoothing effect.
[0052] Step S3.3.1: Input graphic I LR ∈R H×W×3Perform a 3x3 convolution to extract primary features from the original low-resolution image, providing multi-channel feature representations for subsequent deep networks, resulting in F0∈R. H×W×64 The specific formula is shown in formula (8):
[0053]
[0054] Step S3.3.2: Feed F0 into the backbone network. Each backbone network includes 23 RRDBs. Each RRDB contains 3 DBs concatenated and an overall residual. A single DB (DenseBlock) contains 5 layers of small convolutions and channel concatenation. The first 4 layers are activated with LeakyReLU to generate new features, and the 5th layer only performs convolutional output. Then, the overall residual is applied to proportionally add the output of the 5th layer convolution back to the input of the Block, robustly supplementing new features and avoiding excessive information loss or gradient explosion. Repeat the above steps 23 times to obtain F. 23 ;
[0055] Step S3.3.3: Perform a 3×3 convolution on the output of the last layer of the backbone network to smooth and integrate the multi-scale features of RRDB obtained earlier. Add the result of this convolution to the features extracted from the first layer pixel by pixel, so that the "initial information" can bypass the entire deep network and directly participate in the final prediction, thereby enhancing the network's stability and recovery ability. The specific formula is shown in formula (9):
[0056] B = W body *F 23 +b body ,F trunk =F0+B(9)
[0057] Step S3.3.3: Perform bilinear interpolation. Find the corresponding floating-point coordinates in the source image based on the target location, and calculate the new pixel using the weighted average of the surrounding four points. Perform a 3×3 convolution on the interpolated and enlarged feature map to predict more realistic high-frequency information, and add non-linearity to the convolution output to improve the network's expressive power.
[0058] Step S3.3.4: Perform a weighted summation of the 64-dimensional features at each spatial location to obtain three values: R, G, and B. After adding the bias, convert the result back to the pixel value range and output the super-resolution result.
[0059] The scope of protection of this invention is not limited to the above embodiments. Variations and advantages that can be conceived by those skilled in the art without departing from the spirit and scope of the inventive concept are included in this invention and are protected by the appended claims.
Claims
1. An image edge smoothing method based on the principle of ink droplet diffusion, characterized in that, Includes the following steps: Image masking preprocessing and protrusion removal: The input original image is preprocessed accordingly, and preliminary smoothing operations are performed. The process involves filling and filtering concave areas by performing local closing operations on the preprocessed image to fill in concave regions, while simultaneously filtering to remove concave fills that cause significant image distortion. Image edge anti-aliasing and retouching: Anti-aliasing and retouching operations are performed on the image to further improve the smoothness of the image edges.
2. The image edge smoothing method based on the ink droplet diffusion principle according to claim 1, characterized in that, Image masking preprocessing and protrusion removal include: The image is converted to grayscale, and the three color channels of the image are mapped to a single channel. The weighted formula is shown in formula (1): Gray(x,y)=0.299R+0.587G+00.114B(1) The image is binarized using the maximum inter-class variance method, dividing the image into foreground and background parts; Median filtering is performed by taking the median of a 5x5 neighborhood for each pixel to remove small noise. The specific formula is shown in formula (2), where I is the input binary image. med This is the filtered image; median(·) means taking the median of the set; i and j represent the coordinates of the neighboring pixels in the image around the current pixel (x,y); I med (x,y)=median{I(i,j)|∣i-x∣≤2,∣j-y∣≤2}(2) Perform an opening operation, first eroding and then dilating. The erosion operation eliminates minor noise, and the dilation operation restores the main body. Connectivity analysis is used to remove relatively small noise that cannot be eliminated by the above operations.
3. The image edge smoothing method based on the ink droplet diffusion principle according to claim 2, characterized in that, Image binarization using the Otsu's method includes: Calculate the proportion P of each gray level pixel in the gray-level histogram of the statistical image. i ; For each possible threshold t, calculate the total probability w0(t) of class 0 pixels under threshold t, the total probability w1(t) of class 1 pixels under threshold t, the average gray value μ0(t) of all pixels in class 0, and the average gray value μ1(t) of all pixels in class 1. The specific formulas are shown in formulas (3.1), (3.2), (3.3), and (3.4). Calculate the average gray level of all data Calculate the between-class variance The specific formula is shown in formula (4): Find the threshold that maximizes the inter-class variance. When I gray (x,y)>t * When I, the pixel value is 255; when I gray (x,y) <t * When the pixel value is 0, the pixel value is 0.
4. The image edge smoothing method based on the ink droplet diffusion principle according to claim 1, characterized in that, Depression filling and filtering include: Design an elliptical structural element B′ slightly larger than the expected concavity, preset to 15*15; perform local closing operation on the image through the elliptical structural element B′, where A is the original binary image to be processed, and the specific formula is shown in formula (5), so that it locally fills the concave area. The difference between the image after the closing operation and the original image is calculated. Connectivity analysis is then performed on the difference image to retain smaller connected components, ensuring that the image is not significantly distorted.
5. The image edge smoothing method based on the ink droplet diffusion principle according to claim 1, characterized in that, Image edge anti-aliasing and retouching include: Bilinear interpolation is performed on the image to calculate the magnified pixel values, ensuring a smooth transition at the edges; The image is subjected to Gaussian blur with a convolution kernel size of 5*5 and a standard deviation σ that is automatically selected. The specific formula is shown in formula (6): The Real-ESRGAN model is used to enhance the image resolution.
6. The image edge smoothing method based on the ink droplet diffusion principle according to claim 5, characterized in that, Bilinear interpolation of an image includes: Take the coordinates of the four pixels surrounding the pixel (x, y). Calculate the interpolation weights α = x - x0, β = y - y0 in the horizontal and vertical directions, where (1 - α) and (1 - β) are the inverse distance weights, respectively. gray values I(x) of four neighboring points i ,y j The weighted average is calculated using the formula shown in formula (7): I′(u,v)=(1-α)(1-β)I(x0,y0)+α(1-β)I(x1,y0)+(1-α)βI(x0,y1)+αβI(x1,y1)(7).
7. The image edge smoothing method based on the ink droplet diffusion principle according to claim 5, wherein the image is re-enhanced using the Real-ESRGAN model, includes: For input graphic I LR ∈R H×W×3 Perform a 3x3 convolution to extract primary features from the original low-resolution image, providing multi-channel feature representations for subsequent deep networks, resulting in F0∈R. H×W×64 The specific formula is shown in formula (8): F0 is fed into the backbone network. Each backbone network consists of 23 RRDBs. Each RRDB contains 3 DBs concatenated and an overall residual. Each DB contains 5 layers of small convolutions and channel concatenation. The first 4 layers are activated with LeakyReLU to generate new features, and the 5th layer only performs convolution output. The overall residual is then applied to proportionally add the output of the 5th layer's convolution back to the input of the block, robustly supplementing new features and avoiding excessive information loss or gradient explosion. The above steps are repeated 23 times to obtain F. 23 ; The output of the last layer of the backbone network is subjected to a 3×3 convolution to smooth and integrate the multi-scale features of the RRDB obtained earlier. The result of this convolution is added pixel by pixel to the features extracted by the first layer, so that the "initial information" can bypass the entire deep network and directly participate in the final prediction, thereby strengthening the network stability and recovery ability. The specific formula is shown in formula (9): B=W body *F 23 +b body ,F trunk =F0+B(9) Bilinear interpolation is performed to find the corresponding floating-point coordinates in the source image based on the target position, and the new pixel is calculated by using the weighted average of the four surrounding points. A 3×3 convolution is then performed on the interpolated and enlarged feature map to predict more realistic high-frequency information. Non-linearity is then added to the convolution output to improve the network's expressive power. At each spatial location, the 64-dimensional features are weighted and summed to obtain three values: R, G, and B. After adding the bias, the result is converted back to the pixel value range, and the super-resolution result is output.
Citation Information
Cited By
Road total element model rapid establishment method based on image recognition
CN121435361A