1 // Evaluate a .flo file against ground truth,
2 // outputting the average end-point error.
12 double eval_flow(const char *filename1, const char *filename2);
14 int main(int argc, char **argv)
18 for (int i = 1; i < argc; i += 2) {
19 sum_epe += eval_flow(argv[i], argv[i + 1]);
22 printf("Average EPE: %.2f pixels\n", sum_epe / num_flows);
25 double eval_flow(const char *filename1, const char *filename2)
27 Flow flow = read_flow(filename1);
28 Flow gt = read_flow(filename2);
31 for (unsigned y = 0; y < unsigned(flow.height); ++y) {
32 for (unsigned x = 0; x < unsigned(flow.width); ++x) {
33 float du = flow.flow[y * flow.width + x].du;
34 float dv = flow.flow[y * flow.width + x].dv;
35 float gt_du = gt.flow[y * flow.width + x].du;
36 float gt_dv = gt.flow[y * flow.width + x].dv;
37 sum += hypot(du - gt_du, dv - gt_dv);
40 return sum / (flow.width * flow.height);