EP-3489904-B1 - METHOD AND DEVICE FOR GENERATING THERMODYNAMIC DIAGRAM
Inventors
- GAO, LISHENG
- NI, Bing
Dates
- Publication Date
- 20260506
- Application Date
- 20170323
Claims (8)
- A method for generating a heatmap, which is applied to an electronic map, wherein the method is applied to a terminal in an Internet architecture, which includes a network server (101) and at least one terminal (102), wherein the network server collects statistics on user data of each terminal, and provides the statistics to each terminal for data analysis, and the terminal interacts with the network server by using the Internet, obtains the statistics from the network server so as to perform the data analysis, which includes generating the heatmap; the method comprises: dividing (S301) a current display region of an original image on a screen into square cells having a side length of r, wherein r = α * r 1 , r 1 is a side length of a cell that is obtained through division when a heatmap of the original image is generated last time, and α is a cell change parameter related to a zoom ratio; wherein the original image is the electronic map, wherein the current display region of the original image on the screen is a region that can be seen by a user at a current zoom ratio on the terminal screen and that is in the original image; separately calculating (S302), according to statistics of the original image and a heat weight w = β * w 1 for generating a heatmap this time, basic heat H of a heat point region that is in each cell and in which a center point of the cell is used as a circle center and x is used as a radius, wherein basic heat of each pixel (A) in one heat point region is H, the statistics of the original image comprises at least one data point used to reflect a region feature of the original image, w 1 is a heat weight used when the heatmap of the original image is generated last time, β is a heat weight change function related to the zoom ratio, and x is less than or equal to r 2 ; separately calculating (S303), according to the basic heat H of the heat point region in each cell, diffusion heat to which each pixel in the current display region is subject, wherein diffusion heat to which one pixel (B) located in a diffusion heat region of at least one cell is subject is generated by a heat point region in each of the at least one cell, a diffusion heat region of one cell is a region in a circle, in which a center of the cell is used as a circle center and R is used as a radius, except a heat point region in the cell, and R is greater than r; separately obtaining (S304) total heat of each pixel in the current display region by adding diffusion heat, to which the pixel is subject, to basic heat of the pixel; or by performing weighting summation on diffusion heat, to which the pixel is subject, to basic heat of the pixel; and presenting (S305), in the current display region of the original image according to a preset heat presentation correspondence, a color corresponding to the total heat of each pixel in the current display region, to obtain a heatmap of the current display region, wherein the preset heat presentation correspondence includes at least one heat value interval and a presented color in a one-to-one correspondence with each heat value interval; wherein α = a Δ Z , wherein a is a preset cell change parameter, a is greater than or equal to 1, and is less than or equal to 2, and Δ Z is obtained by subtracting, from a zoom ratio for the original image when the heatmap is generated this time, a zoom ratio for the original image when the heatmap is generated last time; and β = b Δ Z , wherein b is a preset heat weight change parameter, and b is greater than or equal to 1, and is less than or equal to 4; wherein the separately calculating (S303), according to the basic heat of the heat point region in each cell, diffusion heat to which each pixel in the current display region is subject comprises: calculating, according to basic heat of a heat point region in a second cell, a diffusion heat component h = H * d − r r , to which the first pixel is subject, from the second cell, wherein the second cell is any one of the cell to which the at least one diffusion heat region in which the first pixel is located belongs, d is a distance from a location of the first pixel to a center of the second cell, and H is the basic heat of the heat point region in the second cell; and using a weighted sum of at least one diffusion heat component to which the first pixel is subject as diffusion heat to which the first pixel is subject, wherein the at least one diffusion heat component to which the first pixel is subject is generated by each cell to which at least one diffusion heat region in which the first pixel is located belongs; and wherein: if the generated heatmap of the current display region is a heatmap that is generated for the original image for the first time, r 1 is an initial value r 0 of the side length of the cell, and w 1 is a preset initial value w 0 of the heat weight; wherein the separately calculating, according to statistics of the original image and a heat weight w = β * w 1 for generating a heatmap this time, basic heat of a heat point region that is in each cell and in which a center point of the cell is used as a circle center and x is used as a radius comprises: calculating, according to the statistics of the original image and the heat weight w for generating a heatmap this time, basic heat H = N*w of a heat point region that is in a first cell and in which a center point of the first cell is used as a circle center and x is used as a radius, wherein the first cell is any one of the cells obtained by dividing the current display region, and N is a total quantity of data points or statistic objects that are in the statistics of the original image and whose coordinates are in a region, which corresponds to the first cell, in the original image.
- The method according to claim 1, wherein α is used to control an absolute value of a difference of actual lengths corresponding to r and r 1 in the original image to be less than or equal to a first preset threshold; and β is used to control an absolute value of a difference of total heat values obtained when heatmaps of a same region in the original image are generated to be less than or equal to a second preset threshold.
- The method according to claims 1 or 2, wherein R is less than or equal to 2r.
- The method according to any one of claims 1 to 3, wherein the separately obtaining total heat of each pixel in the current display region according to the basic heat of the pixel in the current display region and the diffusion heat to which the pixel in the current display region is subject comprises: adding or performing weighting summation on diffusion heat, to which the second pixel is subject, to basic heat of the second pixel, to obtain total heat of the second pixel, wherein the second pixel is any pixel located in a heat point region in a cell; or diffusion heat to which the third pixel is subject being total heat of the third pixel, wherein the third pixel is any pixel that is located in a diffusion heat region of a cell and that is not located in a heat point region in any cell.
- An apparatus for generating a heatmap, which is applied to an electronic map, wherein the apparatus is a terminal in an Internet architecture, which includes a network server (101) and at least one terminal (102), wherein the network server collects statistics on user data of each terminal, and provides the statistics to each terminal for data analysis, and the terminal interacts with the network server by using the Internet, obtains the statistics from the network server so as to perform data analysis, which includes generating the heatmap; the apparatus comprises: a division unit (901), configured to divide a current display region of an original image on a screen into square cells having a side length of r, wherein r = α*r 1 , r 1 is a side length of a cell that is obtained through division when a heatmap of the original image is generated last time, and α is a cell change parameter related to a zoom ratio; wherein the original image is the electronic map, wherein the current display region of the original image on the screen is a region that can be seen by a user at a current zoom ratio on the terminal screen and that is in the original image; a calculation unit (902), configured to separately calculate, according to statistics of the original image and a heat weight w = β*w 1 for generating a heatmap this time, basic heat H of a heat point region that is in each cell and in which a center point of the cell is used as a circle center and x is used as a radius, wherein basic heat of each pixel (A) in one heat point region is H, the statistics of the original image comprises at least one data point used to reflect a region feature of the original image, w 1 is a heat weight used when the heatmap of the original image is generated last time, β is a heat weight change function related to the zoom ratio, and x is less than or equal to r 2 , wherein the calculation unit is further configured to separately calculate, according to the basic heat H of the heat point region in each cell, diffusion heat to which each pixel in the current display region is subject, wherein diffusion heat to which one pixel (B) located in a diffusion heat region of at least one cell is subject is generated by a heat point region in each of the at least one cell, a diffusion heat region of one cell is a region in a circle, in which a center of the cell is used as a circle center and R is used as a radius, except a heat point region in the cell, and R is greater than r; an obtaining unit (903), configured to separately obtain total heat of each pixel in the current display region by adding diffusion heat, to which the pixel is subject, to basic heat of the pixel; or by performing weighting summation on diffusion heat, to which the pixel is subject, to basic heat of the pixel; and a presentation unit (904), configured to present, in the current display region of the original image according to a preset heat presentation correspondence, a color corresponding to the total heat, which is obtained by the obtaining unit, of each pixel in the current display region, to obtain a heatmap of the current display region, wherein the preset heat presentation correspondence includes at least one heat value interval and a presented color in a one-to-one correspondence with each heat value interval; wherein α = a Δ Z , wherein a is a preset cell change parameter, a is greater than or equal to 1, and is less than or equal to 2, and Δ Z is obtained by subtracting, from a zoom ratio for the original image when the heatmap is generated this time, a zoom ratio for the original image when the heatmap is generated last time; and β = b Δ Z , wherein b is a preset heat weight change parameter, and b is greater than or equal to 1, and is less than or equal to 4; wherein the calculation unit is specifically configured to: calculate, according to basic heat of a heat point region in a second cell, a diffusion heat component h = H * d − r r , to which the first pixel is subject, from the second cell, wherein the second cell is any one of the cell to which the at least one diffusion heat region in which the first pixel is located belongs, d is a distance from a location of the first pixel to a center of the second cell, and H is the basic heat of the heat point region in the second cell; and use a weighted sum of at least one diffusion heat component to which the first pixel is subject as diffusion heat to which the first pixel is subject, wherein the at least one diffusion heat component to which the first pixel is subject is generated by each cell to which at least one diffusion heat region in which the first pixel is located belongs; and wherein if the generated heatmap of the current display region is a heatmap that is generated for the original image for the first time, r 1 is an initial value r 0 of the side length of the cell, and w 1 is an initial value w 0 of the heat weight; wherein the calculation unit is specifically configured to: calculate basic heat H = N * w of a heat point region in a first cell, wherein the first cell is any one of the cells obtained by dividing the current display region, and N is a total quantity of data points or statistic objects that are in the statistics of the original image and whose coordinates are in a region, which corresponds to the first cell, in the original image.
- The apparatus according to claim 5, wherein α is used to control an absolute value of a difference of actual lengths corresponding to r and r 1 in the original image to be less than or equal to a first preset threshold; and β is used to control an absolute value of a difference of total heat values obtained when heatmaps of a same region in the original image are generated to be less than or equal to a second preset threshold.
- The apparatus according to claims 5 or 6, wherein R is less than or equal to 2r.
- The apparatus according to any one of claims 5 to 7, wherein the obtaining unit is specifically configured to: add or perform weighting summation on diffusion heat, to which the second pixel is subject, to basic heat of the second pixel, to obtain total heat of the second pixel, wherein the second pixel is any pixel located in a heat point region in a cell; or diffusion heat to which the third pixel is subject being total heat of the third pixel, wherein the third pixel is any pixel that is located in a diffusion heat region of a cell and that is not located in a heat point region in any cell.
Description
This application claims priority to Chinese Patent Application No. 201610697944.8, filed with the Chinese Patent Office on August 19, 2016, and entitled "METHOD AND APPARATUS FOR GENERATING HEATMAP". TECHNICAL FIELD This application relates to the field of image processing, and in particular, to a method and an apparatus for generating a heatmap. BACKGROUND With quick development of Internet technologies and electronic technologies, the Internet and intelligent terminals have already become indispensable content in daily life of people. For example, a web page is visited by using the Internet to browse required information, a location and a navigation route are queried by using an electronic map, and the like. Usage information (locating information in a map and a click position in a web page) of a user may be aggregated into density data. The density data describes density of a region at a time point or within a time period, and describes a correspondence between a region location and a quantity of persons or a quantity of clicks. The density data may be used to provide much convenience to the user. For example, a congestion situation of a road and a congestion situation of a location may be predicted by using density data in an electronic map. Density data within different time periods that is aggregated and collated may further demonstrate information and a rule, such as distribution of population residence places and distribution of workplaces. In heatmap technologies, values are identified by using continuous or discrete color levels. In this way, distribution and a change rule of a variable in two-dimensional space may be demonstrated vividly and naturally. Therefore, a heatmap is applied to various scenarios to present density data and reflect a region feature. For example, when density data of different regions is presented by using color levels in a heatmap in an electronic map, a "hot region" in which data is dense and a "cold region" in which data is sparse can be clearly presented on the map, so as to demonstrate important statistics such as population distribution. A correspondence between a region in a web page and a quantity of clicks of a user is embodied by using a heatmap, so that website management personnel determine a region that is often clicked by a user but that is not a link, and consider setting a resource link in the region. Currently, in an image with a proper proportional scale, a heatmap is usually drawn according to density data by using a point depiction method. A frequently used drawing method is drawing one heat point for one data point, or drawing one heat point for a sum of data in one region. On the heatmap based on this, once the proportional scale of the image changes, the heatmap cannot reflect a region feature continuously and accurately. US2014/333651A1 generally discloses an interactive data object map system in which large amounts of geographical, geospatial, and other types of data, geodata, objects, features, and/or metadata are presented to a user on a map interface. "Heattile, a New Method for Heatmap Implementations for Mobile Web-Based Cartographic Applications" by Meier Sebastian et Al, DOI: 10.1007/978-3-319-08180-9_4, discloses a client-server heatmap generation method based on a client fetching from a server JSon data to be displayed on pre-clustered tiles prepared at different zoom levels. Using an example in which a heatmap is applied to an electronic map, a characteristic of the electronic map is that geographical location information is completed and continuous. However, for a heatmap generated by using existing heatmap technologies, when a user zooms in the map, the heatmap is presented as a scatter chart, and the entire scatter chart cannot reflect a distribution rule of density data in different regions. When the map is zoomed out to a specific level, the heatmap is presented as a big heat point, and coverage of the point even exceeds coverage of actual data. This is of no practical significance. It can be accordingly known that for the heatmap generated by using the existing heatmap technologies, when a zoom ratio of an image is adjusted, the heatmap cannot accurately embody an actual distribution feature and a region feature of the image. In addition, continuity of the heatmap is poor. SUMMARY The present invention is as defined in the appended independent claims. Further implementations are disclosed in the appended dependent claims, the description and the figures. Embodiments of the present invention provide a method and an apparatus for generating a heatmap, so as to implement that a heatmap reflects a region feature continuously and accurately, and a change in an image zoom ratio does not affect continuity and accuracy of the heatmap. To achieve the foregoing objective, the following technical solutions are used in this application. According to a first aspect, a method for generating a heatmap is provided, where the method includes: first