Skip to content

compute_activity

Alexandre Marcireau edited this page May 31, 2018 · 11 revisions

In header "../third_party/tarsier/source/compute_activity.hpp"

tarsier::compute_activity evaluates the activity at each pixel, using an exponential decay.

template <typename Event, typename Activity, typename EventToActivity, typename HandleActivity>
    class compute_activity {
        public:
        compute_activity(
            uint16_t width,
            uint16_t height,
            uint64_t decay,
            EventToActivity event_to_activity,
            HandleActivity handle_activity);

        /// operator() handles an event.
        virtual void operator()(Event event);
    };
}
  • Event is the input type. It must have at least the properties t, x and y.
  • Activity is the output type.
  • The expression event_to_activity(event, x, y), where event is an Event object and x and y are floats, must be valid and return an Activity object.
  • The expression handle_activity(activity), where activity is a Activity object, must be valid.
  • width and height are the maximum x and y coordinates plus one (if x is in the integer range [0, 319], width must be 320).
  • decay is the activity's exponential decay.

Event and Activity must be specified when using make_compute_activity:

struct event {
    uint16_t x;
    uint16_t y;
};

struct activity {
    uint16_t x;
    uint16_t y;
    float value;
};

auto compute_activity = tarsier::make_compute_activity<event, activity>(
    320,
    240,
    1e6,
    [](event event, float value) -> activity {
        return {event.x, event.y, value};
    },
    [](activity activity) {
        // do something with activity
    });
Clone this wiki locally