-
Notifications
You must be signed in to change notification settings - Fork 6
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 propertiest
,x
andy
. -
Activity
is the output type. - The expression
event_to_activity(event, x, y)
, whereevent
is anEvent
object andx
andy
are floats, must be valid and return anActivity
object. - The expression
handle_activity(activity)
, whereactivity
is aActivity
object, must be valid. -
width
andheight
are the maximum x and y coordinates plus one (ifx
is in the integer range[0, 319]
,width
must be320
). -
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
});