work on obj_detect.py
added square_size cmd line param for calibrate.py added _coverage.py script to compute cv2 api coverage by samples (just for interest, may be removed later)
This commit is contained in:
@@ -4,7 +4,7 @@ import os
|
||||
from common import splitfn
|
||||
|
||||
USAGE = '''
|
||||
USAGE: calib.py [--save <filename>] [--debug <output path>] [<image mask>]
|
||||
USAGE: calib.py [--save <filename>] [--debug <output path>] [--square_size] [<image mask>]
|
||||
'''
|
||||
|
||||
|
||||
@@ -13,16 +13,18 @@ if __name__ == '__main__':
|
||||
import sys, getopt
|
||||
from glob import glob
|
||||
|
||||
args, img_mask = getopt.getopt(sys.argv[1:], '', ['save=', 'debug='])
|
||||
args, img_mask = getopt.getopt(sys.argv[1:], '', ['save=', 'debug=', 'square_size='])
|
||||
args = dict(args)
|
||||
try: img_mask = img_mask[0]
|
||||
except: img_mask = '../cpp/left*.jpg'
|
||||
img_names = glob(img_mask)
|
||||
debug_dir = args.get('--debug')
|
||||
square_size = float(args.get('--square_size', 1.0))
|
||||
|
||||
pattern_size = (9, 6)
|
||||
pattern_points = np.zeros( (np.prod(pattern_size), 3), np.float32 )
|
||||
pattern_points[:,:2] = np.indices(pattern_size).T.reshape(-1, 2)
|
||||
pattern_points *= square_size
|
||||
|
||||
obj_points = []
|
||||
img_points = []
|
||||
@@ -53,6 +55,6 @@ if __name__ == '__main__':
|
||||
img_n = len(img_points)
|
||||
rms, camera_matrix, dist_coefs, rvecs, tvecs = cv2.calibrateCamera(obj_points, img_points, (w, h), camera_matrix, dist_coefs)
|
||||
print "RMS:", rms
|
||||
print "camera matrix: ", camera_matrix
|
||||
print "distortion coefficients: ", dist_coefs
|
||||
print "camera matrix:\n", camera_matrix
|
||||
print "distortion coefficients: ", dist_coefs.ravel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user