GradientBased

class eyefeatures.preprocessing.aoi_extraction.GradientBased(x=None, y=None, window_size=None, threshold=None, pk=None, aoi_name=None)[source]

Bases: BaseAOIPreprocessor

Defines the AOI for each fixation using a gradient-based algorithm. Finds the local maximum, pre-threshold it, and uses it as a center of aoi. After that, uses the Sobel operator to compute the gradient magnitude for each point. Next, defines the queue of areas of interest. Algorithm of aoi defining:

  • Gets the point from the queue. It is a center

  • Looks at the points near the center

  • Tries to find the point with defined aoi and maximum gradient magnitude

  • Adds center to this aoi

  • Repeats for all points in the matrix

Parameters:
  • x (str) – X coordinate of fixation.

  • y (str) – Y coordinate of fixation.

  • window_size (int) – size of search window.

  • threshold (float) – threshold density.

  • pk (list[str]) – list of column names used to split pd.DataFrame.

  • aoi_name (str) – name of AOI column.

Algorithm

  1. Split the graph into a grid and compute density for each sector via gaussian kernel density estimation.

  2. Pre-threshold it.

  3. Find the local maxima. Every maximum is a center of area of interest.

  4. Compute the gradient and magnitude.

  5. Add all 8 points around of each maximum to the queue.

  6. Get a point from the queue. Search among 8 points around the point with the greatest magnitude, which has AOI. Assign this label to the target point.

  7. Add all 8 points with around the target point to the queue.

  8. Repeat 5-8 until all points will get the AOI label.