Image rendering method, device, electronic device and computer-readable storage medium
Through the inverse distance weighted interpolation method optimized by convolution kernel and SIMD instruction, the problem of large amount of heat map rendering is solved, real-time rendering and efficient visualization of the client are realized, and efficient processing needs of network user experience data are met.
Patent Information
- Application Number
- CN202110007751.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-05
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-01-05
AI Technical Summary
The existing thermal graph rendering methods are computationally huge when user-level experience data processing, making it difficult to realize real-time rendering on the client side, and cannot meet the efficient visualization needs of network user experience data.
The convolution kernel and inverse distance weighted interpolation method are used to obtain the coordinates of the scoring point in the image to be rendered and the initial score is used to perform matrix operations using the preset convolution kernel and SIMD instructions to reduce the computational complexity and improve rendering efficiency.
Real-time rendering of heat maps on the client is realized, which reduces computing time, improves the visualization efficiency of user experience data, and overcomes the problem of excessive calculation.
Smart Images

Figure CN114612284B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology. Specifically, the present application relates to an image rendering method, device, electronic device and computer-readable storage medium. Background Art
[0002] When operators monitor the network, if they only monitor network element alarms and performance, even if the numbers indicate that the network status is good from a macro perspective, they cannot be sure that all users have a good experience. The conclusions drawn from monitoring only macro data are not accurate or specific enough.
[0003] At present, the Internet has been migrated to thousands of households, and the user-level experience data at each moment is several orders of magnitude higher than the network data volume. Therefore, the original data panorama visualization method cannot meet this demand. Heat maps are introduced to visualize the distribution characteristics of personnel experience scores.
[0004] In order to improve the accuracy of score estimation in the heat map rendering method, the inverse distance weighted interpolation method can be used. However, this algorithm involves power operations and has a huge amount of calculation, making it difficult to perform real-time rendering on the client side. Summary of the invention
[0005] The purpose of this application is to solve at least one of the above-mentioned technical deficiencies, especially the technical defect that it is difficult to perform real-time rendering on the client.
[0006] In a first aspect, a method for image rendering is provided, the method comprising:
[0007] Obtain the first coordinates and initial score of each known score point in the image to be rendered;
[0008] Determine the result matrix using the preset convolution kernel, the first coordinate and the initial score;
[0009] Traverse each element in the result matrix and determine the first pixel value corresponding to each element;
[0010] Determine the pixel point corresponding to each element in the result matrix, set the pixel value of the pixel point to the corresponding first pixel value, and obtain the rendered image.
[0011] In an optional embodiment of the first aspect, before determining the result matrix using the preset convolution kernel, the first coordinate and the initial score, the method further includes:
[0012] Define a matrix with a preset order and determine the center coordinates of the matrix;
[0013] Determine the second coordinate of each element in the matrix, and obtain the distance parameter corresponding to each element based on the second coordinate and the center coordinate;
[0014] Determine the weight parameter corresponding to each element based on the distance parameter;
[0015] Set each element in the matrix to the corresponding weight parameter to obtain the convolution kernel.
[0016] In an optional embodiment of the first aspect, determining a result matrix using a convolution kernel, first coordinates of known scoring points, and an initial score includes:
[0017] Initialize the first numerator matrix and the first denominator matrix respectively;
[0018] Obtaining a molecular increment matrix based on the convolution kernel, the first coordinate, and the initial score;
[0019] Obtain a second numerator matrix based on the numerator increment matrix and the first numerator matrix; obtain a second denominator matrix based on the convolution kernel and the first denominator matrix;
[0020] A result matrix is determined based on the second numerator matrix and the second denominator matrix.
[0021] In an optional embodiment of the first aspect, obtaining a second molecular matrix based on the molecular increment matrix and the first molecular matrix comprises:
[0022] Determine the first element located at the center of the numerator increment matrix;
[0023] The element at the first coordinate in the first molecular matrix is set as the first scoring point;
[0024] The first element is overlapped with the first scoring point and a matrix operation is performed to obtain a second molecular matrix.
[0025] In an optional embodiment of the first aspect, obtaining a second denominator matrix based on the convolution kernel and the first denominator matrix includes:
[0026] Determine the second element at the center coordinates of the convolution kernel;
[0027] Set the element at the first coordinate in the first denominator matrix as the second scoring point;
[0028] The second element is overlapped with the second scoring point and a matrix operation is performed to obtain a second denominator matrix.
[0029] In an optional embodiment of the first aspect, determining a first pixel value corresponding to each element includes:
[0030] Obtain the maximum score value in the initial score of the known score points; determine the grayscale value corresponding to each element according to a preset algorithm based on the existing score and the maximum score value in the result matrix;
[0031] A first pixel value corresponding to the grayscale value is determined.
[0032] In an optional embodiment of the first aspect, determining a result matrix using a preset convolution kernel, a first coordinate, and an initial score includes:
[0033] A single instruction multiple data (SIMD) instruction is used to perform an operation using the preset convolution kernel, the first coordinate, and the initial score to determine a result matrix.
[0034] In a second aspect, a device for image rendering is provided, the device comprising:
[0035] A data acquisition module, used to obtain the first coordinates and initial score of each known score point in the image to be rendered;
[0036] A weighted interpolation module, for determining a result matrix using a preset convolution kernel, a first coordinate and an initial score;
[0037] A color generation module, used for traversing each element in the result matrix and determining a first pixel value corresponding to each element;
[0038] The image rendering module is used to determine the pixel point corresponding to each element in the result matrix, set the pixel value of the pixel point to the corresponding first pixel value, and obtain the rendered image.
[0039] In an optional embodiment of the second aspect, a convolution kernel generation module is further included, which is specifically used to:
[0040] Define a matrix with a preset order and determine the center coordinates of the matrix;
[0041] Determine the second coordinate of each element in the matrix, and obtain the distance parameter corresponding to each element based on the second coordinate and the center coordinate;
[0042] Determine the weight parameter corresponding to each element based on the distance parameter;
[0043] Set each element in the matrix to the corresponding weight parameter to obtain the convolution kernel.
[0044] In an optional embodiment of the second aspect, when the weighted interpolation module determines the result matrix using the preset convolution kernel, the first coordinate and the initial score, it is specifically used to:
[0045] Initialize the first numerator matrix and the first denominator matrix respectively;
[0046] Obtaining a molecular increment matrix based on the convolution kernel and the initial score;
[0047] Obtain a second numerator matrix based on the numerator increment matrix and the first numerator matrix; obtain a second denominator matrix based on the convolution kernel and the first denominator matrix;
[0048] A result matrix is determined based on the second numerator matrix and the second denominator matrix.
[0049] In an optional embodiment of the second aspect, when the weighted interpolation module obtains the second molecular matrix based on the molecular increment matrix and the first molecular matrix, it is specifically used to:
[0050] Determine the first element located at the center of the numerator increment matrix;
[0051] The element at the first coordinate in the first molecular matrix is set as the first scoring point;
[0052] The first element is overlapped with the first scoring point and a matrix operation is performed to obtain a second molecular matrix.
[0053] In an optional embodiment of the second aspect, when the weighted interpolation module obtains the second denominator matrix based on the convolution kernel and the first denominator matrix, it is specifically used to:
[0054] Determine the second element at the center coordinates of the convolution kernel;
[0055] Set the element at the first coordinate in the first denominator matrix as the second scoring point;
[0056] The second element is overlapped with the second scoring point and a matrix operation is performed to obtain a second denominator matrix.
[0057] In an optional embodiment of the second aspect, when determining the first pixel value corresponding to each element, the color generation module is specifically configured to:
[0058] Obtain the maximum score value in the initial score of the known score points; determine the grayscale value corresponding to each element according to a preset algorithm based on the existing score and the maximum score value in the result matrix;
[0059] A first pixel value corresponding to the grayscale value is determined.
[0060] In an optional embodiment of the second aspect, when the weighted interpolation module determines the result matrix using the preset convolution kernel, the first coordinate and the initial score, it is specifically used to:
[0061] A single instruction multiple data (SIMD) instruction is used to perform an operation using the preset convolution kernel, the first coordinate, and the initial score to determine a result matrix.
[0062] In a third aspect, an electronic device is provided, the electronic device comprising:
[0063] A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the image rendering method of any of the above embodiments is implemented.
[0064] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the image rendering method of any of the above-mentioned embodiments.
[0065] The above-mentioned image rendering method first obtains the first coordinates and initial scores of each known scoring point in the image to be rendered, and then calculates the result matrix through the convolution kernel that meets certain conditions and the first coordinates and initial scores, and the result matrix contains the corresponding scores of each pixel in the image to be rendered. Each element in the result matrix is traversed to determine the first pixel value corresponding to each element, and the pixel value is used as the pixel value of the pixel represented by the corresponding element, so as to complete the color filling of each pixel in the image to be rendered, and finally display the rendered score heat map, which overcomes the problem of excessive calculation and difficulty in real-time rendering when rendering the heat map, and reduces the operation time. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.
[0067] Figure 1 A schematic diagram of a flow chart of an image rendering method provided in an embodiment of the present application;
[0068] Figure 2 A schematic diagram of a process for obtaining a convolution kernel in an image rendering method provided in an embodiment of the present application;
[0069] Figure 3a-3c A schematic diagram of obtaining a molecular increment matrix in an image rendering method provided in an embodiment of the present application;
[0070] Figures 4a-4d A schematic diagram of updating a first molecular matrix by using a molecular increment matrix in an image rendering method provided in an embodiment of the present application;
[0071] Figure 5 A flowchart of an image rendering method provided in an embodiment of the present application;
[0072] Figure 6 A schematic diagram of the structure of an image rendering device provided in an embodiment of the present application;
[0073] Figure 7 A schematic diagram of the structure of an electronic device for image rendering provided in an embodiment of the present application. DETAILED DESCRIPTION
[0074] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present invention.
[0075] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0076] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0077] When operators monitor the network, if they only monitor network element alarms and performance, even if the numbers indicate that the network status is good from a macro perspective, it cannot be confirmed that all users have a good experience. The conclusions drawn from macro data monitoring are not accurate or specific enough.
[0078] At present, the Internet has been migrated to thousands of households, and the user-level experience data at each moment is several orders of magnitude higher than the network data volume. Therefore, the original data panorama visualization method cannot meet this demand. Heat maps are introduced to visualize the distribution characteristics of personnel experience scores.
[0079] Heat Map is a simple but very intuitive way of displaying information. It is now widely used in various fields. It plays an increasingly important role in urban planning, population migration, municipal emergency response and decision-making, industry layout, commercial store construction, personal travel, scenic spot monitoring, etc. It is an important component of location big data services.
[0080] Heat maps can use significant color differences to present data effects. Generally speaking, bright colors in heat maps can represent higher frequency of events or higher density of distribution of objects, while dark colors are the opposite. The final presentation effect is often better than the direct display of discrete points, and can intuitively show the density or frequency of spatial data on a two-dimensional plane or map.
[0081] However, the heat map rendering method is not particularly suitable for describing users' experience ratings. It may result in a lower rating after the high ratings are superimposed, making the rating estimation of unknown points inaccurate and reducing the application value of the rating experience distribution map.
[0082] To solve the above problems, based on the heat map data representation, the inverse distance weighted interpolation method is introduced. The inverse distance weighted interpolation method can maintain the score and color of each scoring point, and interpolate between scoring points to maintain a smooth transition between scoring colors. However, this algorithm involves power operations and multiplication and division operations. When the operator needs to visualize scores of more than 100 million, the amount of calculation will be very large, so it becomes difficult to achieve real-time rendering on the client.
[0083] The image rendering method, device, electronic device and computer-readable storage medium provided in this application are intended to solve the above technical problems in the prior art.
[0084] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0085] The image rendering method provided in the embodiment of the present application can be applied to a server or a terminal.
[0086] Technicians in this technical field can understand that the "terminal" used here can be a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a MID (Mobile Internet Device), etc.; the "server" can be implemented by an independent server or a server cluster consisting of multiple servers.
[0087] The inverse distance weighted interpolation method involved in the embodiments of the present application, namely the IDW (Inverse Distance Weight) algorithm, can also be called the inverse distance multiplication method. When calculating a grid node, the weight given to a specific data point is proportional to the inverse of the distance assigned to the node from the node to the observation point of the specified power. The power parameter controls how the weight coefficient decreases as the distance from a grid node increases. For a larger power, closer data points are given a higher weight share, and for a smaller power, the weights are distributed more evenly to each data point.
[0088] The present application provides an image rendering method, such as Figure 1 As shown, the method includes:
[0089] Step S101, obtaining the first coordinates and initial score of each known score point in the image to be rendered.
[0090] In an embodiment of the present application, the image to be rendered may be a macro view of user experience generated based on geographic graphics, which may include network element distribution and user experience ratings. The image to be rendered may also be a user satisfaction view of a certain level of a shopping mall generated based on geographic graphics, which may include store distribution and user satisfaction ratings for each store. The image to be rendered may also be other actual application scene graphs, which may have corresponding coordinates and certain numerical parameters, and this application document does not limit this.
[0091] The known scoring point may be a point with a known scoring in the image to be rendered, and correspondingly, the remaining points except the known scoring point may be set as unknown scoring points. The first coordinate may be the corresponding coordinate of the known scoring point in the image to be rendered, and the initial scoring may be the existing scoring value of the known scoring point before rendering.
[0092] Step S102, determining a result matrix using a preset convolution kernel, a first coordinate and an initial score.
[0093] In the embodiment of the present application, matrix operations can be used to estimate the scores of unknown scoring points.
[0094] The preset convolution kernel can be generated by calling the matrix library according to the algorithm requirements before the calculation, or it can be a pre-set convolution kernel that meets the preset conditions. The preset conditions can be obtained by optimizing the weight calculation method in the inverse distance weighted interpolation method.
[0095] Step S103, traverse each element in the result matrix to determine the first pixel value corresponding to each element.
[0096] In the embodiment of the present application, the result matrix may include parameters such as coordinates and existing scores, and each element has corresponding coordinates and scores. The coordinate establishment rules in the result matrix may be the same as or different from the coordinate establishment rules in the image to be rendered. When the coordinate establishment rules are different, a corresponding relationship may be set so that the coordinates of the two can be converted to each other, so that the elements in the result matrix correspond to the pixels in the image to be rendered.
[0097] In the embodiment of the present application, each element in the result matrix may have an existing score corresponding thereto, and the score value may be first converted into a grayscale value, and then the grayscale value may be converted into a first pixel value through a preset corresponding relationship. The score may also directly correspond to the pixel value, which is not limited in the present application document.
[0098] Step S104, determining the pixel point corresponding to each element in the result matrix, setting the pixel value of the pixel point to the corresponding first pixel value, and obtaining a rendered image.
[0099] In the embodiment of the present application, the size of the result matrix can be adapted to the size of the image to be rendered, so that each element in the result matrix can find the corresponding pixel point in the image to be rendered. In one example, the size of the image to be rendered is 100*100 pixels, and the size of the result matrix can be a corresponding 100-order matrix, that is, a matrix of 100 rows and 100 columns.
[0100] Specifically, each element in the result matrix may have corresponding coordinates and existing scores, and the first pixel value corresponding to each element may be obtained based on the existing scores, and the pixel corresponding to each element may be set to the first pixel value, thereby achieving the purpose of obtaining the rendered image.
[0101] After color filling is performed on the pixels in the rendered image, other processing may be performed on the rendered image, which is not limited in this application document.
[0102] The above-mentioned image rendering method first obtains the first coordinates and initial scores of each known scoring point in the image to be rendered, and then calculates the result matrix through the convolution kernel that meets certain conditions and the first coordinates and initial scores, and the result matrix contains the corresponding scores of each pixel point in the image to be rendered. Each element in the result matrix is traversed to determine the first pixel value corresponding to each element, and the pixel value is used as the pixel value of the pixel point represented by the corresponding element, so as to complete the color filling of each pixel point in the image to be rendered, and finally display the rendered scoring point heat map, which overcomes the problem of excessive calculation and inability to render in real time when rendering the heat map, and reduces the operation time.
[0103] In an embodiment of the present application, the preset convolution kernel may be a convolution kernel calculated by calling a matrix library.
[0104] A class is a user-defined reference data type. Each class contains a data description and a set of functions that operate on data or pass messages. A class can be understood as an abstraction of a class of things with common characteristics. It encapsulates properties and methods, and can describe what an object can do and how it can do it, as well as the procedures and processes that can operate on this object.
[0105] A class library is a comprehensive collection of object-oriented reusable types, including interfaces, abstract classes, and concrete classes. Class libraries can solve a range of common programming tasks, including string management, data collection, database connection, and file access, as well as a variety of specialized development tasks, including desktop applications, web applications, console applications, etc.
[0106] Among them, the matrix class library can be designed based on an object-oriented programming language, and can be obtained as an open source class library, or it can be designed by the designer according to the computing requirements, or it can be a class library designed by others for a fee. The matrix class library can define the data types corresponding to the requirements, and can define various operation operators between these types of data, such as defining operators suitable for column vectors, row vectors and matrices, so that writing vector and emergency operation programs can be as simple as writing mathematical formulas.
[0107] In an embodiment of the present application, the step of obtaining a convolution kernel by calling a matrix library may include:
[0108] (1) Define a matrix with a preset order and determine the center coordinates of the matrix.
[0109] The preset value can be any value in theory, but the size of the preset value is closely related to the effect of using the convolution kernel to obtain the estimated score of the unknown score point. If the preset value is too large, the amount of calculation may increase significantly, resulting in the inability to perform real-time rendering; if the preset value is too small, that is, the size of the convolution kernel is relatively small, the coverage area of the convolution kernel on the input image is small, and the score of the unknown score point is only associated with the score of the known score point within a very small range. It is impossible to achieve the estimated score of the interpolation point (that is, the position score point) between the various score values, and lose the smooth transition. The preset value can be set to a general default value, or it can be set to a value that has a better experimental effect after multiple experiments based on the application scenario. There is no restriction here.
[0110] The concept of "radiation radius" can be introduced to further discuss the influence of matrix size on the display effect of heat map. If the preset value is set too small, the final convolution kernel size is also too small, the "radiation radius" of the convolution kernel is too small, the score of each known score point can only affect a small area nearby, and the color of the heat map becomes uneven; if the preset value is set too large, the "radiation radius" of the convolution kernel will also be too large, and the score of each known score point will affect a large range, which may reduce the contrast between the points and reduce the application value of the heat map.
[0111] In an embodiment of the present application, the shape of the matrix may be a square, the preset value may be an odd number, and the center coordinates may refer to the coordinates of the center element of the square matrix. Specifically, the center coordinates may be calculated by setting the preset value to k, then the center coordinates are (k / 2, k / 2). For example, in one example, the preset value may be 3, then the size of the matrix of order 3 is 3*3, and the center coordinates of the matrix are (1.5, 1.5). The center coordinate calculation method proposed here is for example only. Depending on the way the coordinate axis is established, the coordinate calculation method may change, and the specific calculation method is not limited.
[0112] (2) Determine the second coordinate of each element in the matrix, and obtain the distance parameter corresponding to each element based on the second coordinate and the center coordinate.
[0113] In an embodiment of the present application, the second coordinate of each element in the matrix may be a coordinate representing the position of the element in the matrix. Due to different ways of establishing the coordinate axis, there may be multiple methods for calculating the second coordinate, which are not limited here.
[0114] In the embodiment of the present application, the calculation method of the second coordinate can be consistent with the calculation method of the center coordinate of the matrix, which facilitates the calculation of a reasonable distance parameter.
[0115] In one example, when the size of the matrix is 3*3 and the center coordinate is (1.5, 1.5), the second coordinate of the element in the first row and first column of the matrix may be (0.5, 2.5).
[0116] In the embodiment of the present application, the distance parameter corresponding to each element is obtained based on the second coordinate and the center coordinate, and the calculation formula of the distance parameter can be:
[0117] d i =[(x i -x0) 2 +(y i -y0) 2 ] p (Formula 1)
[0118] Among them, d i represents the distance parameter corresponding to each element, (x0, y0) represents the center coordinate of the matrix, (x i ,y i ) represents the second coordinate corresponding to each element.
[0119] In the embodiment of the present application, when calculating the distance parameter, the power parameter p can be a positive real number, and the influence of the known scoring point on the unknown scoring point (i.e., the interpolated value) can be controlled based on the distance from the center coordinate. Specifically, by defining a higher power value, the nearest known scoring point can be further emphasized. Therefore, as the power increases, the interpolated value will gradually approach the value of the nearest sampling point. When p increases to a certain value, the values between points may lose the smooth transition. When a smaller power value is specified, a greater impact can be exerted on surrounding points that are farther away.
[0120] The value of the power parameter p can be an appropriate value that meets the requirements after multiple experiments, or the lowest power value that produces the minimum mean absolute error can be regarded as the optimal power value.
[0121] (3) Determine the weight parameter corresponding to each element based on the distance parameter.
[0122] In the embodiment of the present application, the weight parameter can be obtained based on the distance parameter.
[0123] The acquisition method may be: when the distance parameter is zero, the weight parameter is set to 1; when the distance parameter is not zero, the weight parameter is set to the reciprocal of the distance parameter.
[0124] (4) Set each element in the matrix to the corresponding weight parameter to obtain the convolution kernel.
[0125] In an embodiment of the present application, in a matrix with an order of a preset value, each element has a distance parameter corresponding to itself, and the weight parameter is obtained based on the distance parameter. Therefore, each element also has a corresponding weight parameter. Each element in the matrix can be set to the corresponding weight parameter to obtain the initialized convolution kernel.
[0126] In an embodiment of the present application, the generation of the convolution kernel can be placed outside the interpolation process and only needs to be calculated once, and the size of the convolution kernel can be constant. The convolution kernel can be used to calculate the weight parameters of the pixel points within the range of the image to be rendered covered by the convolution kernel, thereby reducing the amount of calculation and time complexity and improving the image rendering speed.
[0127] In one example, if Figure 2 As shown, the convolution kernel can be obtained by the following steps:
[0128] (1) Define a convolution matrix with a preset order and determine the center coordinates of the convolution matrix. For example, define the matrix size as K*K, let half = K / 2, then the coordinates of the center of the convolution matrix are (half, half);
[0129] (2) Traverse each element of the convolution matrix, determine the position of each element, and calculate the distance parameter corresponding to each element. For example, use (x, y) to represent the element position, and calculate the distance d from the current element position (x, y) to the center point (half, half);
[0130] (3) Determine the weight parameter corresponding to each element in the convolution matrix based on the distance parameter. We can set w as the weight parameter, set w equal to the fifth power of d, and then judge the value of w. If w is not 0, set w = 1 / w, that is, update the value of w to its reciprocal. If w is 0, set w = 1.
[0131] (4) According to the obtained weight parameter, the value of the corresponding element in the convolution matrix is set, that is, the value of the position (x, y) in the convolution kernel C is set based on the w calculated at the point (x, y);
[0132] (5) Determine whether there is a point position (x, y) in the convolution matrix that has not been visited. If yes, go to step (2); if not, go to step (6);
[0133] (6) When all points in the convolution matrix have been visited, the convolution matrix is used as the convolution kernel, and the initialization of the convolution kernel is completed.
[0134] In the embodiment of the present application, determining the result matrix using the preset convolution kernel, the first coordinate and the initial score may include:
[0135] (1) Initialize the first numerator matrix and the first denominator matrix respectively.
[0136] In an embodiment of the present application, the first numerator matrix and the first denominator matrix may be initialized respectively. The first numerator matrix and the first denominator matrix may be associated with the image to be rendered. Specifically, the size of the first numerator matrix and the first denominator matrix may correspond to the image to be rendered. In one example, the size of the image to be rendered is 100*100, that is, the image to be rendered contains 10,000 pixels, then the size of the first numerator matrix and the first denominator matrix may be 100*100, that is, a matrix of 100 rows and 100 columns.
[0137] The first numerator matrix and the first denominator matrix may include initial coordinates and second initial scores. Specifically, the initial coordinates may be consistent with the first coordinates in the image to be rendered. When the sizes of the first numerator matrix and the first denominator matrix are the same as the size of the image to be rendered, the coordinates of the elements in the two matrices may be consistent with the coordinates of the corresponding pixel points in the image to be rendered. When initializing, all second initial scores in the first numerator matrix and the first denominator matrix may be set to 0.
[0138] (2) Obtain the molecular increment matrix based on the convolution kernel and the initial score.
[0139] In an embodiment of the present application, the convolution kernel can be generated by calling a matrix library to calculate the increments of the numerator and denominator.
[0140] The method for obtaining the numerator increment matrix may be: scalar multiplication of the convolution kernel and the initial score of the known score point in the image to be rendered, and the result may be saved in the numerator increment matrix. Specifically, the size of the numerator increment matrix may be the same as the size of the convolution kernel, and the format of the data stored in the numerator increment matrix may be (x, y, score). Among them, score may represent the data after scalar multiplication, that is, the result of multiplying the score and the weight parameter in the convolution matrix.
[0141] The method for determining the coordinates in the molecular increment matrix can be to first determine the central element of the molecular increment matrix, set the coordinate parameters in the element to the coordinates of the corresponding known scoring point in the image to be rendered, and perform corresponding adaptive settings on the coordinate parameters of the remaining elements, that is, the coordinate parameters of the central element can play a positioning role.
[0142] In one example, suppose the first coordinates and initial score of the known scoring point A are (2,2,75), and 75 is its initial score. Figure 3a As shown; the weight parameter distribution in the convolution kernel C is as follows Figure 3b As shown in the figure, the weight parameter of the central element is 1, and the weight parameters of the remaining elements are w1, w2, etc. The convolution kernel C is scalar-multiplied with the score of the known score point A, and the result is saved in the numerator increment matrix to obtain the numerator increment matrix B. The data format of the elements is (x, y, score). The coordinate parameters and score in the numerator increment matrix B are as follows: Figure 3c shown.
[0143] (3) Obtain a second numerator matrix based on the numerator increment matrix and the first numerator matrix; obtain a second denominator matrix based on the convolution kernel and the first denominator matrix.
[0144] In an embodiment of the present application, the coordinate parameters of the central element of the molecular increment matrix can be the first coordinate of the known scoring point, the central element can be set as the first element, the element in the first molecular matrix that has the same position as the known scoring point in the image to be rendered can be set as the first scoring point, and then the first element is overlapped with the first scoring point and a matrix addition operation is performed to obtain a second molecular matrix.
[0145] Among them, matrix addition can be understood as trimming the part of the first molecular matrix that exceeds the molecular increment matrix after the first element overlaps with the first scoring point, and then traversing the molecular increment matrix point by point, adding the value of the corresponding position to the value of the corresponding position of the first molecular matrix.
[0146] In an embodiment of the present application, a molecular increment matrix corresponding to a known scoring point can be obtained, and the molecular increment matrix can be used to update the first molecular matrix. After completing the first molecular matrix update process based on one of the known scoring points, the convolution sum can be scalar multiplied with the score of the next known scoring point, and the operation content is updated to the molecular increment matrix, that is, the number of known scoring points in the image to be rendered is equal to the number of times the molecular increment matrix and the first molecular matrix are updated. After all known scoring points are traversed, the final matrix can be set as the second molecular matrix.
[0147] In the embodiment of the present application, when obtaining the second denominator matrix based on the convolution kernel and the first denominator matrix, the second element located at the center coordinates of the convolution kernel can be determined first, and then the element in the first denominator matrix that is at the same position as the known scoring point in the image to be rendered is set as the second scoring point, and the second element and the second scoring point can be overlapped and matrix addition operation can be performed to obtain the second denominator matrix. The matrix addition can be the same as the process of matrix addition in the process of obtaining the second numerator matrix.
[0148] (4) Determine a result matrix based on the second numerator matrix and the second denominator matrix.
[0149] In the embodiment of the present application, a matrix division operation may be performed based on the second numerator matrix and the second denominator matrix to obtain a result matrix. Specifically, the second numerator matrix may be divided by the second numerator matrix to obtain a result matrix.
[0150] In one example, the step of updating the first molecule matrix using the molecule increment matrix may include:
[0151] Assume that the first coordinate and initial score of the scoring point A are known to be (2,2,75), and 75 is its initial score. Figure 3a As shown; the weight parameter distribution in the convolution kernel C is as follows Figure 3b As shown in the figure, the weight parameter of the central element is 1, and the weight parameters of the remaining elements are w1, w2, etc. The convolution kernel C is scalar-multiplied with the score of the known score point A, and the result is saved in the numerator increment matrix to obtain the numerator increment matrix B. The data format of the elements is (x, y, score). The coordinate parameters and score in the numerator increment matrix B are as follows: Figure 4a As shown; Initialize the first molecular matrix, such as Figure 4b As shown; the central element of the molecular increment matrix B can be set as the first element, and the element in the first molecular matrix that is at the same position as the known scoring point in the image to be rendered is set as the first scoring point; as Figure 4c and Figure 4d As shown, the first element is overlapped with the first scoring point and a matrix addition operation is performed to complete the update of the first molecule matrix;
[0152] After completing the above-mentioned first molecular matrix update process based on one of the known scoring points, the convolution sum can be scalar multiplied with the score of the next known scoring point, and the operation content can be updated to the molecular increment matrix, that is, the number of known scoring points in the image to be rendered is equal to the number of times the molecular increment matrix and the first molecular matrix are updated. After all known scoring points have been traversed, the final matrix can be set as the second molecular matrix.
[0153] In one example, a specific algorithm for updating the first molecule matrix using the molecule increment matrix may include:
[0154] (1) The data storage format of each element in the first molecular matrix can be (x i ,y i ,score i );
[0155] (2) traversing each element (x, y, score) in the molecular increment matrix, where score can represent the data after scalar multiplication, that is, the result of multiplying the score and the weight parameter in the convolution matrix; the method for determining the coordinates in the molecular increment matrix can be to first determine the central element of the molecular increment matrix, set the coordinate parameters in the element to the coordinates of the corresponding known score point in the image to be rendered, and perform corresponding adaptive settings on the coordinate parameters of the remaining elements;
[0156] (3) Determine whether x exists in the first molecular matrix and the molecular increment matrix i ==x and y i ==y;
[0157] (4) If it exists, update: score i =score i +score, that is (x i ,y i ,score i +score), if it does not exist, add (x,y,score) to the first molecule matrix;
[0158] (5) Determine whether the molecular increment matrix has been completely traversed. If not, return to step (2). If yes, end the process.
[0159] In an embodiment of the present application, a method for updating a first denominator matrix using a convolution kernel may include:
[0160] (1) The convolution kernel can be stored in a one-dimensional array, and the first denominator matrix can be stored in a one-dimensional matrix; determine the subscript position of the center point of the convolution kernel, corresponding to the subscript position of the point to be updated in the first denominator matrix;
[0161] (2) Based on the size of the convolution kernel and the subscript of the center point, the subscript of the left boundary of the convolution kernel can be made to correspond to the subscript of the left boundary of the first denominator matrix, and the corresponding elements can be added. The result can be stored in the first denominator matrix to achieve the purpose of updating the first denominator matrix; if there is an area beyond the coverage of the convolution kernel, it can be trimmed in real time;
[0162] (3) By a similar method, the right boundary, upper boundary and lower boundary subscripts of the convolution kernel can correspond to the right boundary, upper boundary and lower boundary subscripts of the first denominator matrix respectively, and the elements at corresponding positions are added, and the result is stored in the elements at corresponding positions in the first denominator matrix;
[0163] (4) The convolution matrix can be traversed within the four boundary ranges to ensure that each element in the convolution kernel is added to the element at the corresponding position in the first denominator matrix, thereby achieving the purpose of updating the first denominator matrix.
[0164] In the embodiment of the present application, the convolution kernel can be positioned by using the GetRange (get element object of the specified index position range) method.
[0165] The method for obtaining element objects within a specified index position range may include the following steps:
[0166] (1) Set the order of the convolution kernel and the index of the center point, and set the order of the first denominator matrix;
[0167] (2) Subtract half of the convolution kernel order from the index of the center point to obtain the starting position of the index. If the calculated result is less than 0, set the starting position to 0.
[0168] (3) Add half of the convolution kernel order to the index of the center point to obtain the end position of the index. If the end position exceeds the range of the first denominator matrix, the part of the convolution kernel that exceeds the first denominator matrix after overlapping is cut off;
[0169] (4) The position range of the point to be updated can take values continuously between the start position and the end position of the index.
[0170] In an embodiment of the present application, the pixel points in the image to be rendered may include known scoring points and unknown scoring points, and the result matrix may include existing scores and corresponding coordinates of the known scoring points and the unknown scoring points.
[0171] In the embodiment of the present application, determining the first pixel value corresponding to each element may include the following steps:
[0172] (1) Obtain the maximum score value among the initial scores of known score points;
[0173] (2) Based on the existing scores and the maximum score in the result matrix, the grayscale value corresponding to each element is determined according to a preset algorithm.
[0174] In the embodiment of the present application, the grayscale value corresponding to each pixel point can be determined based on the existing score and the maximum score value in the result matrix.
[0175] In an example, the specific process may be to traverse each element in the result matrix, determine the position and score of each element, the score in the result matrix may be set to value, and the score format may be (x, y, value); the score of a known score point may be set to score, and the maximum score value in the score may be set to max; the grayscale value alpha may be calculated by dividing the score value in the result matrix by the maximum score value max, that is, the formula for calculating the grayscale value is alpha = value / max, and the grayscale value corresponding to each element in the result matrix may be obtained.
[0176] (3) Determine a first pixel value corresponding to the grayscale value.
[0177] In an embodiment of the present application, when obtaining a color corresponding to a grayscale value, the correspondence between the grayscale value and the color may be the same as the correspondence in the inverse distance weighted interpolation method. Specifically, the higher the grayscale value, the closer the color is to red, and the lower the grayscale value, the closer the color is to green. The color configuration scheme may be a gradient color band from left to right from red to yellow, yellow to green, corresponding to high grayscale values to low grayscale values. The specific color scheme and correspondence are not limited in this application document.
[0178] In the embodiment of the present application, single instruction multiple data (SIMD) instructions may be used to perform operations and determine a result matrix.
[0179] SIMD (Single Instruction Multiple Data) is a set of instructions that can copy multiple operands and pack them into large registers. SIMD can execute the same instruction at the same time in a synchronous manner, which can help the CPU (Central Processing Unit) achieve data parallelism and improve computing efficiency.
[0180] In an embodiment of the present application, several matrix operations that can be optimized by SIMD instructions can be abstracted from the image rendering process, such as matrix initialization, matrix and scalar multiplication, matrix addition, and matrix division.
[0181] Specifically, you can use a one-dimensional vector to save the value of the matrix, convert the two-dimensional matrix into a one-dimensional vector, and vectorize the operations that need to be optimized. Then you can use SIMD instructions to optimize matrix and scalar multiplication, matrix addition, and matrix division.
[0182] In one example, the optimization process may include:
[0183] (1) Vectorize the two-dimensional matrix and store it in a one-dimensional array;
[0184] (2) Create a Float32x4 and set all channels to the given value. The Float32x4 data type is a 128-bit vector, divided into 4 channels to store single-precision floating-point values.
[0185] (3) Loading and storing from type arrays; SIMD data types are required when actually performing certain operations in SIMD types;
[0186] (4) Group the numbers into groups of 4, and calculate the number of groups and the number of remaining data (if the remaining number is 0, it means there are no remaining numbers, and the remaining number does not exceed 3); the input value is specified in double-precision floating point form and converted to a single-precision floating point value before storage;
[0187] (5) Using SIMD instructions to perform operations, each group of four floating-point numbers is processed to align the center positions of the two matrices to be operated;
[0188] (6) Store Float32x4 into a typed array;
[0189] (7) If all the grouped data have not been processed, multiplication, addition, and division can be performed in a loop;
[0190] (8) Process the remaining data that is not in the group;
[0191] (9)The process ends.
[0192] The above image rendering method can further improve the rendering speed by vectorizing the reconstruction algorithm and using SIMD instructions to help the CPU achieve data parallelism.
[0193] In order to more clearly explain the image rendering method of the present application, the image rendering method will be further described below with reference to specific examples.
[0194] In one example, the present application provides an image rendering method, such as Figure 5 , including the following steps:
[0195] Step S501, obtaining a rating point data list; the rating point data list includes the first coordinates and initial rating of each known rating point in the image to be rendered;
[0196] Step S502, define a convolution matrix with a preset order, and determine the center coordinates of the convolution matrix. For example, define the matrix size as K*K, let half = K / 2, then the coordinates of the center of the convolution matrix are (half, half);
[0197] Step S503, traverse each element of the convolution matrix, determine the position of each element, and calculate the distance parameter corresponding to each element. For example, (x, y) is used to represent the element position, and the distance d from the current element position (x, y) to the center point (half, half) is calculated;
[0198] Step S504, determine the weight parameter corresponding to each element in the convolution matrix based on the distance parameter. You can set w as the weight parameter, set w equal to the fifth power of d, and then judge the value of w. If w is not 0, set w = 1 / w, that is, update the value of w to its reciprocal. If w is 0, set w = 1.
[0199] Step S505, setting the value of the corresponding element in the convolution matrix according to the obtained weight parameter, that is, setting the value of the position (x, y) in the convolution kernel C based on w calculated at the point (x, y);
[0200] Step S506, determine whether there is a point position (x, y) in the convolution matrix that has not been accessed, if yes, go to step S503, if not, go to step S507;
[0201] Step S507, when all points in the convolution matrix are visited, the convolution matrix is used as the convolution kernel, and the initialization of the convolution kernel is ended;
[0202] Step S508, initializing the initial numerator matrix and the initial denominator matrix respectively;
[0203] Step S509, traverse each known scoring point, determine the first coordinate and initial score of each known scoring point, and the scoring point format is (x, y, score);
[0204] Step S510, performing a scalar multiplication operation on the convolution kernel and each initial score, and saving the operation result into a numerator increment matrix;
[0205] Step S511, using the numerator increment matrix to update the initial numerator matrix, and using the convolution kernel to update the initial denominator matrix;
[0206] Step S512, determine whether there are any unprocessed known scoring points, if yes, proceed to step S508, if no, proceed to step S513;
[0207] Step S513, dividing the initial numerator matrix after multiple updates by the initial denominator matrix after multiple updates, and saving the result in a result matrix, which includes the score corresponding to each pixel in the image to be rendered;
[0208] Step S514, determine the grayscale value corresponding to each pixel based on the score and maximum score value in the result matrix. The specific process can be, traversing each element in the result matrix, determining the position and score of each element, the score in the result matrix can be set to value, and the score format is (x, y, value); divide the score value in the result matrix by the maximum score value max in the score of all known score points to calculate the grayscale value alpha, that is, the formula for calculating the grayscale value is alpha = value / max, and calculate the grayscale value corresponding to each element in the result matrix;
[0209] Step S515, filling the color represented by the calculated grayscale value at the corresponding pixel point (x, y);
[0210] Step S516, determine whether there are any unprocessed elements in the result matrix, if yes, execute step S514, if all elements have been processed, proceed to step S517;
[0211] Step S517, obtaining the rendered image, and the rendering process ends.
[0212] The above-mentioned image rendering method first obtains the first coordinates and initial scores of each known scoring point in the image to be rendered, and then calculates the convolution kernel that meets certain conditions with the first coordinates and the initial score to determine the result matrix, which contains the corresponding scores of each pixel in the image to be rendered. Traverse each element in the result matrix, determine the first pixel value corresponding to each element, and use the pixel value as the pixel value of the pixel represented by the corresponding element, so as to complete the color filling of each pixel in the image to be rendered, and finally display the rendered scoring point heat map. The time complexity of the inverse distance weighted interpolation method is reduced by the convolution method, the matrix operation is vectorized, and the SIMD instruction is used to help the CPU process data in parallel, which reduces the operation time and overcomes the problem of excessive calculation and inability to render in real time when rendering the heat map.
[0213] The present application embodiment provides an image rendering device, such as Figure 6 As shown, the image rendering device 60 may include: a data acquisition module 601, a weighted interpolation module 602, a color generation module 603 and an image rendering module 604, wherein:
[0214] The data acquisition module 601 is used to acquire the first coordinates and initial score of each known score point in the image to be rendered;
[0215] A weighted interpolation module 602, configured to determine a result matrix using a preset convolution kernel, a first coordinate, and an initial score;
[0216] The color generation module 603 is used to traverse each element in the result matrix and determine the first pixel value corresponding to each element;
[0217] The image rendering module 604 is used to determine the pixel point corresponding to each element in the result matrix, set the pixel value of the pixel point to the corresponding first pixel value, and obtain a rendered image.
[0218] In an embodiment of the present application, a convolution kernel generation module is also included, which is specifically used to:
[0219] Define a matrix with a preset order and determine the center coordinates of the matrix;
[0220] Determine the second coordinate of each element in the matrix, and obtain the distance parameter corresponding to each element based on the second coordinate and the center coordinate;
[0221] Determine the weight parameter corresponding to each element based on the distance parameter;
[0222] Set each element in the matrix to the corresponding weight parameter to obtain the convolution kernel.
[0223] In one embodiment, when the weighted interpolation module 602 determines the result matrix using the preset convolution kernel, the first coordinate and the initial score, it is specifically used to:
[0224] Initialize the first numerator matrix and the first denominator matrix respectively;
[0225] Obtaining a molecular increment matrix based on the convolution kernel and the initial score;
[0226] Obtain a second numerator matrix based on the numerator increment matrix and the first numerator matrix; obtain a second denominator matrix based on the convolution kernel and the first denominator matrix;
[0227] A result matrix is determined based on the second numerator matrix and the second denominator matrix.
[0228] In one embodiment, when the weighted interpolation module 602 obtains the second molecular matrix based on the molecular increment matrix and the first molecular matrix, it is specifically used to:
[0229] Determine the first element located at the center of the numerator increment matrix;
[0230] The element at the first coordinate in the first molecular matrix is set as the first scoring point;
[0231] The first element is overlapped with the first scoring point and a matrix operation is performed to obtain a second molecular matrix.
[0232] In one embodiment, when the weighted interpolation module 602 obtains the second denominator matrix based on the convolution kernel and the first denominator matrix, it is specifically used to:
[0233] Determine the second element at the center coordinates of the convolution kernel;
[0234] Set the element at the first coordinate in the first denominator matrix as the second scoring point;
[0235] The second element is overlapped with the second scoring point and a matrix operation is performed to obtain a second denominator matrix.
[0236] In one embodiment, when determining the first pixel value corresponding to each element, the color generation module 603 is specifically configured to:
[0237] Obtain the maximum score value in the initial score of the known score points; determine the grayscale value corresponding to each element according to a preset algorithm based on the existing score and the maximum score value in the result matrix;
[0238] A first pixel value corresponding to the grayscale value is determined.
[0239] In one embodiment, when the weighted interpolation module 602 determines the result matrix using the preset convolution kernel, the first coordinate and the initial score, it is specifically used to:
[0240] A single instruction multiple data (SIMD) instruction is used to perform an operation using the preset convolution kernel, the first coordinate, and the initial score to determine a result matrix.
[0241] The above-mentioned image rendering device first obtains the first coordinates and initial scores of each known scoring point in the image to be rendered, and then calculates the convolution kernel that meets certain conditions with the first coordinates and the initial score to determine the result matrix, which contains the corresponding score of each pixel in the image to be rendered. Each element in the result matrix is traversed to determine the first pixel value corresponding to each element, and the pixel value is used as the pixel value of the pixel represented by the corresponding element, thereby completing the color filling of each pixel in the image to be rendered, and finally displaying the rendered score heat map, which overcomes the problem of excessive calculation and difficulty in real-time rendering when rendering the heat map, and reduces the operation time.
[0242] The image rendering device of this embodiment can execute the image rendering method shown in the above embodiments of the present application. The implementation principle is similar and will not be repeated here.
[0243] An electronic device is provided in an embodiment of the present application, and the electronic device includes: a memory and a processor; at least one program, which is stored in the memory and is used to be executed by the processor. Compared with the prior art, it can achieve: obtaining the first coordinates and initial scores of each known score point in the image to be rendered, and then using the convolution kernel that meets certain conditions, the first coordinates and the initial score to calculate and determine the result matrix, which contains the corresponding score of each pixel point in the image to be rendered. Traverse each element in the result matrix, determine the first pixel value corresponding to each element, and use the pixel value as the pixel value of the pixel point represented by the corresponding element, so as to complete the color filling of each pixel point in the image to be rendered, and finally display the rendered score heat map, which overcomes the problem of excessive calculation and difficulty in real-time rendering when rendering the heat map, and reduces the operation time.
[0244] In an alternative embodiment, an electronic device is provided, such as Figure 7 As shown, Figure 7The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0245] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0246] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0247] The memory 4003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.
[0248] The memory 4003 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the application code stored in the memory 4003 to implement the contents shown in the above method embodiment.
[0249] The electronic devices include but are not limited to mobile terminals such as mobile phones, notebook computers, PADs, etc. and fixed terminals such as digital TVs, desktop computers, etc.
[0250] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment.
[0251] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0252] The above descriptions are only some embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. An image rendering method, characterized in that: include: Obtain the first coordinates and initial score of each known score point in the image to be rendered; Determine a result matrix using a preset convolution kernel, the first coordinates and the initial score; Traversing each element in the result matrix, and determining a first pixel value corresponding to each element; Determine a pixel point corresponding to each element in the result matrix, set a pixel value of the pixel point to the corresponding first pixel value, and obtain a rendered image; Before determining the result matrix using the preset convolution kernel, the first coordinates and the initial score, the method further includes: defining a matrix with a preset order, and determining the center coordinates of the matrix; Determine a second coordinate of each element in the matrix, and acquire a distance parameter corresponding to each element based on the second coordinate and the center coordinate; Determine a weight parameter corresponding to each of the elements based on the distance parameter; Each of the elements in the matrix is set to the corresponding weight parameter to obtain the convolution kernel.
2. The image rendering method according to claim 1, characterized in that: Determining a result matrix using a preset convolution kernel, the first coordinates, and the initial score includes: Initialize the first numerator matrix and the first denominator matrix respectively; Acquire a molecular increment matrix based on the convolution kernel, the first coordinate and the initial score; Acquire a second numerator matrix based on the numerator increment matrix and the first numerator matrix; acquire a second denominator matrix based on the convolution kernel and the first denominator matrix; The result matrix is determined based on the second numerator matrix and the second denominator matrix.
3. The image rendering method according to claim 2, characterized in that: Obtaining a second molecular matrix based on the molecular increment matrix and the first molecular matrix includes: determining a first element located at the center of the numerator increment matrix; Setting the element located at the first coordinate in the first molecular matrix as a first scoring point; The first element is overlapped with the first scoring point and a matrix operation is performed to obtain the second molecular matrix.
4. The image rendering method according to claim 3, characterized in that: Obtaining a second denominator matrix based on the convolution kernel and the first denominator matrix includes: Determine a second element of the convolution kernel located at the center coordinates; Setting the element at the first coordinate in the first denominator matrix as a second scoring point; The second element is overlapped with the second scoring point and a matrix operation is performed to obtain the second denominator matrix.
5. The image rendering method according to claim 1, determining the first pixel value corresponding to each of the elements comprises: Obtaining the maximum score value in the initial scores of the known score points; Determine the grayscale value corresponding to each element according to a preset algorithm based on the existing scores in the result matrix and the maximum score value; A first pixel value corresponding to the grayscale value is determined.
6. The image rendering method according to claim 1, characterized in that: Determining a result matrix using a preset convolution kernel, the first coordinates, and the initial score includes: The result matrix is determined by using a single instruction multiple data (SIMD) instruction to perform calculations using a preset convolution kernel, the first coordinates, and the initial score.
7. An image rendering device, characterized in that: include: A data acquisition module, used to obtain the first coordinates and initial score of each known score point in the image to be rendered; A weighted interpolation module, used for determining a result matrix using a preset convolution kernel, the first coordinates and the initial score; A color generation module, used for traversing each element in the result matrix and determining a first pixel value corresponding to each element; An image rendering module, used for determining a pixel point corresponding to each element in the result matrix, setting a pixel value of the pixel point to the corresponding first pixel value, and obtaining a rendered image; A convolution kernel generation module, used to define a matrix with a preset order and determine the center coordinates of the matrix; Determine a second coordinate of each element in the matrix, and acquire a distance parameter corresponding to each element based on the second coordinate and the center coordinate; Determine a weight parameter corresponding to each of the elements based on the distance parameter; Each of the elements in the matrix is set to the corresponding weight parameter to obtain the convolution kernel.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the image rendering method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the image rendering method according to any one of claims 1 to 6.
