0

I have a database that holds data of eyetracking on some videos.

I export those data to an int[,] input matrix for this issue. And then try to create a heatmap. What I get so far is something like this:

enter image description here

But this is not actually what I want it to be. I want something like the heatmaps that you see when you google it, e.g.:

enter image description here

prisar
  • 3,041
  • 2
  • 26
  • 27
S.Gh
  • 61
  • 6
  • 1
    What you need is some way to make the spots __add up__. Either by __calculating__ a heat map of colors or by finding a way to __add up when drawing__. The former is obvious and also what I would recommend. The latter is explained [here](https://stackoverflow.com/questions/30415191/heatmap-style-gradients-in-net/30416635#30416635) - The former gets a bit tricky if the data are finely grained and you want to keep it that way, though – TaW Aug 26 '18 at 08:46

2 Answers2

0

Treat each spot as an artificial circle with the center at that spot. A circle that has, say, 50 pixel radius. Now, go over all pixels of the image and for each one count all circles that cover that pixels. This is your score for that pixel. Translate it into color, i.e 0: black/transparent, 10: light green, 20: yelow, and so on. After analyzing all pixels you will get a color for each pixel. Write a bitmap, look at it. It should be something close to what you want.

Of course, circle radius, color mappings, etc, need adjusting to your needs. Also, that's probably not the best/simplest/fastest algorithm.

quetzalcoatl
  • 32,194
  • 8
  • 68
  • 107
0

Different approach would be to store the "heat" in the pixels greyvalue. Just create a second image with the same size as the original one and count up the greyvalue of a pixel everytime it was looked at. Later you can use that value to calculate a size and color for the circle you want to draw.

You can then lay the heatmap image on top of the original one and you are done (dont forget to set transparency).

christian
  • 110
  • 1
  • 2
  • 15