diff python/compute-homography.py @ 235:584613399513

added script and functions to remove object tables
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 05 Jul 2012 23:32:14 -0400
parents ba71924cadf5
children eb4525853030
line wrap: on
line diff
--- a/python/compute-homography.py	Thu Jul 05 23:01:36 2012 -0400
+++ b/python/compute-homography.py	Thu Jul 05 23:32:14 2012 -0400
@@ -52,16 +52,14 @@
 # cvFindHomography(imagePoints, worldPoints, H);
 
 
-if '--help' in options.keys() or '-h' in options.keys():
-    print('''The argument should be the name of a file containing at least 4 non-colinear point coordinates:
+if '--help' in options.keys() or '-h' in options.keys() or len(args) == 0::
+    print('Usage: {0} --help|-h [--video_frame <video frame filename>] [<point_correspondences.txt>]'.format(sys.argv[0]))
+    print('''The positional argument should be the name
+ of a file containing at least 4 non-colinear point coordinates (point correspondences:
  - the first two lines are the x and y coordinates in the projected space (usually world space)
  - the last two lines are the x and y coordinates in the origin space (usually image space)''')
     sys.exit()
 
-if len(args) == 0:
-    print('Usage: {0} --help|-h [--video_frame <video frame filename>] [<point_correspondences.txt>]'.format(sys.argv[0]))
-    sys.exit()
-
 dstPts, srcPts = cvutils.loadPointCorrespondences(args[0])
 homography, mask = cv2.findHomography(srcPts, dstPts) # method=0, ransacReprojThreshold=3
 np.savetxt(utils.removeExtension(sys.argv[1])+'-homography.txt',homography)