Hi Tizzy,
I am attaching a modified version of an earlier histogram example that should solve this. For reference, the original example looked like this:

The problem with this workflow is that every single frame contributes to bin counts. In order to count just "visits" to a bin, you need to change it so that you only count frames when the animal switches bins. You can do this by further filtering the centroid before sending it to histogram.
The modified workflow would look like this (also attached):
Basically only three nodes were added:
- ValidPoint: this is a Condition where we take only points that are valid (i.e. non-NaN). This is just to make the next python transform easier.
- CentroidToBinPosition: this is a custom PythonTransform that basically converts the centroid to bin coordinates by dividing the X and Y components by each bin size:
import clr
clr.AddReference("OpenCV.Net")
from OpenCV.Net import *
nbins = 20
binSizeX = 640 / nbins
binSizeY = 480 / nbins
@returns(Point2f)
def process(value):
binX = int(value.X / binSizeX)
binY = int(value.Y / binSizeY)
return Point2f(binX, binY)
- DistinctUntilChanged: this is the important bit. The DistinctUntilChanged node only emits a value when the input changes. This means that if the animal stays in bin (5,5) for 20 frames, the node will only fire when the bin changes to the next one, e.g. (6, 5).
After this transformation you can just visualize the histogram like normal using Histogram2D. Make sure the bin sizes lineup between this node and the python script. There are ways to make it more convenient and robust in case this is what you want.
Hope this helps.