-
Notifications
You must be signed in to change notification settings - Fork 6
compute_flow
Alexandre Marcireau edited this page May 24, 2019
·
13 revisions
In header "../third_party/tarsier/source/compute_flow.hpp"
Adapted from Asynchronous frameless event-based optical flow, Bensoman et al.
tarsier::compute_flow
evaluates the optical flow.
namespace tarsier {
template <typename Event, typename Flow, typename EventToFlow, typename HandleFlow>
class compute_flow {
public:
compute_flow(
uint16_t width,
uint16_t height,
uint16_t spatial_window,
uint64_t temporal_window,
std::size_t minimum_number_of_events,
EventToFlow event_to_flow,
HandleFlow handle_flow);
/// operator() handles an event.
virtual void operator()(Event event);
};
}
-
Event
is the input type. It must have at least the propertiest
,x
andy
. -
Flow
is the output type. - The expression
event_to_flow(event, vx, vy)
, whereevent
is anEvent
object andvx
andvy
are floats, must be valid and return aFlow
object. - The expression
handle_flow(flow)
, whereflow
is aFlow
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
). -
spatial_window
is the radius used to select event that participate in a flow computation (ifspatial_window
is2
, a5 x 5
pixel area is used). -
temporal_window
is the oldest an event can be to participate in a flow computation.
Event
and Flow
must be specified when using make_compute_flow
:
struct event {
uint64_t t;
uint16_t x;
uint16_t y;
};
struct flow {
uint16_t x;
uint16_t y;
float vx;
float vy;
};
auto compute_flow = tarsier::make_compute_flow<event, flow>(
320,
240,
2,
1e6,
[](event event, float vx, float vy) -> flow {
return {event.x, event.y, vx, vy};
},
[](flow flow) {
// do something with flow
});