// obtain the direct homography from the current configuration static void obtain_current_homography(double H[3][3], struct viewer_state *e) { double C[4][2]; for (int p = 0; p < 4; p++) map_view_to_window(e, C[p], e->c[p]); homography_from_eight_points(H, C[0], C[1], C[2], C[3], e->p[0], e->p[1], e->p[2], e->p[3] ); }
// compute the homography given by the images of four points static void compute_homography_from_point_pairs(double H[3][3], float from[4][2], float to[4][2]) { double f[4][2], t[4][2]; for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) { f[i][j] = from[i][j]; t[i][j] = to[i][j]; } homography_from_eight_points(H, f[0], f[1], f[2], f[3], t[0], t[1], t[2], t[3]); }