Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
FIG. 1 is a flow chart of a method of an embodiment of an image data processing method described herein. Although the present application provides the method operation steps or apparatus structures as shown in the following embodiments or figures, more or less operation steps or module units after partial combination may be included in the method or apparatus based on conventional or non-inventive labor. In the case of steps or structures which do not logically have the necessary cause and effect relationship, the execution sequence of the steps or the module structure of the apparatus is not limited to the execution sequence or the module structure shown in the embodiment or the drawings of the present application. When the described method or module structure is applied to a practical device or an end product, the method or module structure according to the embodiment or the figures may be executed sequentially or executed in parallel (for example, in the environment of parallel processors or multi-thread processing, or even in the environment of distributed processing).
For clarity, an embodiment of the present application is described below with a web-side rendering thermodynamic diagram as an application scenario. However, those skilled in the art will appreciate that the substantial spirit of the present solution may be applied to other mapped image data processing scenarios, such as financial cost maps, point value maps, etc., and image data processing on mobile terminals, self-service terminals, vehicle-mounted systems, servers, etc. The original image data is subjected to smoothing processing to generate uniform image data with uniform numerical value or position distribution (errors within a preset range), then a grid is formed and divided into spliced image blocks, and after the color of each spliced image block is calculated, a data image with more accurate data information expression, smoother color transition and better display effect can be obtained. The following will not be described in the alternative, and the applicability to other implementation scenarios will not be discussed herein.
In a specific embodiment, as shown in fig. 1, in an embodiment of an image data processing method provided by the present application, the method may include:
s1: and performing smooth expansion processing on the data to be processed by adopting a preset algorithm to generate uniform image data.
The data to be processed may generally include collected/acquired original image data, for example, the data to be processed in the application scene for drawing the thermodynamic diagram in this embodiment may be collected temperature data of various cities and towns. These temperature data may typically include a numerical value of the temperature and a city name (or city coordinates of a stable collection site). As shown in fig. 2, when the thermodynamic diagram is drawn at the web end, the acquired data to be processed may be displayed on a canvas. FIG. 2 is a diagram illustrating an embodiment of a display of data to be processed on a canvas. Assume that in the present embodiment, temperature data of four cities C1, C2, C3, and C4, which are 5 degrees celsius, 7 degrees celsius, 8 degrees celsius, and 10 degrees celsius respectively, are collected when the thermodynamic diagram is drawn, and are distributed on a web drawing area (in the present embodiment, the drawing area is a canvas) as shown in fig. 2.
Generally, in some application scenarios, the obtained numerical values or spatial distribution positions of the data to be processed are usually non-uniform, such a data distribution characteristic is that when an existing progressive circular data image is drawn, the region with dense data distribution has insufficient discrimination, and the region with sparse data distribution has poor color continuity, and a blank is easily generated as a covered region. According to the embodiment of the application, smooth expansion processing can be performed on the data to be processed by utilizing a pre-selected algorithm, so that the original data to be processed is expanded into uniform image data which is uniformly distributed on a plane in a position mode. Since the same coordinate system is generally used for one drawing region, it can be understood that the above-mentioned uniform image data with uniformly distributed positions also has a uniformly distributed numerical size, or it can be understood from the numerical value that the variance (or standard deviation) of the uniform image data generated after the smooth expansion processing is within a predetermined acceptable range. Thus, the uniform image data which are uniformly distributed can be obtained by utilizing the original data to be processed.
The specific preset algorithm used for performing the smooth expansion processing on the data to be processed in the present application may include various implementation manners, such as generating equidistant data values according to the data to be processed, a kenel smoothing algorithm, a moving window polynomial, a quincunx cubic smoothing algorithm, and the like, or other processing manners defined by an operator. Fig. 3 is a schematic diagram of uniform image data points calculated by using a preset algorithm provided in the present application, and in fig. 3, coordinates of data to be processed in a drawing area may be respectively extended toward coordinate axes of the drawing area, and the resulting intersections of extension lines are used as data points D1 to D36 of the produced uniform image data. Of course, other algorithms for performing the smooth expansion processing may be selected or set/defined according to the data processing requirements or the actual image data processing scenarios, which are not described in detail herein.
It should be noted that, in general, the number of uniform image data obtained after the smooth expansion processing is usually greater than the number of the data to be processed. As shown in fig. 4, fig. 4 is a schematic diagram of a list of uniform image data obtained by performing smooth expansion processing on the four data to be processed in fig. 2. In fig. 4, the data to be processed C1, C2, C3, and C4 are processed by some smoothing algorithm, and 121 pieces of uniform image data from (x-0, y-0) to (x-10, y-10) are generated. Thus, the number K of uniform image data generated in the application scenario of the present embodiment is much larger than the number N of originally acquired data to be processed, i.e., K-121 > N-4. Therefore, in a specific embodiment of the smooth expansion processing provided by the present application, the performing smooth expansion processing on the data to be processed by using a preset algorithm to generate uniform image data includes:
s101: determining an adopted smoothing algorithm;
s102: and expanding the N data to be processed into K uniform image data by using the smoothing algorithm, wherein K is more than or equal to N, and the uniform image data is data with the error between adjacent data points within a preset range after numerical value and size sequencing.
According to the embodiment of the application, the smooth expansion processing can be performed on the data to be processed by utilizing the preselected smoothing algorithm, so that the original data to be processed is expanded into uniform image data which is uniformly distributed on the plane in position. Through the smooth and uniform processing of the data, the data quantity of the drawn data image can be increased, the positions or the numerical values of the uniform image data can be uniformly distributed, the smoothness of the drawn data image is improved, and the image display effect is improved.
The above schematic description is only given by taking 4 pieces of data to be processed as an example, and the data amount of the uniform image data generated in the actual job application is often one or several orders of magnitude higher than that of the original data to be processed. However, the present application does not limit the number of generated uniform image data to be larger than the number of data to be processed, and may be equal to or slightly larger than the number of data to be processed in other embodiments. In the application scenario of the web-side thermodynamic diagram rendering, the number of the finally generated uniform image data is 4, which is equal to the number of the data to be processed. Even, in some embodiments, the present application does not exclude that the uniform image data is the same as the to-be-processed data, in which case, the to-be-processed data itself may be considered to be uniformly distributed, and the to-be-processed data itself may be used as the uniform image data to perform subsequent image rendering, where the number of the expanded data may be considered to be 0.
In an embodiment of the present application, the generated uniform image data may include the data to be processed, for example, 2 of the 121 data to be processed are the same as the data to be processed. In other embodiments, the uniform image data may not include the data to be processed, as shown in fig. 4.
In the embodiment of the application, the obtained data to be processed can be subjected to smooth expansion processing by adopting a preselected or set algorithm, and uniform image data with more uniform spatial distribution positions or numerical values than the data to be processed is generated.
S2: an image grid in a drawing area is determined from the uniform image data.
After the uniform image data is acquired, the positions of the uniform image data in the drawing area may be determined, and then the points of the uniform image data in the drawing area may be connected in a predetermined manner (e.g., sequentially connected in the direction of the coordinate axes) to form an image grid. Specifically, for example, as shown in fig. 5, fig. 5 is a schematic diagram of an image grid in a canvas for forming the uniform image data generated in fig. 4, each uniform image data generated in fig. 4 has corresponding coordinate information (x, y), and these uniform image data can be mapped onto coordinate axes of the canvas and connected to form the image grid. Specifically, in an embodiment provided by the present application, the forming the uniform image data into an image grid in a drawing area may include:
s201: and determining the coordinates of the uniform image data in the drawing area, and forming image grids according to the coordinates, wherein a single grid in the image grids is a quadrangle taking the coordinate position as a vertex.
The manner of forming the uniform image data into the image grid is not limited to being connected in the coordinate axis direction (transverse or longitudinal), and other embodiments may also include, for example, connecting the uniform image data in the angular direction at a certain angle (e.g., 45 degrees or 135 degrees) from the uniform image data closest to a boundary of a certain edge of the canvas. Typically, the individual grids of the connected image grids are quadrilateral (parallelogram or non-parallelogram). This application does not exclude that in other ways the individual grids of the image grid formed on the basis of said uniform image data may be of other shapes, such as hexagonal, triangular, or other irregular patterns.
S3: and dividing a single grid in the image grids into a preset number of splicing image blocks in a preset shape, wherein at least one vertex of each splicing image block is the uniform image data.
Further, each individual grid of the image grid may be segmented. According to the method, each single grid can be divided into the splicing image blocks with the preset format and the preset shapes, at least one order of each divided splicing image block is the generated uniform image data, and therefore it can be guaranteed that each single grid can be drawn to form more accurate colors based on the uniform image data. The shapes of the splicing blocks and each single grid are divided into a plurality of splicing blocks and the like, and the splicing blocks can be set in advance according to data processing requirements. In one embodiment, the predetermined number of the predetermined shapes of the mosaic blocks includes:
s301: segmenting individual ones of the image grids into at least two stitched tiles of a predetermined shape that is a triangle.
Of course, in S301, each single grid of the image grid may also be divided into a mosaic tile composed of a plurality of triangles, for example, a trapezoid or a rectangle single grid may be divided into two or three triangles.
In another embodiment provided by the present application, the dividing a single grid of the image grids into a preset number of mosaic tiles of a predetermined shape includes:
when the single grid is a quadrangle, a diagonal line of the quadrangle is used as a dividing line to divide the single grid into two triangular splicing image blocks.
FIG. 6 is a schematic diagram of a single grid split into triangles according to an embodiment of the present application.
S4: and determining color data of the spliced image blocks in the image grid according to the uniform image data of the vertexes of the spliced image blocks, and drawing to generate a target image.
Each individual grid may then be mapped to a corresponding color, including the color of the tiled tile vertices and the color of the infill. For example, when the tile is a triangle, each triangle may be rendered, with the values of the vertices of the triangle mapped to colors, and the values inside the triangle calculated using the difference values are also mapped to colors. The difference algorithm refers to the processing mode of the centroid coordinate system. And drawing all the triangles by completing a uniform thermodynamic diagram.
In an embodiment provided by the present application, the determining color data of the tile to be stitched according to the uniform image data of the vertices of the tile to be stitched includes:
mapping the uniform image data of the vertices of the tiled tiles to corresponding color data; and the number of the first and second groups,
and calculating color data of the colors of the filling areas of the spliced image blocks by adopting a preset calculation method based on the uniform image data of the vertexes of the spliced image blocks.
In another specific embodiment, the calculating the color data of the color of the filled area of the tile by using a preset calculation method includes:
sequentially selecting a first calculation pixel on a first boundary line and a second calculation pixel on a second boundary line of the mosaic image blocks from adjacent vertexes of the mosaic image blocks according to a preset direction;
calculating the difference value of the image data corresponding to the first pixel and the second pixel and the number of interval pixels between the first pixel and the second pixel;
determining image data of pixels between the first pixels and the second pixels according to the difference values and the number of the interval pixels;
and mapping the calculated image data into the color data of the filling area.
Fig. 7 to 9 are schematic diagrams illustrating the effect of a thermodynamic diagram formed by drawing according to an embodiment provided by the present application, fig. 7 is a schematic diagram illustrating a triangle stitching module in one implementation scenario of the present application, where red (255,0,0) is a color of a point a, Green (0,255,0) is a color of a point B, and Blue (0, 255) is a color of a point C; FIG. 8 is a schematic diagram of the mosaic module of FIG. 7 after mapping the corresponding colors; FIG. 9 is a diagram illustrating the effect of a thermodynamic diagram plotted in an implementation scenario; fig. 10 is a schematic view showing the effect of a thermodynamic diagram formed by using a conventional gradation circle drawing. As can be seen from comparison between fig. 8 and fig. 9, in the embodiment of the present application, the original data in the drawing area can be smoothed to obtain image data points with uniform position distribution, so that the data amount can be enriched, the number of uniform images can be obtained, and the smoothness of transition of the color area of the generated data image can be improved. According to the method and the device, the grids are generated according to the uniform image data, then each grid can be subdivided into the splicing image blocks with the preset shapes and the preset formats, for example, each quadrilateral grid can be divided into two triangles, so that each format can be completely covered, the problem that the blank of the data image caused by the non-uniform distribution of the image data is covered in the prior art is solved, and the color continuity of the data image is improved. In addition, in the embodiment of the application, the filling color inside the spliced image blocks in each format is obtained by calculation according to the uniform image data at the vertexes of the spliced image blocks, so that the filling color of the spliced image blocks is more accurate, the accuracy of data information expression of the whole data image is improved, and the quality and the display effect of the finally generated data image are improved.
Based on the image data processing method described in the above embodiment, the present application also provides an image data processing apparatus. Fig. 11 is a schematic block diagram of an embodiment of an image data processing apparatus provided in the present application, and as shown in fig. 11, the apparatus may include:
the uniform processing module 101 may be configured to perform smooth expansion processing on data to be processed by using a preset algorithm to generate uniform image data;
a grid determination module 102 operable to determine an image grid in a drawing area from the uniform image data;
a segmentation module 103, configured to segment a single grid of the image grids into a preset number of predetermined-shaped mosaic tiles, where at least one vertex of each mosaic tile is the uniform image data;
the drawing module 104 may be configured to determine color data of the tiles to be stitched in the image grid according to the uniform image data of the vertices of the tiles to be stitched, and draw and generate the target image.
According to the image data processing method and device, the original data in the drawing area can be subjected to smoothing processing, image data points distributed at uniform positions are obtained, the data volume can be enriched, the number of uniform images can be obtained, and the smoothness of transition of the color area of the generated data image is improved. According to the method and the device, the grids are generated according to the uniform image data, then each grid can be subdivided into the splicing image blocks with the preset shapes and the preset formats, for example, each quadrilateral grid can be divided into two triangles, so that each format can be completely covered, the problem that the blank of the data image caused by the non-uniform distribution of the image data is covered in the prior art is solved, and the color continuity of the data image is improved. In addition, in the embodiment of the application, the filling color inside the spliced image blocks in each format is obtained by calculation according to the uniform image data at the vertexes of the spliced image blocks, so that the filling color of the spliced image blocks is more accurate, the accuracy of data information expression of the whole data image is improved, and the quality and the display effect of the finally generated data image are improved.
The manner of forming the uniform image data into the image grid is not limited to the connection according to the coordinate axis direction (transverse or longitudinal), and other embodiments may also include, for example, connecting the uniform image data in the angular direction by a certain angle (e.g., 45 degrees or 135 degrees) from the uniform image data closest to a boundary of a certain edge of the canvas to form a single grid ((parallelogram or non-parallelogram, such as trapezoid)), so that, in another embodiment provided by the present application, the grid determining module determines the image grid in the drawing area according to the uniform image data, and may include:
and determining the coordinates of the uniform image data in the drawing area, and forming image grids according to the coordinates, wherein a single grid in the image grids is a quadrangle taking the coordinate position as a vertex.
According to the method, each single grid can be divided into the splicing image blocks with the preset format and the preset shapes, at least one order of each divided splicing image block is the generated uniform image data, and therefore it can be guaranteed that each single grid can be drawn to form more accurate colors based on the uniform image data. The shapes of the splicing blocks and each single grid are divided into a plurality of splicing blocks and the like, and the splicing blocks can be set in advance according to data processing requirements. In one mode of the apparatus provided in the present application, the predetermined number of the predetermined shapes of the mosaic tiles may include:
segmenting individual ones of the image grids into at least two stitched tiles of a predetermined shape that is a triangle.
Of course, it is also possible to divide each individual grid of the image grid into tiles of a plurality of triangles, for example, a trapezoidal or rectangular individual grid into two or three triangles. In a specific implementation manner of the present application, the segmenting module segments a single grid of the image grids into a preset number of predetermined shaped mosaic tiles may include:
when the single grid is a quadrangle, a diagonal line of the quadrangle is used as a dividing line to divide the single grid into two triangular splicing image blocks.
The device provided by the application can map each single grid into corresponding colors, including the color of the vertex of the spliced image block and the color of the internal filling. For example, when the tile is a triangle, each triangle may be rendered, with the values of the vertices of the triangle mapped to colors, and the values inside the triangle calculated using the difference values are also mapped to colors. The difference algorithm refers to the processing mode of the centroid coordinate system. And drawing all the triangles by completing a uniform thermodynamic diagram.
The determining color data of the tiled image blocks according to the uniform image data of the tiled image block vertices includes:
mapping the uniform image data of the vertices of the tiled tiles to corresponding color data; and the number of the first and second groups,
and calculating color data of the colors of the filling areas of the spliced image blocks by adopting a preset calculation method based on the uniform image data of the vertexes of the spliced image blocks.
The method or the device provided by the embodiment of the application can generate the grids according to the uniform image data, then each grid can be subdivided into the splicing image blocks with the preset shapes and the preset formats, for example, each quadrilateral grid can be divided into two triangles, so that each format can be completely covered, the problem that the blank of the data image is covered due to the non-uniform distribution of the image data in the prior art is solved, and the color continuity of the data image is improved. In addition, in the embodiment of the application, the filling color inside the spliced image blocks in each format is obtained by calculation according to the uniform image data at the vertexes of the spliced image blocks, so that the filling color of the spliced image blocks is more accurate, the accuracy of data information expression of the whole data image is improved, and the quality and the display effect of the finally generated data image are improved.
Although the description of the manner of generating uniform image data using a smoothing algorithm, the manner of calculating the color of each tile, the manner of acquiring, generating, calculating, mapping, etc., image data such as adjusting the area of tiles to be stitched according to distance, etc., is mentioned in the present disclosure, the present disclosure is not limited to the case where image data processing, standard smoothing algorithm, conventional difference calculation method, standard computer language, or the embodiments described in the present disclosure, which are necessarily compliant with the business standards, are necessary. Certain industry standards, or implementations modified slightly from those described using custom modes or examples, may also achieve the same, equivalent, or similar, or other, contemplated implementations of the above-described examples. Embodiments utilizing such modified or deformed image data acquisition, generation, determination, processing, etc. may still fall within the scope of alternative embodiments of the present application.
Although the present application provides method steps as described in an embodiment or flowchart, more or fewer steps may be included based on conventional or non-inventive means. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. When an actual apparatus or end product executes, it may execute sequentially or in parallel (e.g., parallel processors or multi-threaded environments, or even distributed data processing environments) according to the method shown in the embodiment or the figures. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, the presence of additional identical or equivalent elements in a process, method, article, or apparatus that comprises the recited elements is not excluded.
The units, devices, modules, etc. set forth in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, in implementing the present application, the functions of each module may be implemented in one or more software and/or hardware, or a module implementing the same function may be implemented by a combination of a plurality of sub-modules or sub-units, and the like. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may therefore be considered as a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, or the like, and includes several instructions for enabling a computer device (which may be a personal computer, a mobile terminal, a server, or a network device) to execute the method according to the embodiments or some parts of the embodiments of the present application.
The embodiments in the present specification are described in a progressive manner, and the same or similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable systems, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
While the present application has been described with examples, those of ordinary skill in the art will appreciate that there are numerous variations and permutations of the present application without departing from the spirit of the application, and it is intended that the appended claims encompass such variations and permutations without departing from the spirit of the application.