<s> """<STR_LIT>""" <EOL> import cv2 <EOL> import numpy as np <EOL> import glob <EOL> criteria = ( cv2 . TERM_CRITERIA_EPS + cv2 . TERM_CRITERIA_MAX_ITER , <NUM_LIT:30> , <NUM_LIT> ) <EOL> object_point = np . zeros ( ( <NUM_LIT:6> * <NUM_LIT:9> , <NUM_LIT:3> ) , np . float32 ) <EOL> object_point [ : , : <NUM_LIT:2> ] = np . mgrid [ <NUM_LIT:0> : <NUM_LIT:9> , <NUM_LIT:0> : <NUM_LIT:6> ] . T . reshape ( - <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> object_points = [ ] <EOL> image_points = [ ] <EOL> h , w = <NUM_LIT:0> , <NUM_LIT:0> <EOL> images = glob . glob ( '<STR_LIT>' ) <EOL> for file_name in images : <EOL> image = cv2 . imread ( file_name ) <EOL> gray = cv2 . cvtColor ( image , cv2 . COLOR_BGR2GRAY ) <EOL> h , w = gray . shape [ : <NUM_LIT:2> ] <EOL> ret , corners = cv2 . findChessboardCorners ( gray , ( <NUM_LIT:9> , <NUM_LIT:6> ) , None ) <EOL> if ret : <EOL> object_points . append ( object_point ) <EOL> cv2 . cornerSubPix ( gray , corners , ( <NUM_LIT:11> , <NUM_LIT:11> ) , ( - <NUM_LIT:1> , - <NUM_LIT:1> ) , criteria ) <EOL> image_points . append ( corners ) <EOL> cv2 . drawChessboardCorners ( image , ( <NUM_LIT:9> , <NUM_LIT:6> ) , corners , ret ) <EOL> cv2 . imshow ( '<STR_LIT:image>' , image ) <EOL> cv2 . waitKey ( <NUM_LIT> ) <EOL> retval , cameraMatrix , distCoeffs , rvecs , tvecs = cv2 . calibrateCamera ( object_points , image_points , ( w , h ) , None , None ) <EOL> print "<STR_LIT>" , cameraMatrix <EOL> ay = cameraMatrix [ <NUM_LIT:1> , <NUM_LIT:1> ] <EOL> u0 = cameraMatrix [ <NUM_LIT:0> , <NUM_LIT:2> ] <EOL> v0 = cameraMatrix [ <NUM_LIT:1> , <NUM_LIT:2> ] <EOL> print "<STR_LIT>" , ay <EOL> print "<STR_LIT>" , u0 <EOL> print "<STR_LIT>" , v0 <EOL> cv2 . destroyAllWindows ( ) </s>
