Exemplo n.º 1
0
int main(int argc, const char *argv[])
{
	// This lets us load various image formats.
	fl_register_images();
	try
	{
		// Branch to processing code based on first argument
		if (argc > 1 && strcmp(argv[1], "sphrWarp") == 0)
			return SphrWarp(argc, argv);
		else if (argc > 1 && strcmp(argv[1], "alignPair") == 0)
			return AlignPair(argc, argv);
		else if (argc > 1 && strcmp(argv[1], "alignPairHomography") == 0)
			return AlignPair(argc, argv);
		else if (argc > 1 && strcmp(argv[1], "blendPairs") == 0)
			return BlendPairs(argc, argv);
		else if (argc > 1 && strcmp(argv[1], "script") == 0)
			return Script(argc, argv);
		else {
			printf("usage: \n");
	        printf("	%s sphrWarp input.tga output.tga f [k1 k2]\n", argv[0]);
			printf("	%s alignPair input1.f input2.f matchfile nRANSAC RANSACthresh [sift]\n", argv[0]);
			printf("	%s alignPairHomography input1.f input2.f matchfile nRANSAC RANSACthresh [sift]\n", argv[0]);
			printf("	%s blendPairs pairlist.txt outimg.tga blendWidth\n", argv[0]);
			printf("	%s script script.cmd\n", argv[0]);
		}
    }
    catch (CError &err) {
        printf(err.message);
        return -1;
    }
    return 0;
}
Exemplo n.º 2
0
/* ************************************************************************* */
Rot3 Rot3::AlignTwoPairs(const Unit3& a_p, const Unit3& b_p,  //
                         const Unit3& a_q, const Unit3& b_q) {
  // there are three frames in play:
  // a: the first frame in which p and q are measured
  // b: the second frame in which p and q are measured
  // i: intermediate, after aligning first pair

  // First, find rotation around that aligns a_p and b_p
  Rot3 i_R_b = AlignPair(a_p.cross(b_p), a_p, b_p);

  // Rotate points in frame b to the intermediate frame,
  // in which we expect the point p to be aligned now
  Unit3 i_q = i_R_b * b_q;
  assert(assert_equal(a_p, i_R_b * b_p, 1e-6));

  // Now align second pair: we need to align i_q to a_q
  Rot3 a_R_i = AlignPair(a_p, a_q, i_q);
  assert(assert_equal(a_p, a_R_i * a_p, 1e-6));
  assert(assert_equal(a_q, a_R_i * i_q, 1e-6));

  // The desired rotation is the product of both
  Rot3 a_R_b = a_R_i * i_R_b;
  return a_R_b;
}