White point grey-scale map generation method and device, electronic equipment and storage medium
The generation of white dots in image processing through fractal technology has solved the problem of poor effect of random white dots in the existing technology, and the generation of random white dots with unified shapes and natural transitions has been achieved, which has improved the artistic effect.
Patent Information
- Application Number
- CN202411018342.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-12-31
AI Technical Summary
When generating random white dots in the prior art, the effect is poor, the randomness is poor, the shape of the white dots is inconsistent, and the transition is unnatural, making it difficult to use in art effects.
When generating white points, the path splits based on the pixel coordinates of the to-process image and the coordinate positions of the preset initial white points. The grayscale value of each pixel point is obtained through iterative calculation to ensure that the shape of the white points is uniform and transitional. nature.
It improves the aesthetics and effect of random white dots, and the generated white dots are consistent in shape and natural in transition, which is suitable for programmatically generating art effects.
Smart Images

Figure CN119228943A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for generating a white point grayscale image. Background Art
[0002] In image processing, random white points are often used in various types of programmatic random generation effects. These random white points are generally used as a random position point or image. For example, when generating multiple twinkling star effects, random white points need to be generated as the initial position of the stars. When generating raindrop effects, randomly appearing white points need to be used as the initial pattern of raindrops, etc. At present, random white points are generally generated using random noise such as white noise or perlin noise. However, the effect of random white points generated by the above method is not good. Summary of the invention
[0003] In view of this, the purpose of the present disclosure is to provide a method, device, electronic device and storage medium for generating a white point grayscale image. After generating the first basic white point (preset initial white point) in a fractal manner, path splitting is performed based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and the preset number of iterations to obtain a white point grayscale image with randomness, which can ensure that the shape of each white point is uniform and the transition is natural, so that the generated white points are more beautiful and the effect of the generated random white points is improved.
[0004] In a first aspect, an embodiment of the present disclosure provides a method for generating a white point grayscale image, the method for generating a white point grayscale image comprising:
[0005] Determining the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point;
[0006] Perform path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and preset number of iterations to obtain grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed, wherein the preset parameter is the path offset distance between two white points;
[0007] Integrate the grayscale values corresponding to the plurality of white points corresponding to each pixel on the image to be processed and the grayscale value relative to the preset initial white point to obtain a target grayscale value for each pixel on the image to be processed;
[0008] The target grayscale values of all pixels on the image to be processed are integrated to obtain a white point grayscale image.
[0009] In a second aspect, an embodiment of the present disclosure provides a device for generating a white point grayscale image, the device for generating a white point grayscale image comprising:
[0010] A determination module, configured to determine the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point;
[0011] A path splitting module, used to perform path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and a preset number of iterations, to obtain grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed, wherein the preset parameter is the path offset distance between two white points;
[0012] A first integration module is used to integrate the grayscale values corresponding to the plurality of white points corresponding to each pixel on the image to be processed and the grayscale value relative to the preset initial white point to obtain a target grayscale value of each pixel on the image to be processed;
[0013] The second integration module is used to integrate the target grayscale values of all pixels on the image to be processed to obtain a white point grayscale image.
[0014] In a third aspect, an embodiment of the present disclosure provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for generating a white point grayscale image.
[0015] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned method for generating a white point grayscale image.
[0016] The embodiments of the present disclosure bring the following beneficial effects:
[0017] The above-mentioned method, device, electronic device and storage medium for generating a white point grayscale map determine the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point; perform path splitting based on the coordinate position of each pixel on the image to be processed, the coordinate position of the preset initial white point, preset parameters and a preset number of iterations to obtain grayscale values corresponding to multiple white points corresponding to each pixel on the image to be processed, wherein the preset parameter is the distance of the path offset between two white points; integrate the grayscale values corresponding to multiple white points corresponding to each pixel on the image to be processed and the grayscale value relative to the preset initial white point to obtain the target grayscale value of each pixel on the image to be processed; integrate the target grayscale values of all pixels on the image to be processed to obtain a white point grayscale map. In the method, after the first basic white point (preset initial white point) is generated in a fractal manner, path splitting is performed based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and the preset number of iterations to obtain a white point grayscale image, which is random and can ensure that the shape of each white point is uniform and the transition is natural, making the generated white points more beautiful and improving the effect of the generated random white points.
[0018] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0019] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0021] Figure 1 A schematic diagram of an embodiment of a method for generating a white point grayscale image provided by an embodiment of the present disclosure;
[0022] Figure 2 A schematic diagram of an embodiment of the distance for each path splitting provided in an embodiment of the present disclosure;
[0023] Figure 3A schematic diagram of an embodiment of a three-dimensional surface calculated based on the coordinate position of an initially input pixel point, the coordinate position of an initial white point and a grayscale calculation formula provided in an embodiment of the present disclosure;
[0024] Figure 4 A schematic diagram of an embodiment of the result after the grayscale value of each pixel on the image to be processed relative to the preset initial white point is input to the image to be processed provided by the embodiment of the present disclosure;
[0025] Figure 5 A schematic diagram of an embodiment of the influence of different preset scaling parameter (s) values on a preset initial white point provided in an embodiment of the present disclosure;
[0026] Figure 6 A schematic diagram of an embodiment of a white point grayscale image obtained by different preset control parameters provided in an embodiment of the present disclosure;
[0027] Figure 7 A schematic diagram of an embodiment of a three-dimensional curved surface image of grayscale values and a grayscale value output image when the preset parameter t=0 provided in an embodiment of the present disclosure;
[0028] Figure 8 A schematic diagram of an embodiment of the change of the three-dimensional surface image of V2 (x, y) when the preset parameter (t) takes different values provided in the embodiment of the present disclosure;
[0029] Fig. 9 A schematic diagram of an embodiment of the grayscale value adjustment (scaling) provided in the embodiment of the present disclosure, when the preset parameter t=0.5, the change of the three-dimensional surface image of the grayscale value and the output image of the grayscale value at each iteration;
[0030] Fig.10 A schematic diagram of an embodiment of the present disclosure providing an image obtained by merging the three-dimensional curved surface images of the grayscale values of the first three iterations with the preset parameter t=0.5 and the output images of the grayscale values;
[0031] Fig.11 A schematic diagram of an embodiment of an image obtained by merging output images of grayscale values of the first 7 iterations when the preset parameter t=0.5 provided in the embodiment of the present disclosure;
[0032] Fig.12 A schematic diagram of an embodiment of an image of |x|-k with k=0.5 as an example provided in an embodiment of the present disclosure;
[0033] Fig.13 A schematic diagram of an embodiment of a white point grayscale image obtained after 4 iterations when the preset parameter t=0.5 is provided in an embodiment of the present disclosure;
[0034] Fig.14 A schematic diagram of an embodiment of the present disclosure showing the influence of different preset parameter t values on the distribution of white dots on the basis of creating symmetry through a coordinate system;
[0035] Fig.15 A schematic diagram of a device for generating a white point grayscale image provided by an embodiment of the present disclosure;
[0036] Fig.16 A schematic diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of this embodiment clearer, the technical solution of this disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of this disclosure, rather than all the embodiments. Based on the embodiments in this disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this disclosure.
[0038] In image processing, random white points are often used in various procedural random generation effects. These random white points are generally used as a random position point or image. For example, when generating multiple twinkling star effects, random white points need to be generated as the initial position of the stars. When generating raindrop effects, random white points need to be used as the initial pattern of raindrops, etc. At present, random noises such as white noise or perlin noise are generally used to generate random white points.
[0039] Among them, when generating white noise, a certain value is converted into another random value by means of hash mapping. For example, when generating a two-dimensional white noise image, the coordinate point (x, y) of the input image is used, and then a random value is obtained through a hash function. Then, the same thing is done for several points around this coordinate point, and these random points are interpolated according to the weight to obtain the final white noise value of the current coordinate point (x, y). Peilin noise goes a step further on this, using sine or cosine curves to obtain random values and perform a certain rotation, and finally obtaining perlin noise. In order to obtain better random white points from the above two types of noise, multiple conversions are generally required, such as using multiple smooth curves or multiple sampling interpolations for noise reduction filtering, reducing frequency and other means. The above method of generating random white points with random noise has the problems of poor symmetry of the generated random white points, poor randomness of the overall white points, inconsistent shapes of each white point and poor transition between each point, making it difficult to use the generated white points for artistic effects, resulting in poor effects of the generated random white points.
[0040] Based on the above, this embodiment provides a method, device, electronic device and storage medium for generating a white point grayscale image, which can be applied to dynamic atlas update data processing scenarios of any interface, especially dynamic atlas update data processing scenarios of game interfaces.
[0041] In one embodiment of the present disclosure, the method for generating a white point grayscale image can be run on a terminal device or a server. The terminal device can be a local terminal device. When the method for generating a white point grayscale image is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0042] For ease of understanding, the specific process of this embodiment is described below. Figure 1 In this embodiment, a method for generating a white point grayscale image includes the following steps:
[0043] Step 101, determining the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point;
[0044] Among them, the image to be processed can be an image used to simulate various visual effects and textures in nature. The image to be processed can be an image with a blank background, an image that has rendered basic scene elements but has not added details or special effects, or an image that has completed partial content rendering but still needs further processing to enhance the visual effect.
[0045] Among them, the grayscale value of each pixel on the image to be processed relative to the preset initial white point can be understood as the brightness level determined according to the positional relationship between each pixel of the image to be processed and the preset initial white point, that is, the grayscale value of the pixel points that are gradually away from the preset initial white point gradually decreases and naturally transitions to zero. For example, the pixel points closer to the preset initial white point will be assigned a higher grayscale value to enhance the visual effect or reflection effect, and the grayscale value of the pixel point located at the center position of the preset initial white point is the largest.
[0046] As an example but not limitation, the distance relationship between the coordinate position of each pixel point on the image to be processed and the coordinate position of a preset initial white point can be calculated; the grayscale value of each pixel point on the image to be processed relative to the preset initial white point can be calculated based on the distance relationship and preset distance correlation information (for example, a preset grayscale value calculation formula, etc.).
[0047] Step 102, performing path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and preset number of iterations, to obtain grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed, wherein the preset parameter is the path offset distance between two white points;
[0048] As an example but not limitation, the coordinate position of any pixel point on the image to be processed can be used as the current image coordinates; the path is split based on the current image coordinates and the coordinate position of the preset initial white point, preset parameters and a preset number of iterations to obtain new coordinates after each split; the grayscale value is calculated based on the new coordinates after each split to obtain the grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed.
[0049] It should be noted that in each iteration of path splitting, the coordinates used for the coordinate positions of each pixel point on the image to be processed are all coordinates in the range of [0,1] after being processed by frac(x) and frac(y). Path splitting is performed based on the coordinate positions of each pixel point on the image to be processed, the coordinate positions of the preset initial white point, the preset parameters and the preset number of iterations, and fractal operation is adopted, that is, the characteristics and mathematical means of fractals are adopted. In mathematics, a fractal is a geometric shape, each part of which contains a structure that is reduced by itself at any small scale (a scale smaller than a preset threshold), that is, it has a self-similar property, and its pattern structure is continuously recursive.
[0050] In the path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, the preset parameters and the preset number of iterations, each time a new white point is split, there is an offset distance between the original white point and the offset distance, and the offset distance is strongly related to the position of the original white point. Therefore, the distance of each path splitting is different. As an example but not a limitation, it can be as follows Figure 2 As shown, Figure 2 The arrow in is the direction of path splitting. The original white point (which can be a preset initial white point) is at point A. A distance value t1 (i.e., offset distance) is obtained according to the position of point A. The position obtained by moving the distance value t1 along point A in a certain direction (specific direction) is used as the white point point B obtained by the first splitting. By analogy, this process is repeated. A distance value t2 (i.e., offset distance) is obtained according to the position of point B. The position obtained by moving the distance value t2 in the same direction is used as the white point point C obtained by the second splitting. By analogy, this process is repeated. A distance value t3 (i.e., offset distance) is obtained according to the position of point C. The position obtained by moving the distance value t3 in the same direction is used as the white point point D obtained by the third splitting, until a certain number of splitting times is reached.
[0051] Step 103, integrating the grayscale values corresponding to the multiple white points corresponding to each pixel on the image to be processed and the grayscale value relative to the preset initial white point to obtain the target grayscale value of each pixel on the image to be processed;
[0052] In one implementation, the grayscale values corresponding to the multiple white points corresponding to each pixel on the image to be processed and the grayscale value relative to a preset initial white point may be added to obtain the target grayscale value of each pixel on the image to be processed.
[0053] In one implementation, the grayscale values corresponding to multiple white points corresponding to each pixel on the image to be processed and the grayscale value relative to a preset initial white point can be added to obtain the grayscale value and value of each pixel on the image to be processed; the grayscale value and value of each pixel on the image to be processed are normalized to obtain the target grayscale value of each pixel on the image to be processed.
[0054] Step 104 , integrating the target grayscale values of all pixels on the image to be processed to obtain a white point grayscale image.
[0055] In one implementation, the target grayscale values of all pixels on the image to be processed may be added to obtain a white point grayscale image.
[0056] In one implementation, the target grayscale values of all pixels on the image to be processed may be added to obtain the grayscale values and values of all pixels; and the grayscale values and values of all pixels may be normalized to obtain a white point grayscale image.
[0057] The above-mentioned method for generating a white point grayscale image generates the first basic white point (preset initial white point) in a fractal manner, and then performs path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and the preset number of iterations to obtain a white point grayscale image. The method has randomness and can ensure that the shape of each white point is uniform and the transition is natural, so that the generated white points are more beautiful and the effect of the generated random white points is improved.
[0058] In one implementation, when determining the grayscale value of each pixel on the image to be processed relative to a preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point, specifically, the grayscale value corresponding to each pixel can be calculated based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point, wherein the coordinate position of the preset initial white point is the center coordinate of the preset initial white point; and the grayscale value at each pixel is adjusted by a preset scaling parameter to obtain the grayscale value of each pixel on the image to be processed relative to the preset initial white point.
[0059] As an example but not a limitation, the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point are substituted into a preset grayscale calculation formula to calculate the grayscale value corresponding to each pixel, wherein the grayscale calculation formula is specifically: V1(x, y) is the grayscale value corresponding to each pixel, (x, y) is the coordinate position of each pixel on the image to be processed, and (cx1, cy1) is the coordinate position of the preset initial white point; wherein, the position of the preset initial white point can be changed by changing the coordinate of the preset initial white point; the preset scaling parameter is added to the grayscale calculation formula to obtain the adjusted grayscale calculation formula; the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point are substituted into the adjusted grayscale calculation formula for calculation to obtain the grayscale value of each pixel on the image to be processed relative to the preset initial white point, wherein the adjusted grayscale calculation formula is specifically: s is the preset scaling parameter.
[0060] Among them, the three-dimensional surface calculated based on the coordinate position of the initial input pixel point, the coordinate position of the initial white point and the grayscale calculation formula can be as follows Figure 3 As shown by Figure 3 The three-dimensional surface can be seen intuitively that the transition from the peak to the bottom is smooth. The result after the gray value of each pixel on the image to be processed relative to the preset initial white point is input to the image to be processed can be shown as follows Figure 4 As shown by Figure 4 It can be seen that the grayscale value displayed on the image also naturally transitions from white to black.
[0061] The size of the preset initial white point can be adjusted by adjusting the size of the preset scaling parameter. The influence of different values of the preset scaling parameter (s) on the preset initial white point can be as follows: Figure 5 As shown, Figure 5 (1) shows the size of the preset initial white point when the preset scaling parameter is 0.7. Figure 5 (2) shows the size of the preset initial white point when the preset scaling parameter is 0.5. Figure 5 (3) shows the size of the preset initial white point when the preset scaling parameter is 0.1.
[0062] By calculating the grayscale value based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point, and adjusting the preset scaling parameters, the size of the white point is controlled in a convenient parameter manner, and a natural transition of each white point is achieved, which helps to control the effect of the white point more delicately and accurately.
[0063] In one implementation, when calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of a preset initial white point, specifically, the coordinate position of each pixel point on the image to be processed can be decimalized to obtain the preprocessed coordinate information of each pixel point on the image to be processed; the grayscale value on each pixel point is calculated based on the preprocessed coordinate information of each pixel point on the image to be processed and the coordinate position of the preset initial white point.
[0064] The range of x and y values in the coordinate position of each pixel on the image to be processed is [0,1]. The range of x and y values in the coordinate position of each pixel on the image to be processed is ensured to be [0,1] by performing decimal processing on the coordinate position of each pixel on the image to be processed. The frac(x) function and the frac(y) function can be used to perform decimal processing on the coordinate position of each pixel on the image to be processed. For example, if the coordinate position of one of the pixels on the image to be processed is x=0.5 and y=0.2, the decimal parts are taken respectively, that is, frac(x)=0.5 and frac(y)=0.2. If the coordinate position of one of the pixels on the image to be processed is x=2.5 and y=1.2, the decimal parts are taken respectively, that is, frac(x)=0.5 and frac(y)=0.2. That is, no matter whether x and y exceed 1.0, only their decimal parts are retained to ensure that the (x, y) coordinates are always within the range of [0,1].
[0065] Among them, the execution process of calculating the grayscale value at each pixel point based on the pre-processed coordinate information of each pixel point on the image to be processed and the coordinate position of the preset initial white point is similar to the above-mentioned execution process of calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of the preset initial white point, and will not be repeated here.
[0066] By taking decimals of the coordinate position of each pixel point on the image to be processed and then calculating the grayscale value, the specific position of the pixel point on the image to be processed can be described in more detail, thereby more accurately calculating the grayscale value of each pixel point.
[0067] In one implementation, when calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of a preset initial white point, specifically, the coordinate position of each pixel point on the image to be processed can be decimalized to obtain the preprocessed coordinate information of each pixel point on the image to be processed; based on preset control parameters, the preprocessed coordinate information of each pixel point on the image to be processed is adjusted to obtain the adjusted coordinate information of each pixel point on the image to be processed, wherein the preset control parameters are used to control the density of the overall white point distribution; the grayscale value at each pixel point is calculated based on the adjusted coordinate information of each pixel point on the image to be processed and the coordinate position of the preset initial white point.
[0068] Among them, the preset control parameters include but are not limited to scaling parameters and offset parameters; as an example but not limitation, based on the preset control parameters, the coordinate information after the pre-processed coordinate information of each pixel point on the image to be processed is adjusted (that is, the adjusted coordinate information of each pixel point on the image to be processed) can be as follows: (x, y) = (ScaleX·(frac(x)+OffsetX), ScaleY·(frac(y)+OffsetY)), wherein (x, y) is the adjusted coordinate information of each pixel point on the image to be processed, frac(x) and frac(y) are the pre-processed coordinate information of each pixel point on the image to be processed, ScaleX and ScaleY are scaling parameters, and OffsetX and OffsetY are offset parameters.
[0069] As an example but not a limitation, the white point grayscale image obtained by different preset control parameters can be as follows: Figure 6 As shown, Figure 6 (1) in FIG. 1 shows a white point grayscale image with ScaleX=ScaleY=0.158, OffsetX=-0.921, and OffsetY=0.145. Figure 6 (2) in the figure shows a white point grayscale image with ScaleX=ScaleY=0.671, OffsetX=-0.789, and OffsetY=1.0.
[0070] By adjusting the initial input coordinates (the adjusted coordinate information of each pixel on the image to be processed) based on preset control parameters, a white point grayscale image with different overall white point distribution densities can be obtained by performing different offsets and scaling on the position of the preset initial white point. This does not require increasing performance consumption, and the white point distribution can be efficiently controlled, thereby effectively improving the effect of the generated random white points.
[0071] In one implementation, when path splitting is performed based on the coordinate position of each pixel point on the image to be processed, the coordinate position of a preset initial white point, preset parameters and a preset number of iterations to obtain grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed, specifically, for any pixel point on the image to be processed, a scaling parameter of the first path splitting can be determined based on the coordinate position of any pixel point on the image to be processed and the coordinate position of the preset initial white point; based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the preset initial white point, the scaling parameter of the first path splitting and the preset parameters, the coordinate position of the first white point obtained by the first path splitting is determined, wherein the coordinate position of the first white point is the coordinate after decimal processing; based on the coordinate position of the first white point, the grayscale value of the first white point corresponding to any pixel point on the image to be processed is calculated; based on the coordinate position of the first white point, iterative path splitting is performed based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the first white point and preset parameters, and the grayscale value is calculated until the preset number of iterations is reached, to obtain grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed.
[0072] As an example but not a limitation, the coordinate position of any pixel point on the image to be processed is taken as the current image coordinate, and the square of the length of the coordinate is calculated based on the current image coordinate and the coordinate position of the preset initial white point to obtain the scaling parameter of the first path splitting, wherein the value range of the coordinate position of any pixel point on the image to be processed is [0,1], that is, the coordinate position of any pixel point on the image to be processed is the coordinate in the range of [0,1] after frac(x) and frac(y) processing, and the coordinate position of the preset initial white point is the center coordinate of the preset initial white point. For example, the scaling parameter of the first path splitting can be obtained by calculation using the first preset formula, wherein the first preset formula is specifically: (x-cx1) 2 +(y-cy1) 2 , x, y are the coordinate positions of any pixel point on the image to be processed, cx1, cy1 are the coordinate positions of the preset initial white point, where it should be noted that the scaling parameters of each other path splitting can be obtained in a similar way, that is, the scaling parameters of each path splitting can be scaled according to the coordinates of the original white point to be split and the length of the coordinate position of any pixel point on the image to be processed, that is, the scaling parameters of each path splitting will be different, and the more times the path is split, the smaller the size of the white point.
[0073] As an example but not limitation, the coordinate position of the first white point obtained by path splitting can be obtained by substituting the coordinate position of any pixel point on the image to be processed, the coordinate position of the preset initial white point, the scaling parameter of the first path splitting and the preset parameter into the preset formula, for example, Pnext(x,y) is the coordinate position of the first white point obtained by the first path splitting, x, y are the coordinate positions of any pixel point on the image to be processed, cx1, cy1 are the coordinate positions of the preset initial white point, (x-cx1) 2 +(y-cy1) 2 is the scaling parameter of the first path splitting, and t is the preset parameter, wherein the preset parameter t performs a path offset on the current new coordinate Pnext(x, y). This path offset causes the distance of each path splitting to cause the position of the white point obtained by each path splitting to be different from the position of the original white point, that is, when t=0, the position of the white point obtained by each path splitting is the same as the position of the original white point, and when t>0, the position of the white point obtained by each path splitting will be offset by a certain distance from the position of the original white point.
[0074] The coordinate position of the first white point is processed by square root to obtain the gray value of the first white point corresponding to any pixel on the image to be processed, for example, Among them, V2(x,y) is the gray value of the first white point, Pnext.x 2 Pnext.y is the square of the horizontal coordinate of the first white point. 2 It is the square of the ordinate of the first white point.
[0075] It should be noted that the execution process of each iteration of path splitting after the first path splitting is similar to the execution process of the first path splitting, which will not be repeated here. The preset number of iterations is generally 10 times, generally not more than 15 times, so as to quickly generate a large number of random white points.
[0076] Among them, when the preset parameter t=0, the three-dimensional surface image of the gray value and the gray value output image can be as follows: Figure 7 As shown, Figure 7 (1) shows the three-dimensional surface image of the gray value when the preset parameter t = 0, which is different from Figure 3 Same, still a smoothly transitioning peak image, Figure 7 (2) in FIG. 1 shows the grayscale output image when the preset parameter t = 0. Figure 7 As can be seen from the figure (2), the first white point becomes very small in the lower left corner after scaling, and the position of the first white point is the same as the position of the preset initial white point. When the preset parameter (t) gradually increases, a trough will gradually appear in the three-dimensional surface image of the gray value, and the center of this trough will become a boundary point in the subsequent path splitting, and the split image will use this as a boundary. Among them, when the preset parameter (t) takes different values, the three-dimensional surface image of V2 (x, y) changes as shown in the figure. Figure 8 As shown, Figure 8(1) shows the three-dimensional surface image of the gray value at t = 0.5. Figure 8 (2) shows the three-dimensional surface image of the gray value at t = 0.7. Figure 8 (3) in FIG. 1 shows a three-dimensional surface image of grayscale values at t=1.0.
[0077] The scaling parameters of the first path splitting are determined by the coordinate position of any pixel point on the image to be processed and the coordinate position of the preset initial white point, and the iterative path splitting is performed based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the preset initial white point, the scaling parameters of the first path splitting and the preset parameters. A large number of random white points can be generated relatively quickly without reading any texture map, and the density of the white points is guaranteed to be not too high, the shape of each white point is consistent, and the transition between the white points is natural. At the same time, due to the characteristics of the fractal, each white point will not stick to each other, and the generated white points can achieve the purpose of randomly generating white points by changing the generated path length, so that the generated random white points are more beautiful.
[0078] In one implementation, after calculating the grayscale value of the first white point corresponding to any pixel point on the image to be processed based on the coordinate position of the first white point, it is also possible to: adjust the grayscale value of the first white point corresponding to any pixel point on the image to be processed based on a preset coefficient to obtain the adjusted grayscale value of the first white point corresponding to any pixel point on the image to be processed.
[0079] Since division is involved in the process of calculating the grayscale value, the grayscale value obtained at the coordinates close to (0,0) will be very high. Therefore, the obtained drawing value of the white point will be adjusted (scaled) by a preset coefficient, that is, the grayscale value of the first white point corresponding to any pixel on the image to be processed is multiplied by the preset coefficient to obtain the adjusted grayscale value of the first white point corresponding to any pixel on the image to be processed, wherein the preset coefficient is used to scale the grayscale value of the white point, and the value of the preset coefficient may be less than 1, for example, the preset coefficient is 0.001.
[0080] It should be noted that after the grayscale value of the white point is calculated each time after the path is split, the grayscale value of the white point will be scaled based on a preset coefficient, which will not be described in detail here.
[0081] As an example but not a limitation, after the gray value is adjusted (scaled), when the preset parameter t=0.5, the gray value of the three-dimensional surface image changes and the gray value of the output image can be as follows: Fig. 9 As shown, Fig. 9 (1) shows the three-dimensional surface image of the gray value when the preset parameter t = 0.5, the first iteration, Fig. 9(2) in FIG. 1 shows the output image of the gray value when the preset parameter t=0.5 and the first iteration is: Fig. 9 (3) in FIG. 1 shows the three-dimensional surface image of the gray value when the preset parameter t=0.5 and the second iteration is as follows: Fig. 9 (4) in FIG. 4 shows the output image of the gray value when the preset parameter t=0.5 and the second iteration is: Fig. 9 (5) shows the three-dimensional surface image of the gray value when the preset parameter t = 0.5 and the third iteration, Fig. 9 (6) in FIG. 1 shows the output image of the gray value when the preset parameter t=0.5 and the third iteration; wherein the image after merging the three-dimensional surface images of the gray value of the first three iterations with the preset parameter t=0.5 and the output image of the gray value can be shown as Fig.10 As shown, Fig.10 (1) shows that when the preset parameter t = 0.5, the three-dimensional surface images of the grayscale values of the first three iterations are merged. Fig.10 (2) shows that when the preset parameter t = 0.5, the output images of the grayscale values of the first three iterations are merged; when the preset parameter t = 0.5, the output images of the grayscale values of the first seven iterations are merged, the image can be shown as Fig.11 As shown in the figure, it can be seen that after multiple washing iterations, the white point is getting closer and closer to the center point (0.5, 0.5) (that is, the value of the preset parameter t = 0.5).
[0082] By adjusting (scaling) the grayscale value of the white point based on a preset coefficient, obvious bright spots or overexposure effects in the grayscale output image are avoided, thereby improving the overall visual quality of the grayscale output image (the subsequent white point grayscale image).
[0083] In one implementation, when determining the coordinate position of the first white point obtained by the first path splitting based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the preset initial white point, the scaling parameters of the first path splitting and the preset parameters, the symmetry of the white points can be increased through the coordinate system, and more white points can be generated. Specifically, the horizontal coordinate in the coordinate position of any pixel point on the image to be processed is subtracted from the horizontal coordinate in the coordinate position of the preset initial white point, and the absolute value is taken to obtain the preprocessed horizontal coordinate; the vertical coordinate in the coordinate position of any pixel point on the image to be processed is subtracted from the vertical coordinate in the coordinate position of the preset initial white point, and the absolute value is taken to obtain the preprocessed vertical coordinate; the horizontal coordinate of the first white point obtained by the first path splitting is determined based on the preprocessed horizontal coordinate, the scaling parameters of the path splitting and the preset parameters; the vertical coordinate of the first white point is determined based on the preprocessed vertical coordinate, the scaling parameters of the path splitting and the preset parameters; the horizontal coordinate and the vertical coordinate of the first white point are determined as the coordinate position of the first white point obtained by the first path splitting.
[0084] In the above method, path splitting has been achieved through the characteristics of fractals, and the number of white points has been increased through continuous iterations. However, the number of white points increased by iterations is limited, and the more iterations there are, the lower the performance. Therefore, in this implementation method, the characteristics of fractals will be used to increase the symmetry of white points by changing the coordinate system. When the image becomes symmetrical, the number of white points will increase exponentially along the axis of symmetry.
[0085] Among them, based on the above example In the calculation, the new coordinates obtained after subtracting t from the (x, y) coordinates may be negative, and depending on whether (x, y) takes negative or positive values, there will be four corresponding situations: when Pnext.x is greater than t, Pnext(x, y) will be on the right side of the t axis, when Pnext.x is less than t, Pnext(x, y) will be on the left side of the t axis, when Pnext.y is greater than t, Pnext(x, y) will be on the upper side of the t axis, and when Pnext.y is less than t, Pnext(x, y) will be on the lower side of the t axis. Therefore, the coordinates can be made symmetrical with the t axis by taking the absolute values of each x and y coordinate in Pnext(x, y), that is, The abscissa of the coordinate position of any pixel point on the image to be processed is subtracted from the abscissa of the coordinate position of the preset initial white point, and the absolute value is taken to obtain the abscissa after preprocessing, the ordinate of the coordinate position of any pixel point on the image to be processed is subtracted from the ordinate of the coordinate position of the preset initial white point, and the absolute value is taken to obtain the ordinate after preprocessing, the abscissa of the first white point obtained by the first path splitting is determined based on the abscissa after preprocessing, the scaling parameter of the first path splitting and the preset parameter, the ordinate of the first white point is determined based on the ordinate after preprocessing, the scaling parameter of the path splitting and the preset parameter, the abscissa and the ordinate of the first white point are determined as the coordinate position of the first white point obtained by the first path splitting, which can be as follows:
[0086] It should be noted that the execution process of determining the coordinate position of the first white point in each path splitting after the first path splitting is similar to the execution process of determining the coordinate position of the first white point in the first path splitting mentioned above, and will not be repeated here.
[0087] For the sake of convenience, since (cx1, cy1) is a constant parameter, let (cx1, cy1) = (0, 0) and move t to the numerator. The calculation formula for the coordinate position of the first white point is: x 2 +y 2 is the scaling parameter for path splitting (the square of the length of the previously calculated coordinate (x,y)). It can be seen that when |x|-t·(x2 +y 2 ) is closer to 0, the smaller the Pnext.x is. 2 +y 2 ) is closer to 0, the smaller Pnext.y is obtained. When both Pnext.x and Pnext.y are close to 0, x 2 +y 2 Therefore, assuming that the x and y coordinates of P0 obtained in the previous calculation are close to 0, then P1 obtained in the next iteration will be divided by the square of the length of P0 in the previous iteration according to the above equation. When a number is divided by a number close to 0, a very large number will be obtained, so P1 will be a very large coordinate. At this time, the gray value V2(x,y) will also be very large. The larger the gray value, the closer the current point is to the center of the white point. Therefore, when |x|-t·(x 2 +y 2 ) approaches 0 and |y|-t·(x 2 +y 2 ) approaches 0, the point obtained by the next iteration of this point is a white point, for example, the first white point.
[0088] In |x|-t·(x 2 +y 2 ), t·(x 2 +y 2 ) is a constant that changes in each iteration, so here k is used to represent t·(x 2 +y 2 ), taking k = 0.5 as an example, the image of |x|-k can be obtained as Fig.12 As shown by Fig.12 It can be seen that since x is taken as an absolute value, there will be two intersection points such that |x|-k=0, that is, there will be two white dots at the same time, and since k (i.e. t·(x 2 +y 2 )) is constantly changing and is related to the length of Pnext obtained in the previous iteration. Therefore, each iteration will produce two white dots based on the length of Pnext in the previous iteration. Similarly, |y|-t·(x 2 +y 2 ), that is to say, one iteration will produce 4 white dots at the same time, and with continuous iterations, the white dots produced by this process will increase exponentially.
[0089] After creating symmetry through the coordinate system, due to the increase in symmetry, the number of white spots begins to increase exponentially after 4 iterations. As an example but not a limitation, it can be as follows Fig.13 As shown, Fig.13(1) is the white point grayscale image obtained by iterating 4 times when the preset parameter t = 0.5. Fig.13 (2) is the white point grayscale image obtained by iterating 5 times when the preset parameter t = 0.5. Fig.13 (3) is the white point grayscale image obtained by iterating 6 times when the preset parameter t = 0.5. Fig.13 (4) is the white point grayscale image obtained by iterating 7 times when the preset parameter t=0.5.
[0090] Depend on Fig.13 It can be seen that since the symmetry is achieved by creating a coordinate system, the generated white dots do not look so random. The symmetry can be slightly destroyed by changing the value of the preset parameter t, that is, the path length of each split during fractal formation. When the path lengths of the splits are different, the image will constantly change between symmetry and randomness. As an example but not a limitation, based on creating symmetry by a coordinate system, the influence of different preset parameter t values on the distribution of white dots can be as follows: Fig.14 As shown, Fig.14 (1) is the white point grayscale image obtained when the preset parameter t = 0.329, Fig.14 (2) is the white point grayscale image obtained when the preset parameter t = 0.605, Fig.14 (3) is the white point grayscale image obtained when the preset parameter t = 0.829, Fig.14 (4) is the white point grayscale image obtained when the preset parameter t = 0.934, Fig.14 (5) is the white point grayscale image obtained when the preset parameter t=1.0.
[0091] By creating symmetry through the coordinate system, more white points can be generated quickly and effectively in the process of path splitting, and there will be no adhesion or inconsistent shapes between each white point. Compared with random noise, it is more suitable for some programmatically generated art effects. The overall symmetry or randomness can be maintained, which effectively improves the effect of the generated random white points.
[0092] Corresponding to the above method embodiment, see Fig.15 A schematic diagram of a device for generating a white point grayscale image is shown, the device comprising:
[0093] A determination module 1501 is used to determine the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point;
[0094] The path splitting module 1502 is used to perform path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, the preset parameters and the preset number of iterations to obtain the grayscale values corresponding to the multiple white points corresponding to each pixel point on the image to be processed, wherein the preset parameter is the path offset distance between the two white points;
[0095] The first integration module 1503 is used to integrate the grayscale values corresponding to the multiple white points corresponding to each pixel on the image to be processed and the grayscale value relative to the preset initial white point to obtain the target grayscale value of each pixel on the image to be processed;
[0096] The second integration module 1504 is used to integrate the target grayscale values of all pixels on the image to be processed to obtain a white point grayscale image.
[0097] The above-mentioned white point grayscale image generation device, after generating the first basic white point (preset initial white point) in a fractal manner, performs path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and preset number of iterations to obtain a white point grayscale image, which is random and can ensure that the shape of each white point is uniform and the transition is natural, so that the generated white points are more beautiful and the effect of the generated random white points is improved.
[0098] Optionally, the path splitting module 1502 may also be used for:
[0099] For any pixel point on the image to be processed, a scaling parameter for the first path splitting is determined based on the coordinate position of any pixel point on the image to be processed and the coordinate position of a preset initial white point;
[0100] Based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the preset initial white point, the scaling parameter of the first path splitting and the preset parameters, the coordinate position of the first white point obtained by the first path splitting is determined, wherein the coordinate position of the first white point is the coordinate after decimal processing;
[0101] Calculate the gray value of the first white point corresponding to any pixel point on the image to be processed based on the coordinate position of the first white point;
[0102] Iterative path splitting is performed based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the first white point and preset parameters, and the grayscale value is calculated until the preset number of iterations is reached to obtain the grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed.
[0103] Optionally, the path splitting module 1502 may also be used for:
[0104] The grayscale value of the first white point corresponding to any pixel on the image to be processed is adjusted based on the preset coefficient to obtain the adjusted grayscale value of the first white point corresponding to any pixel on the image to be processed.
[0105] Optionally, the path splitting module 1502 may also be used for:
[0106] Subtract the horizontal coordinate of the coordinate position of the preset initial white point from the horizontal coordinate of the coordinate position of any pixel point on the image to be processed, and take the absolute value to obtain the horizontal coordinate after preprocessing;
[0107] Subtract the ordinate of the coordinate position of the preset initial white point from the ordinate of any pixel point on the image to be processed, and take the absolute value to obtain the preprocessed ordinate;
[0108] Determine the abscissa of the first white point obtained by the first path splitting based on the preprocessed abscissa, the scaling parameter of the path splitting and the preset parameter;
[0109] Determine the ordinate of the first white point based on the preprocessed ordinate, the scaling parameter of the path splitting, and the preset parameters;
[0110] The horizontal coordinate and the vertical coordinate of the first white point are determined as the coordinate position of the first white point obtained by the first path splitting.
[0111] Optionally, the determination module 1501 may also be used to:
[0112] Calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of the preset initial white point, wherein the coordinate position of the preset initial white point is the center coordinate of the preset initial white point;
[0113] By presetting the scaling parameters, the grayscale value at each pixel is adjusted to obtain the grayscale value of each pixel on the image to be processed relative to the preset initial white point.
[0114] Optionally, the determination module 1501 may also be used to:
[0115] The coordinate position of each pixel point on the image to be processed is decimalized to obtain the pre-processed coordinate information of each pixel point on the image to be processed;
[0116] The grayscale value of each pixel is calculated based on the preprocessed coordinate information of each pixel on the image to be processed and the coordinate position of the preset initial white point.
[0117] Optionally, the determination module 1501 may also be used to:
[0118] The coordinate position of each pixel point on the image to be processed is decimalized to obtain the pre-processed coordinate information of each pixel point on the image to be processed;
[0119] Based on preset control parameters, the pre-processed coordinate information of each pixel point on the image to be processed is adjusted to obtain the adjusted coordinate information of each pixel point on the image to be processed, wherein the preset control parameters are used to control the density of the overall white point distribution;
[0120] The grayscale value of each pixel is calculated based on the adjusted coordinate information of each pixel on the image to be processed and the coordinate position of the preset initial white point.
[0121] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for generating a white point grayscale image. The electronic device can be a server or a terminal device.
[0122] See also Fig.16 As shown, the electronic device includes a processor 1600 and a memory 1601, wherein the memory 1601 stores machine executable instructions that can be executed by the processor 1600, and the processor 1600 executes the machine executable instructions to implement the above-mentioned method for generating a white point grayscale image.
[0123] Further, Fig.16 The electronic device shown also includes a bus 1602 and a communication interface 1603 , and the processor 1600 , the communication interface 1603 and the memory 1601 are connected via the bus 1602 .
[0124] Among them, the memory 1601 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 1603 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 1602 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.16 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0125] The processor 1600 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 1600. The above processor 1600 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in this embodiment can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with this embodiment can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, register, or other mature storage media in the art. The storage medium is located in the memory 1601, and the processor 1600 reads the information in the memory 1601 and completes the following steps in combination with its hardware:
[0126] Determine the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point;
[0127] Based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, the preset parameters and the preset number of iterations, the path splitting is performed to obtain the grayscale values corresponding to the multiple white points corresponding to each pixel point on the image to be processed, wherein the preset parameter is the path offset distance between the two white points;
[0128] Integrate the grayscale values corresponding to the multiple white points corresponding to each pixel on the image to be processed and the grayscale value relative to the preset initial white point to obtain the target grayscale value of each pixel on the image to be processed;
[0129] The target grayscale values of all pixels on the image to be processed are integrated to obtain a white point grayscale image.
[0130] The above step of performing path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, the preset parameters and the preset number of iterations to obtain the grayscale values corresponding to the multiple white points corresponding to each pixel point on the image to be processed includes:
[0131] For any pixel point on the image to be processed, a scaling parameter for the first path splitting is determined based on the coordinate position of any pixel point on the image to be processed and the coordinate position of a preset initial white point;
[0132] Based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the preset initial white point, the scaling parameter of the first path splitting and the preset parameters, the coordinate position of the first white point obtained by the first path splitting is determined, wherein the coordinate position of the first white point is the coordinate after decimal processing;
[0133] Calculate the gray value of the first white point corresponding to any pixel point on the image to be processed based on the coordinate position of the first white point;
[0134] Iterative path splitting is performed based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the first white point and preset parameters, and the grayscale value is calculated until the preset number of iterations is reached to obtain the grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed.
[0135] After the above step of calculating the gray value of the first white point corresponding to any pixel point on the image to be processed based on the coordinate position of the first white point, the method further includes:
[0136] The grayscale value of the first white point corresponding to any pixel on the image to be processed is adjusted based on the preset coefficient to obtain the adjusted grayscale value of the first white point corresponding to any pixel on the image to be processed.
[0137] The step of determining the coordinate position of the first white point obtained by the first path splitting based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the preset initial white point, the scaling parameter of the first path splitting and the preset parameter comprises:
[0138] Subtract the horizontal coordinate of the coordinate position of the preset initial white point from the horizontal coordinate of the coordinate position of any pixel point on the image to be processed, and take the absolute value to obtain the horizontal coordinate after preprocessing;
[0139] Subtract the ordinate of the coordinate position of the preset initial white point from the ordinate of any pixel point on the image to be processed, and take the absolute value to obtain the preprocessed ordinate;
[0140] Determine the abscissa of the first white point obtained by the first path splitting based on the preprocessed abscissa, the scaling parameter of the path splitting and the preset parameter;
[0141] Determine the ordinate of the first white point based on the preprocessed ordinate, the scaling parameter of the path splitting, and the preset parameters;
[0142] The horizontal coordinate and the vertical coordinate of the first white point are determined as the coordinate position of the first white point obtained by the first path splitting.
[0143] The above step of determining the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point includes:
[0144] Calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of the preset initial white point, wherein the coordinate position of the preset initial white point is the center coordinate of the preset initial white point;
[0145] By adjusting the grayscale value of each pixel point through the preset scaling parameter, the grayscale value of each pixel point on the image to be processed relative to the preset initial white point is obtained.
[0146] The above step of calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of the preset initial white point includes:
[0147] The coordinate position of each pixel point on the image to be processed is decimalized to obtain the pre-processed coordinate information of each pixel point on the image to be processed;
[0148] The grayscale value of each pixel is calculated based on the preprocessed coordinate information of each pixel on the image to be processed and the coordinate position of the preset initial white point.
[0149] The above step of calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of the preset initial white point includes:
[0150] The coordinate position of each pixel point on the image to be processed is decimalized to obtain the pre-processed coordinate information of each pixel point on the image to be processed;
[0151] Based on preset control parameters, the pre-processed coordinate information of each pixel point on the image to be processed is adjusted to obtain the adjusted coordinate information of each pixel point on the image to be processed, wherein the preset control parameters are used to control the density of the overall white point distribution;
[0152] The grayscale value of each pixel is calculated based on the adjusted coordinate information of each pixel on the image to be processed and the coordinate position of the preset initial white point.
[0153] After generating the first basic white point (preset initial white point) by fractal method, path splitting is performed based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and preset number of iterations to obtain a white point grayscale image with randomness, which can ensure that the shape of each white point is uniform and the transition is natural, making the generated white points more beautiful and improving the effect of the generated random white points.
[0154] This embodiment further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the following steps of the above-mentioned method for generating a white point grayscale image:
[0155] Determine the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point;
[0156] Based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, the preset parameters and the preset number of iterations, the path splitting is performed to obtain the grayscale values corresponding to the multiple white points corresponding to each pixel point on the image to be processed, wherein the preset parameter is the path offset distance between the two white points;
[0157] Integrate the grayscale values corresponding to the multiple white points corresponding to each pixel on the image to be processed and the grayscale value relative to the preset initial white point to obtain the target grayscale value of each pixel on the image to be processed;
[0158] The target grayscale values of all pixels on the image to be processed are integrated to obtain a white point grayscale image.
[0159] The above step of performing path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, the preset parameters and the preset number of iterations to obtain the grayscale values corresponding to the multiple white points corresponding to each pixel point on the image to be processed includes:
[0160] For any pixel point on the image to be processed, a scaling parameter for the first path splitting is determined based on the coordinate position of any pixel point on the image to be processed and the coordinate position of a preset initial white point;
[0161] Based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the preset initial white point, the scaling parameter of the first path splitting and the preset parameters, the coordinate position of the first white point obtained by the first path splitting is determined, wherein the coordinate position of the first white point is the coordinate after decimal processing;
[0162] Calculate the gray value of the first white point corresponding to any pixel point on the image to be processed based on the coordinate position of the first white point;
[0163] Iterative path splitting is performed based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the first white point and preset parameters, and the grayscale value is calculated until the preset number of iterations is reached to obtain the grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed.
[0164] After the above step of calculating the gray value of the first white point corresponding to any pixel point on the image to be processed based on the coordinate position of the first white point, the method further includes:
[0165] The grayscale value of the first white point corresponding to any pixel on the image to be processed is adjusted based on the preset coefficient to obtain the adjusted grayscale value of the first white point corresponding to any pixel on the image to be processed.
[0166] The step of determining the coordinate position of the first white point obtained by the first path splitting based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the preset initial white point, the scaling parameter of the first path splitting and the preset parameter comprises:
[0167] Subtract the horizontal coordinate of the coordinate position of the preset initial white point from the horizontal coordinate of the coordinate position of any pixel point on the image to be processed, and take the absolute value to obtain the horizontal coordinate after preprocessing;
[0168] Subtract the ordinate of the coordinate position of the preset initial white point from the ordinate of any pixel point on the image to be processed, and take the absolute value to obtain the preprocessed ordinate;
[0169] Determine the abscissa of the first white point obtained by the first path splitting based on the preprocessed abscissa, the scaling parameter of the path splitting and the preset parameter;
[0170] Determine the ordinate of the first white point based on the preprocessed ordinate, the scaling parameter of the path splitting, and the preset parameters;
[0171] The horizontal coordinate and the vertical coordinate of the first white point are determined as the coordinate position of the first white point obtained by the first path splitting.
[0172] The above step of determining the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point includes:
[0173] Calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of the preset initial white point, wherein the coordinate position of the preset initial white point is the center coordinate of the preset initial white point;
[0174] By presetting the scaling parameters, the grayscale value at each pixel is adjusted to obtain the grayscale value of each pixel on the image to be processed relative to the preset initial white point.
[0175] The above step of calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of the preset initial white point includes:
[0176] The coordinate position of each pixel point on the image to be processed is decimalized to obtain the pre-processed coordinate information of each pixel point on the image to be processed;
[0177] The grayscale value of each pixel is calculated based on the preprocessed coordinate information of each pixel on the image to be processed and the coordinate position of the preset initial white point.
[0178] The above step of calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of the preset initial white point includes:
[0179] The coordinate position of each pixel point on the image to be processed is decimalized to obtain the pre-processed coordinate information of each pixel point on the image to be processed;
[0180] Based on preset control parameters, the pre-processed coordinate information of each pixel point on the image to be processed is adjusted to obtain the adjusted coordinate information of each pixel point on the image to be processed, wherein the preset control parameters are used to control the density of the overall white point distribution;
[0181] The grayscale value of each pixel is calculated based on the adjusted coordinate information of each pixel on the image to be processed and the coordinate position of the preset initial white point.
[0182] After generating the first basic white point (preset initial white point) by fractal method, path splitting is performed based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and preset number of iterations to obtain a white point grayscale image with randomness, which can ensure that the shape of each white point is uniform and the transition is natural, making the generated white points more beautiful and improving the effect of the generated random white points.
[0183] The computer program product of the method, device, electronic device and storage medium for generating a white point grayscale image provided in this embodiment includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0184] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0185] In addition, in the description of this embodiment, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in this disclosure can be understood according to specific circumstances.
[0186] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0187] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0188] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art who is familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the present embodiments, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be based on the protection scope of the claims.
Claims
1. A method for generating a white point grayscale image, characterized in that: The method comprises: Determining the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point; Perform path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and preset number of iterations to obtain grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed, wherein the preset parameter is the path offset distance between two white points; Integrate the grayscale values corresponding to the plurality of white points corresponding to each pixel on the image to be processed and the grayscale value relative to the preset initial white point to obtain a target grayscale value for each pixel on the image to be processed; The target grayscale values of all pixels on the image to be processed are integrated to obtain a white point grayscale image.
2. The method according to claim 1, characterized in that The step of performing path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and preset number of iterations to obtain grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed, comprises: For any pixel point on the image to be processed, determining a scaling parameter for the first path splitting based on a coordinate position of any pixel point on the image to be processed and a coordinate position of the preset initial white point; Determine the coordinate position of a first white point obtained by the first path splitting based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the preset initial white point, the scaling parameter of the first path splitting and the preset parameter, wherein the coordinate position of the first white point is the coordinate after decimal processing; Calculate the gray value of the first white point corresponding to any pixel point on the image to be processed based on the coordinate position of the first white point; Iterative path splitting is performed based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the first white point and the preset parameters, and the grayscale value is calculated until a preset number of iterations is reached to obtain the grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed.
3. The method according to claim 2, characterized in that After the step of calculating the grayscale value of the first white point corresponding to any pixel point on the image to be processed based on the coordinate position of the first white point, the method further includes: The grayscale value of the first white point corresponding to any pixel on the image to be processed is adjusted based on a preset coefficient to obtain the adjusted grayscale value of the first white point corresponding to any pixel on the image to be processed.
4. The method according to claim 2, characterized in that: The step of determining the coordinate position of the first white point obtained by the first path splitting based on the coordinate position of any pixel point on the image to be processed, the coordinate position of the preset initial white point, the scaling parameter of the first path splitting and the preset parameter comprises: Subtract the horizontal coordinate of the coordinate position of the preset initial white point from the horizontal coordinate of the coordinate position of any pixel point on the image to be processed, and take the absolute value to obtain the horizontal coordinate after preprocessing; Subtract the ordinate of the coordinate position of the preset initial white point from the ordinate of any pixel point on the image to be processed, and take the absolute value to obtain the preprocessed ordinate; Determine the abscissa of the first white point obtained by the first path splitting based on the preprocessed abscissa, the scaling parameter of the path splitting and the preset parameter; Determining the ordinate of the first white point based on the preprocessed ordinate, the scaling parameter of the path splitting and a preset parameter; The horizontal coordinate and the vertical coordinate of the first white point are determined as the coordinate position of the first white point obtained by the first path splitting.
5. The method according to claim 1, characterized in that The step of determining the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point comprises: Calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of a preset initial white point, wherein the coordinate position of the preset initial white point is the center coordinate of the preset initial white point; The grayscale value at each pixel is adjusted by preset scaling parameters to obtain the grayscale value of each pixel on the image to be processed relative to the preset initial white point.
6. The method according to claim 5, characterized in that The step of calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of a preset initial white point comprises: Performing decimal processing on the coordinate position of each pixel point on the image to be processed to obtain the pre-processed coordinate information of each pixel point on the image to be processed; The grayscale value of each pixel is calculated based on the preprocessed coordinate information of each pixel on the image to be processed and the coordinate position of a preset initial white point.
7. The method according to claim 5, characterized in that The step of calculating the grayscale value corresponding to each pixel point based on the coordinate position of each pixel point on the image to be processed and the coordinate position of a preset initial white point comprises: Performing decimal processing on the coordinate position of each pixel point on the image to be processed to obtain the pre-processed coordinate information of each pixel point on the image to be processed; Based on preset control parameters, the preprocessed coordinate information of each pixel point on the image to be processed is adjusted to obtain the adjusted coordinate information of each pixel point on the image to be processed, wherein the preset control parameters are used to control the density of the overall white point distribution; The grayscale value of each pixel is calculated based on the adjusted coordinate information of each pixel on the image to be processed and the coordinate position of the preset initial white point.
8. A device for generating a white point grayscale image, characterized in that: The device for generating the white point grayscale image comprises: A determination module, configured to determine the grayscale value of each pixel on the image to be processed relative to the preset initial white point based on the coordinate position of each pixel on the image to be processed and the coordinate position of the preset initial white point; A path splitting module, used to perform path splitting based on the coordinate position of each pixel point on the image to be processed, the coordinate position of the preset initial white point, preset parameters and a preset number of iterations, to obtain grayscale values corresponding to multiple white points corresponding to each pixel point on the image to be processed, wherein the preset parameter is the path offset distance between two white points; A first integration module is used to integrate the grayscale values corresponding to the plurality of white points corresponding to each pixel on the image to be processed and the grayscale value relative to the preset initial white point to obtain a target grayscale value of each pixel on the image to be processed; The second integration module is used to integrate the target grayscale values of all pixels on the image to be processed to obtain a white point grayscale image.
9. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for generating a white point grayscale image according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method for generating a white point grayscale image according to any one of claims 1 to 7.
