Real number domain high dynamic range blue noise sampling method and system based on error diffusion
Patent Information
- Application Number
- CN202210947433.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-09
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2042-08-09
AI Technical Summary
但是这些方法中,有的是采样点分布性质好但效率低,有的是生成速度快但采样点的分布不够均匀和各项同性,会出现一些可辨别的重复性结构
[0041]This invention can generate continuous domain sampling results. Regarding the quality of the sampling results, the oscillations in the high-frequency region remain at an extremely low level, indicating a very low probability of structural aliasing and implying superior blue noise properties. The number of sampling points can also be precisely controlled by modulating the input signal. In terms of sampling time efficiency, the algorithm complexity of this invention is only related to the number of discrete grid divisions, and is independent of the number of sampling points to be obtained; the sampling time complexity is linear and highly efficient. In terms of sampling spatial efficiency, this invention only requires storing the necessary data for the two scan sequences to be diffused during sampling, resulting in extremely low storage costs. This achieves high-quality, efficient, and controllable blue noise sampling with a controllable number of sampling points. This invention can also be extended to the three-dimensional volume data domain and the three-dimensional point cloud data domain to achieve efficient blue noise sampling for different data domains.
Smart Images

Figure CN115409701B_ABST
Abstract
Description
Technical Field
[0001] This invention provides an image sampling method, specifically a blue noise sampling method based on continuous domain error diffusion using floating-point arithmetic, belonging to the fields of computer graphics and digital image processing. Background Technology
[0002] In computer graphics and digital image processing, sampling is a fundamental building block used in many research and applications. Computer rendering and digital imaging, including rendering, halftone, pointillism, visualization, and animation, all rely on good sampling methods. Furthermore, sampling has numerous applications in digital geometry processing, playing a crucial role in point-based modeling, remeshing, surface texture mapping, object distribution, and motion planning. In these applications, the properties of the sampling point distribution significantly impact the quality and accuracy of the results, making the efficient generation of high-quality sampling point distributions extremely important.
[0003] Researchers have found that the best-quality random sampling point distributions typically possess a blue noise property: their low-frequency spectrum has low energy, no visible artificial textures, and their energy is radially symmetric with good isotropy. Sampling point distributions with blue noise properties can present satisfactory visual effects and are suitable for a wide range of practical applications. Over the past thirty years, researchers have proposed many excellent blue noise sampling algorithms. From the original Poisson disk sampling method (reference: L.-Y.Wei.“Parallel Poisson disk sampling”.ACM Transactions on Graphics,2008,27(3):20:1–20:9.), to iterative optimization methods (reference: M.Balzer,T. From Lloyd's method (ACM Transactions on Graphics, 2009, 28(3): 1–8) to sample- or rule-based generation methods (ACM Transactions on Graphics, 2017, 36(4): 1–13), a series of improved sampling algorithms have emerged, each with its own advantages to meet different application needs. However, some of these methods have good sampling point distribution properties but low efficiency, while others have fast generation speed but the distribution of sampling points is not uniform and isotropic enough, resulting in some identifiable repetitive structures. In general, existing technologies usually have the following disadvantages: low time efficiency, high space cost, or uncontrollable number of sampling points or spectral characteristics, or they are only applicable to a specific sampling data domain.
[0004] In the field of digital halftone, the error diffusion method (reference: B. Zhou and X. Fang. "Improving mid-tone quality of variable-coefficient error diffusion using threshold modulation". ACM Transactions on Graphics, 2003, 22(3): 437–444) is a simple and efficient algorithm for importance sampling of two-dimensional images, and it is widely used in color quantization, spatial distribution, printing industry, and display systems. The basic principle of this algorithm is to compare the image pixel values one by one with the quantization threshold, and then spread the quantization error to the adjacent pixels according to the proportional coefficient to compensate for it, so that the final binary output simulates the grayscale changes of the original image. The key to the error diffusion algorithm is to find an appropriate scanning path and a set of optimized error diffusion coefficients so that the generated sampling point set has blue noise characteristics. Because only points in a certain neighborhood need to be considered during sampling, its algorithm efficiency is very high.
[0005] However, the limitations of traditional error diffusion methods are as follows: 1. They are only applicable to halftone image processing with 256 gray levels in the printing industry, meaning that the sampling density range and sampling accuracy are limited, which is the primary factor limiting their application in mathematics and computer graphics; 2. Regarding blue noise quality, traditional error diffusion methods only exhibit excellent blue noise quality at a few density levels; 3. Traditional error diffusion methods are only applicable to two-dimensional discrete images, producing a two-dimensional image with the same resolution as the input image. Therefore, they cannot generate a number of sampling points exceeding the image resolution, nor can they precisely control the number of sampling points; 4. Traditional error diffusion methods use integers for all inputs, outputs, and intermediate processes, discarding decimal parts during calculation, resulting in inaccurate calculation results. Summary of the Invention
[0006] This invention provides a real-domain high dynamic range blue noise sampling method and system based on error diffusion, which extends the error diffusion method from the discrete domain to the continuous domain, thereby generating the continuous domain sampling point distribution effect with low computational cost while maintaining the blue noise characteristics.
[0007] The technical solution provided by this invention is as follows:
[0008] A continuous-domain error diffusion blue noise sampling method based on floating-point arithmetic, characterized by the following steps:
[0009] 1) Calculate the optimal density dynamic range, optimal error spread coefficient, and threshold modulation coefficient, and generate an optimal coefficient lookup table;
[0010] 2) Normalize the input signal and then scale it to the optimal density dynamic range to obtain the density of the signal to be sampled;
[0011] 3) Calculate the discretization parameters of the signal to be sampled based on the sampling target, and discretize the signal to be sampled onto a grid to obtain a discrete signal;
[0012] 4) Scan the discrete signals in a certain order, accumulate the quantization error of the discrete signal value to be sampled at each grid position and the adjacent grids that have been sampled, generate the sampling point result of the current grid through quantization operation, and spread the quantization error of the output signal to the unprocessed grids in the neighborhood according to the optimal error diffusion coefficient.
[0013] Further, the specific implementation method of step 1) is as follows: select a certain lower density as the upper bound of the optimal density dynamic range to obtain the optimal density dynamic range; obtain a set of key density levels at fixed intervals in the optimal density dynamic range; generate an optimal error spread coefficient and threshold modulation coefficient lookup table by optimizing the Fourier transform spectrum performance of the sampling results generated at each key density level, so that the optimal error spread coefficient and threshold modulation coefficient corresponding to the given signal density can be quickly calculated by looking up the table.
[0014] Furthermore, step 2) is specifically implemented as follows: regardless of whether the input signal is an integer value or a small value, divide it by the maximum value of the signal density to obtain the normalized signal density in the real number field; multiply the normalized density by the upper bound of the optimal density dynamic range and scale it to the optimal density dynamic range.
[0015] Furthermore, the specific implementation method for step 3) is as follows:
[0016] 3-1) Calculating Discretization Parameters: When converting an input continuous signal into a discrete signal field with width w and height h, given its aspect ratio a, we can denote w = a·h; if the output target is to generate N0 sampling points with uniform maximum density of the input signal, then... If the output target is to specify the final output sampling point number as N, then Where d0 is the upper bound of the optimal density dynamic range. Let w be the average density of the signal to be sampled; further, w = a·h can be calculated.
[0017] 3-2) Discretization of signals: If the input signal to be sampled is a continuous two-dimensional density field, it is directly divided into a discrete grid of w×h. The density of the discrete signal to be sampled on each discrete grid is the integral value of the density field in that grid region. If the input signal to be sampled is a discrete two-dimensional density field, it is first expressed as a two-dimensional image. Then, the image width and height are adjusted to w×h using an image interpolation scaling method. After interpolation, the pixel value of each new pixel is the density of the discrete signal to be sampled in the corresponding discrete grid.
[0018] Furthermore, the specific implementation method for step 4) is as follows:
[0019] 4-1) Calculate the signal density value to be quantized: Add the discrete signal density d′(i,j) at the current grid position (i,j) to the cumulative error of all previously sampled adjacent grids diffused to this position, to obtain the signal density value to be quantized p(i,j)=d′(i,j)+Σ k,lC(k,l)·e(k,l), where (k,l) is the sampled adjacent grid of (i,j), C(k,l) is the optimal error diffusion coefficient from (k,l) to (i,j), and e(k,l) is the quantization error generated on (k,l). Both are calculated when scanning the previous grid (k,l), and the calculation method is the same as step 4-4).
[0020] 4-2) Calculate the quantization threshold: The nearest neighbor critical density levels of the real signal density d′(i,j) are d u and d l Obtain the corresponding optimal threshold modulation coefficient m(d) from the optimal coefficient lookup table in step 1). u ) and m(d l The interpolation method is used to calculate the real optimal threshold modulation coefficient m(d′(i,j)) of the current signal density, and then the quantization threshold T(d′(i,j)) = 0.5 + rand(0,1)·m(d′(i,j)) is calculated, where rand(0,1) is a random number between 0 and 1.
[0021] 4-3) Perform quantization to obtain the sampling output: Compare p(i,j) with the modulation threshold T(d′(i,j)). If p(i,j) > T(d′(i,j)), then generate a sampling point in the grid (i,j). The spatial coordinates of the sampling point are... Where rand(0,1) is a random number between 0 and 1; otherwise, no sampling point is generated; the output signal density value b(i,j)∈{0,1} on grid (i,j) is determined according to whether a sampling point is generated: if a sampling point is generated, then b(i,j)=1, otherwise b(i,j)=0;
[0022] 4-4) Calculate the optimal error diffusion coefficient and diffuse the quantization error: The nearest neighbor critical density levels of the real signal density d′(i,j) are d u and d l Obtain the corresponding optimal error diffusion coefficient C(d) from the optimal coefficient lookup table in step 1). u ) and C(d l The algorithm calculates the optimal real-valued error diffusion coefficient C(d′(i,j)) for the current signal density using an interpolation method. It then compares b(i,j) with p(i,j) to obtain the quantization error e(i,j) = b(i,j) - p(i,j) and diffuses e(i,j) to the unprocessed grid positions in the surrounding neighborhood according to the optimal error diffusion coefficient C(d′(i,j)).
[0023] 4-5) Repeat steps 4-1) to 4-4) above in a certain scanning order until all grids on the discrete signal field to be sampled have been processed, thus producing the sampling result of real number domain error diffusion.
[0024] Furthermore, the discrete signal from step 4) is modulated, specifically as follows:
[0025] 5-1) If the number of currently generated sampling points is less than the target number of sampling points, the input signal modulation will be increased; conversely, if the number of currently generated sampling points is greater than the target number of sampling points, the input signal modulation will be decreased.
[0026] 5-2) Based on the above modulation results, re-execute the real-domain error diffusion sampling until the number of generated sampling points equals the target number of sampling points.
[0027] This invention also provides a continuous-domain error diffusion blue noise sampling system based on floating-point arithmetic, characterized in that the sampling system includes a coefficient optimization module, a signal scaling module, a signal discretization module, a real-domain error diffusion sampling module, and a signal modulation module; wherein:
[0028] The coefficient optimization module is used to calculate the optimal density dynamic range, the optimal error spread coefficient, and the threshold modulation coefficient, and to generate an optimal coefficient lookup table.
[0029] The signal scaling module is used to normalize the signal to be sampled and scale it to the optimal density dynamic range;
[0030] The discretization module is used to calculate the discretization parameter w×h of the signal to be sampled and discretize the signal to be sampled to obtain a discrete signal;
[0031] The real-domain error diffusion sampling module is used to scan the discrete signal to obtain the final sampling point result;
[0032] The signal modulation module is used to modulate discrete signals and implement precise control over the number of sampling result points.
[0033] The input of this invention is no longer limited to discrete data with a finite integer density level. It is applicable to continuous input signals with a continuous domain density range and continuous domain sampling accuracy. Moreover, the output of the sampling result is a set of continuous domain sampling points rather than a discrete domain two-dimensional image. The blue noise properties of the sampling result are measured by the power spectrum obtained by Fourier transform, and the diffusion coefficient of the error is optimized, thus realizing high-quality blue noise sampling.
[0034] This invention first divides the continuous data domain into discrete grids conforming to error diffusion standards. Then, it implements real-domain error diffusion sampling based on floating-point operations on the grids, thus replacing the computationally complex continuous-domain sampling. Since the sparse point set distribution generated by the error diffusion algorithm on low-tone signals exhibits good blue noise characteristics, this invention takes the density parameter with the optimal distribution in the error diffusion algorithm as the upper bound of the optimal density dynamic range, normalizing the input signal density to within the optimal density dynamic range. Therefore, the data domain and data type involved in this invention are both continuous real numbers, and the above real-number operations are described using computer floating-point numbers.
[0035] The main differences between the continuous domain error propagation algorithm based on floating-point arithmetic and the traditional error propagation algorithm in this invention are fourfold:
[0036] 1. Regarding input, traditional error diffusion methods only accept two-dimensional images as input, and generally require integer pixel values. In contrast, the real-domain error diffusion method of this invention can accept all two-dimensional data inputs, including discrete two-dimensional images and continuous two-dimensional density fields, which can be integer pixel values or fractional density values. This is because regardless of the input data, it will be normalized to the real number interval [0, 1].
[0037] 2. During algorithm execution, traditional error propagation methods use integers to record any intermediate results, discarding the decimal part of the propagation error and generating systematic quantization errors. In contrast, the real-domain error propagation method based on floating-point arithmetic in this invention retains all parameters and intermediate results as real numbers, significantly reducing quantization errors.
[0038] 3. In the process of optimizing the diffusion parameters, spectral analysis based on Fourier transform is also used as the optimization cost function. However, traditional error diffusion methods use a two-dimensional discrete Fourier transform for the image, while the real-domain error diffusion method based on floating-point arithmetic in this invention uses a continuous Fourier transform based on a set of real points to achieve more accurate spectral analysis. Simultaneously, this invention employs a new cost function to measure the blue noise properties, which helps to better guarantee the blue noise properties of the sampling results.
[0039] 4. Regarding the generated sampling results, traditional error diffusion methods can only be used to generate a number of sampling points lower than the image resolution, but the method of this invention can generate an arbitrary number of sampling points by re-discretizing the input signal and modulating the signal density.
[0040] Compared with the prior art, the beneficial effects of the present invention are:
[0041] This invention can generate continuous domain sampling results. Regarding the quality of the sampling results, the oscillations in the high-frequency region remain at an extremely low level, indicating a very low probability of structural aliasing and implying superior blue noise properties. The number of sampling points can also be precisely controlled by modulating the input signal. In terms of sampling time efficiency, the algorithm complexity of this invention is only related to the number of discrete grid divisions, and is independent of the number of sampling points to be obtained; the sampling time complexity is linear and highly efficient. In terms of sampling spatial efficiency, this invention only requires storing the necessary data for the two scan sequences to be diffused during sampling, resulting in extremely low storage costs. This achieves high-quality, efficient, and controllable blue noise sampling with a controllable number of sampling points. This invention can also be extended to the three-dimensional volume data domain and the three-dimensional point cloud data domain to achieve efficient blue noise sampling for different data domains. Attached Figure Description
[0042] Figure 1 This is a flowchart of a blue noise sampling method based on error diffusion in the real number domain.
[0043] Figure 2 This is the flowchart of the error diffusion sampling algorithm.
[0044] Figure 3 It represents the direction and coefficient of error propagation.
[0045] Figure 4 It is the sampling result when the input is a uniform signal.
[0046] Figure 5 The input signal is non-uniform.
[0047] Figure 6 Therefore Figure 5 The input sampling results are shown in (a) and (b) are the final results. Detailed Implementation
[0048] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, but the scope of the invention is not limited in any way.
[0049] This invention provides a continuous domain error diffusion blue noise sampling method based on floating-point arithmetic. By optimizing the coefficients, scaling the signal, discretizing the signal, performing real-domain error diffusion sampling, and modulating the signal, a specified number of sampling points can be obtained with high quality and efficiency. Figure 1 The diagram illustrates the flowchart of the continuous domain error diffusion blue noise sampling method based on floating-point arithmetic provided by this invention. Taking two-dimensional image data as an example, the goal is to output a set of sampling points in the continuous domain. The specific technical solution is as follows:
[0050] This invention inputs the signal to be sampled into a sampling system and outputs the sampling point results of the signal to be sampled; wherein the strength of the signal to be sampled is represented by density, the difference between two adjacent densities is the density precision, and the difference between the maximum density and the minimum density is the density dynamic range; wherein the sampling system includes the following modules:
[0051] (A) Coefficient Optimization Module: Used to calculate the optimal density dynamic range, optimal error spread coefficient, and threshold modulation coefficient, and generate the optimal coefficient lookup table;
[0052] (B) Signal scaling module: used to normalize the signal to be sampled and scale it to the optimal density dynamic range;
[0053] (C) Signal Discretization Module: Used to calculate the discretization parameters of the signal to be sampled and discretize the signal to be sampled to obtain a discrete signal;
[0054] (D) Real-domain error diffusion sampling module: used to scan the above discrete signal, perform quantization and error diffusion, and generate the final sampling point result;
[0055] (E) Signal modulation module: used to modulate discrete signals and implement precise control over the number of sampling result points;
[0056] The functions and specific implementation methods of each module are as follows:
[0057] The coefficient optimization module (A) is used to calculate the optimal density dynamic range, optimal error diffusion coefficient, and threshold modulation coefficient of the continuous domain error diffusion method. Its implementation method is as follows: A lower density is selected as the upper bound of the optimal density dynamic range to obtain the optimal density dynamic range; within the optimal density dynamic range, a set of key density levels are obtained at fixed intervals; by optimizing the Fourier transform spectrum of the sampling results generated at each key density level, a lookup table for the optimal error diffusion coefficient and threshold modulation coefficient is generated, allowing for the rapid calculation of the optimal error diffusion coefficient and threshold modulation coefficient corresponding to any given signal density by looking up the table. In specific implementation, the following steps may be included:
[0058] A1. Selecting the Optimal Density Dynamic Range. Traditional two-dimensional error diffusion methods typically generate sparse point sets with good blue noise properties on low-tone signals. Therefore, to produce better blue noise sampling results, this invention dynamically scales the entire sampling density range using a density range with good blue noise properties. Based on the discrete error diffusion sampling results of the grayscale image, an integer density i0∈(0, 255) with optimal sampling point distribution properties is selected as the optimal sampling density. The upper bound of the optimal density dynamic range for continuous domain error diffusion is then... The optimal density dynamic range is [0, d0]. As a preferred option, the optimal sampling density i0 is generally chosen to be less than or equal to 16. In this example, i0 = 8 is chosen, so the upper bound of the optimal density dynamic range is... The optimal density dynamic range is [0, 0.03137255].
[0059] A2. Optimize the error spread coefficient and threshold modulation coefficient. Within the optimal density dynamic range [0, d0], a set of key signal density levels are obtained at fixed intervals. By optimizing the Fourier transform spectrum of the sampling results generated at each key density level, a lookup table for the optimal error spread coefficient and threshold modulation coefficient is generated. This allows for the rapid calculation of the optimal error spread coefficient and threshold modulation coefficient corresponding to any given signal density. In this example, the fixed interval for the key signal density levels is taken as... The area [0, d0] is divided into 256 equal parts in the real number field, and the value is then taken as follows: The key density level interval is When performing quantization on the sampled signal d′(i,j), its threshold function is calculated using threshold modulation coefficients m(d′(i,j))∈[0.0,1.0] and a white noise random number generator rand(0,1), i.e.: T(d′(i,j))=0.5+rand(0,1)·m(d′(i,j)). To diffuse the quantization error, this example uses the following method... Figure 3 The diagram shows the 3-neighborhood error propagation direction and coefficients, where the * symbol indicates the currently sampled grid. Its quantization error will propagate along the signal scanning direction to three unprocessed adjacent grids (front, lower back, and directly below). The corresponding error allocation weights, i.e., the error propagation coefficients, are denoted as {C}. 10 C -11 C 01 When calculating the optimal threshold modulation coefficient and optimal error diffusion coefficient for a given key density level g, optimization methods such as the simplex method or simulated annealing can be used. The loss function can be a weighted sum of two spectral features of the sampling result to measure whether the sampling result has blue noise characteristics, i.e.: Target(g) = w·(1-Correlation) dir )+(1-w)·Low(g), where Correlation dir It is the correlation function of the segmented radial average spectrum in each direction after performing a point-based Fourier transform on the sampling results. Low(g) is the low-frequency energy ratio of the Fourier spectrum, and w is the weight, which is 0.9 in this example.
[0060] The signal scaling module (B) is used to normalize and scale the input signal to the optimal density dynamic range to obtain the density d of the signal to be sampled. The implementation method is as follows: divide the input signal by its maximum value to obtain the normalized density in the real number domain; multiply the normalized density by the upper bound of the optimal density dynamic range to scale it to the optimal density dynamic range. In a specific implementation, the following steps may be included:
[0061] B1. Normalize the input signal to the real number domain. Given an input signal I(x, y), whether it is an integer or a decimal value, divide it by the maximum value of the signal density max{I(x, y)} to obtain the normalized signal density in the real number domain. , where (x, y) are spatial coordinates. In this example, since the input is a two-dimensional grayscale image with a grayscale range of [0, 255], the input integer signal of [0, 255] is normalized to the real number domain of [0, 1].
[0062] B2. Scale the normalized input signal to the optimal density dynamic range. Based on the optimal density dynamic range [0, d0] obtained in the coefficient optimization module (A) and the normalized input signal density D, the density of the signal to be sampled can be obtained as d = D·d0, d∈[0, d0].
[0063] The signal discretization module (C) calculates the discretization parameters w×h required for continuous domain error diffusion of the input signal according to the specified sampling output target. This is the number of horizontal / vertical grids required to convert the signal into a discrete signal density field. Given an aspect ratio of a, w can be denoted as a·h. The sampled signal calculated in the signal scaling module (B) is discretized according to the discretization parameters to obtain a two-dimensional discrete signal density field with width w and height h. The discrete signal density on each grid (i, j) is denoted as d′(i, j). In a specific implementation, the following steps may be included:
[0064] C1. Calculate the discretization parameters. If the output objective is to generate N0 sampling points when the input signal has a uniform maximum density, then If the output target is to specify the final output sampling point number as N, then Where d0 is the upper bound of the optimal density dynamic range. Let w be the average density of the signal to be sampled; further, w = a·h can be calculated. In this specific implementation example, if the input signal is assumed to be a uniform maximum density, the specified output target is the number of sampling points N0 = 10000, and a = 1, then h = 565 and w = 565 can be taken. The error diffusion method can use the optimal error diffusion coefficient and threshold modulation coefficient when i = 8. The final sampling result is as follows. Figure 4 As shown; if the input signal is Figure 5If the target output is set to the number of sampling points N = 10000, then h = 840 and w = 630 can be calculated.
[0065] C2. Discretization of the signal. If the input signal to be sampled is a continuous two-dimensional density field, it is directly divided into a w×h discrete grid. The density of the discrete signal to be sampled on each discrete grid is the integral value of the density field within that grid region. If the input signal to be sampled is a discrete two-dimensional density field, it is first expressed as a two-dimensional image, and then the image width and height are adjusted to w×h using an image interpolation scaling method. After interpolation, the pixel value of each new pixel is the density of the discrete signal to be sampled in the corresponding discrete grid. As a preferred solution, this specific implementation example uses bicubic interpolation to change the image size, transforming the input signal into a discrete signal to be sampled with a width of w and a height of h.
[0066] The real-domain error diffusion sampling module (D) performs a continuous-domain error diffusion method based on floating-point arithmetic on the discrete signal d′(i,j) generated in the signal discretization module (C) to produce sampling results, where i∈[0, w-1], j∈[0, h-1].
[0067] The process is as follows Figure 2 As shown, the specific implementation method may include the following steps:
[0068] D1. Calculate the signal density value to be quantized. Add the density d′(i,j) of the discrete signal to be sampled at the current grid position (i,j) to the cumulative error of all previously sampled adjacent grids diffused to that position, to obtain the signal density value to be quantized: p(i,j) = d′(i,j) + ∑ k,l C(k,l)·e(k,l). Where (k,l) is the sampled adjacent grid of (i,j), C(k,l) is the optimal error diffusion coefficient from (k,l) to (i,j), and e(k,l) is the quantization error generated on (k,l). Both are calculated when scanning the previous grid (k,l), and the calculation method is the same as step D4.
[0069] D2. Calculate the quantization threshold. The nearest neighbor critical density levels of the real signal density d′(i,j) are di and dj. u and d l The corresponding optimal threshold modulation coefficient m(d) is obtained from the optimal coefficient lookup table of module (A). u ) and m(d lThe optimal real-valued threshold modulation coefficient m(d′(i,j)) for the current signal density is calculated using an interpolation method, thereby calculating the quantization threshold T(d′(i,j)) = 0.5 + rand(0,1)·m(d′(i,j)), where rand(0,1) is a random white noise number between 0 and 1. As a preferred approach, this specific implementation example uses one-dimensional linear interpolation to obtain the optimal threshold modulation coefficient, i.e., m(d′(i,j)) = (d′(i,j) - d l )·(m(d u )-m(d l ))+m(d l );
[0070] D3. Perform quantization to obtain the sampling output. Compare p(i,j) with the modulation threshold T(d′(i,j)). If p(i,j) > T(d′(i,j)), then generate a sampling point in the grid (i,j). The spatial coordinates of the sampling point are... Where rand(0,1) is a random number between 0 and 1; otherwise, no sampling point is generated. The output signal density value b(i,j)∈{0,1} on the grid (i,j) is determined according to whether a sampling point is generated: if a sampling point is generated, then b(i,j)=1, otherwise b(i,j)=0;
[0071] D4. Calculate the optimal error diffusion coefficient and diffuse the quantization error. The nearest neighbor critical density levels of the real signal density d′(i,j) are di and dj. u and d l The corresponding optimal error diffusion coefficient C(d) is obtained from the optimal coefficient lookup table generated by module (A). u ) and C(d l The algorithm calculates the optimal real-valued error diffusion coefficient C(d′(i,j)) for the current signal density using interpolation. It then compares b(i,j) with p(i,j) to obtain the quantization error e(i,j) = b(i,j) - p(i,j), and diffuses e(i,j) to unprocessed grid positions in the surrounding neighborhood according to the optimal error diffusion coefficient C(d′(i,j)). As a preferred approach, this implementation example uses one-dimensional linear interpolation to obtain the specific optimal error diffusion coefficient, i.e., C(d′(i,j)) = (d′(i,j) - d′(i,j)). l )·(C(d u )-C(d l ))+C(d l This example uses... Figure 3 The diagram shows the 3-neighborhood error diffusion direction and coefficients, where the * position represents the currently sampled grid, and its quantization error is expressed as the error diffusion coefficient C(d′(x,y))={C 10 C-11 C 01} is the weight, which is spread along the signal scanning direction to three unprocessed adjacent grids (front, lower back, and directly below). Therefore, linear interpolation calculation of the optimal error spread coefficient needs to be performed at the above three positions.
[0072] D5. Repeat steps D1 to D4 in a specific scanning order until all grids on the discrete signal field to be sampled have been processed, thus producing the sampling result with real-domain error diffusion. In this specific implementation example, the scanning order can be as follows: Figure 3 The serpentine scanning order shown indicates that when i is even, the scan proceeds from left to right and diffusion error calculations are performed; conversely, when i is odd, the scan proceeds from right to left and diffusion error calculations are performed. Figure 5 The input signal is sampled to obtain the following results: Figure 6 As shown in (a), the number of sampling points is 5408.
[0073] The signal modulation module (E), based on the sampling results generated by the real-domain error diffusion sampling module (D), modulates the discrete signal to precisely control the number of sampling points until the number of output sampling points meets the target condition. A specific implementation method may include the following steps:
[0074] E1. If the number of currently generated sampling points is less than the target number of sampling points, the input signal modulation is increased; conversely, if the number of currently generated sampling points is greater than the target number of sampling points, the input signal modulation is decreased. As a preferred embodiment, in this specific implementation example, the input signal is modulated using the γ transform, that is, for each grid signal d′(i,j) in the two-dimensional density field, g(d′(i,j))=d′(i,j) is executed. γ When solving for γ that satisfies the conditions, since it is difficult to find an analytical solution, it is preferable to use the simplex method to find a numerical solution for γ.
[0075] E2. Based on the modulation results from step E1, the real-domain error diffusion sampling module (D) is re-executed to generate new sampling results. E1 and D can be repeated until the number of generated sampling points equals the target number of sampling points. In this specific implementation example, Figure 6 The output in (a) did not reach the expected number of sampling points. Therefore, the input signal was modulated, and γ was calculated using γ transform to obtain γ = 0.857681, thus obtaining the final sampling result. Figure 6 (b) The total number of sampling points is 10,000.
[0076] It should be noted that the purpose of disclosing the embodiments is to help further understand the present invention. However, those skilled in the art will understand that various substitutions and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, the present invention should not be limited to the content disclosed in the embodiments, and the scope of protection of the present invention is defined by the scope of the claims.
Claims
1. A continuous-domain error diffusion blue noise sampling method based on floating-point arithmetic, characterized in that, The steps include: 1) Calculate the optimal density dynamic range, optimal error spread coefficient, and threshold modulation coefficient, and generate an optimal coefficient lookup table; 2) Normalize the input signal and then scale it to the optimal density dynamic range to obtain the density of the signal to be sampled; 3) Calculate the discretization parameters of the signal to be sampled based on the sampling target. The signal to be sampled is discretized onto a grid to obtain a discrete signal; 4) Scan the discrete signals sequentially, accumulate the quantization error of the discrete signal value to be sampled at each grid position with the quantization error spread from the adjacent sampled grids, generate the sampling point result of the current grid through quantization operation, and spread the quantization error of the output signal to the unprocessed grids in the neighborhood according to the optimal error spread coefficient. The specific implementation method is as follows: 4-1) Calculate the density value of the signal to be quantized: Set the current grid position The density of the discrete signal to be sampled on The signal density value to be quantized is obtained by adding the accumulated errors from all previously sampled adjacent grids diffused to this location. ,in, for The sampled adjacent grid cells, From arrive The optimal error diffusion coefficient, for The quantization error generated above, both are due to the scanning of the preceding raster. The calculation is obtained in the same way as step 4-4). 4-2) Calculate the quantization threshold: real signal density The nearest neighbor critical density levels are and Obtain the corresponding optimal threshold modulation coefficient from the optimal coefficient lookup table in step 1). and The interpolation method is used to calculate the real-valued optimal threshold modulation coefficient for the current signal density. Thus, the quantization threshold is calculated. ,in A random number between 0 and 1; 4-3) Perform quantization to obtain the sampled output result: With modulation threshold To make a comparison, if In the grid A sampling point is generated in the sample, and the spatial coordinates of the sampling point are: ,in A random number between 0 and 1 is used; otherwise, no sampling points are generated; the grid is determined based on whether sampling points are generated. Output signal density value If sampling points are generated, then ,otherwise ; 4-4) Calculate the optimal error diffusion coefficient and diffuse the quantization error: real signal density The nearest neighbor critical density levels are and Obtain the corresponding optimal error diffusion coefficient from the optimal coefficient lookup table in step 1). and The real-valued optimal error diffusion coefficient for the current signal density is calculated using an interpolation method. ;Will and By comparison, the quantization error can be obtained. and will According to the optimal error diffusion coefficient Diffusion extends to unprocessed grid locations in the surrounding neighborhood; 4-5) Repeat steps 4-1) to 4-4) in the scanning order until all grids on the discrete signal field to be sampled have been processed, thus producing the sampling result of real-domain error diffusion.
2. The continuous domain error diffusion blue noise sampling method based on floating-point arithmetic as described in claim 1, characterized in that, Step 1) The specific implementation method is as follows: Select a certain density as the upper bound of the optimal density dynamic range to obtain the optimal density dynamic range; obtain a set of key density levels at fixed intervals in the optimal density dynamic range; generate an optimal error spread coefficient and threshold modulation coefficient lookup table by optimizing the Fourier transform spectrum of the sampling results generated at each key density level, so that the optimal error spread coefficient and threshold modulation coefficient corresponding to the given signal density can be quickly calculated by looking up the table.
3. The continuous domain error diffusion blue noise sampling method based on floating-point arithmetic as described in claim 1, characterized in that, Step 2) The specific implementation method is as follows: Regardless of whether the input signal is an integer value or a small value, divide it by the maximum value of the signal density to obtain the normalized signal density in the real number field; multiply the normalized density by the upper bound of the optimal density dynamic range and scale it to the optimal density dynamic range.
4. The continuous domain error diffusion blue noise sampling method based on floating-point arithmetic as described in claim 1, characterized in that, Step 3) The specific implementation method is as follows: 3-1) Calculate the discretization parameters: Convert the input continuous signal into a signal with a width of... Gao Wei When dealing with a discrete signal field, given that its aspect ratio is a, ; If the output target is to generate N0 sampling points when the input signal has a uniform maximum density, then ; If the output target is to specify the final output sampling point number as N, then ,in This represents the upper bound of the optimal density dynamic range. The average density of the signal to be sampled; 3-2) Discretization of the signal: If the input signal to be sampled is a continuous two-dimensional density field, then it is directly divided into... The discrete grid is used, where the density of the discrete signal to be sampled on each grid is the integral value of the density field within that grid region. If the input signal to be sampled is a discrete two-dimensional density field, it is first expressed as a two-dimensional image, and then the image width and height are adjusted using image interpolation and scaling methods. After interpolation, the pixel value of each new pixel is the density of the discrete signal to be sampled for the corresponding discrete grid.
5. The continuous domain error diffusion blue noise sampling method based on floating-point arithmetic as described in claim 1, characterized in that, The discrete signal in step 4) is modulated as follows: if the number of currently generated sampling points is less than the target number of sampling points, the input signal modulation is increased; conversely, if the number of currently generated sampling points is greater than the target number of sampling points, the input signal modulation is decreased; the signal modulation and continuous domain error diffusion sampling are repeated until the number of generated sampling points is equal to the target number of sampling points.
6. The continuous domain error diffusion blue noise sampling method based on floating-point arithmetic as described in claim 4, characterized in that, The scanning sequence in step 4) adopts a serpentine scanning sequence, that is, when When the number is even, the scan proceeds from left to right and error propagation is performed; otherwise, when the number is less than or equal to the number of seconds, the scan proceeds from left to right and error propagation is performed. If the number is odd, the scan proceeds from right to left and error propagation is performed.
7. A sampling system for implementing the continuous domain error diffusion blue noise sampling method based on floating-point arithmetic as described in claim 1, characterized in that, The sampling system includes a coefficient optimization module, a signal scaling module, a signal discretization module, a real-domain error diffusion sampling module, and a signal modulation module; among which: The coefficient optimization module is used to calculate the error spread coefficient and threshold modulation coefficient within the optimal density dynamic range; The signal scaling module is used to normalize the signal to be sampled and scale it to the optimal density dynamic range; The discretization module is used to calculate the discretization parameters of the signal to be sampled. The sampled signal is then discretized to obtain a discrete signal; The real-domain error diffusion sampling module is used to scan the discrete signal to obtain the final sampling point result; The signal modulation module is used to modulate discrete signals and implement precise control over the number of sampling result points.
Citation Information
Patent Citations
Error diffusion threshold selection method, device and apparatus and storage medium
CN111080721A
Geographic space point data sampling method based on semi-variation function
CN113792105A