【问题标题】:How to create intensity mask for heatmap?如何为热图创建强度遮罩?
【发布时间】:2013-02-19 08:59:11
【问题描述】:

我正在尝试开发热图,现在最初我必须绘制强度遮罩,并且由于我使用的是 GWT,所以我随机生成了一些坐标并将我的圆圈(具有所需的梯度)放置在这些位置,所以输出结果是相互重叠的圆圈。如果我查看Dylan Vester 的强度遮罩,它会变得非常平滑如何绘制我的热图?另外如何实现类似于 Dylan Vester 的输出?问题也是如果我正在画圆圈,那么如何确定两个或更多圆圈相交处的强度,它们是如何实现的?这是我的代码

// creating the object for the heat points
        Heat_Point x = new Heat_Point();

    // Variables for random locations
        int Min = 1,Max = 300;
        int randomx,randomy;

    // Generating set of random values
        for( int i = 0 ; i < 100 ; i++ ) {

            // Generating random x and y coordinates
                randomx = Min + (int)(Math.random() * ((Max - Min) + 1));
                randomy = Min + (int)(Math.random() * ((Max - Min) + 1));

            // Drawing the heat points at generated locations 
                x.Draw_Heatpoint(c1, randomx, randomy);


        }

这就是我如何绘制我的热点,即 Heat_Point 类

Context con1 = c1.getContext2d(); // c1 is my canvas
CanvasGradient x1;
x1 = ((Context2d) con1).createRadialGradient(x,y,10,x,y,20);
x1.addColorStop(0,"black");
x1.addColorStop(1,"white");
((Context2d) con1).beginPath();
((Context2d) con1).setFillStyle(x1);
((Context2d) con1).arc(x,y,20, 0, Math.PI * 2.0, true);
((Context2d) con1).fill();
((Context2d) con1).closePath();`

我应该在这里添加一些图片,但我没有足够的声誉 :D :P

【问题讨论】:

    标签: html gwt colors html5-canvas heatmap


    【解决方案1】:

    我快速浏览了 HeatmapJS (http://www.patrick-wied.at/static/heatmapjs/),他似乎使用了径向渐变(就像你上面所说的那样),他还使用了不透明度和一个名为“multiply blend”的颜色过滤器来平滑颜色的强度在热图中。

    他的代码令人印象深刻。它是开源的,所以你可能想看看!

    【讨论】:

      猜你喜欢
      • 2019-12-01
      • 1970-01-01
      • 2014-05-23
      • 1970-01-01
      • 2013-08-31
      • 1970-01-01
      • 1970-01-01
      • 2011-03-01
      • 2022-11-30
      相关资源
      最近更新 更多