def main(): logging.basicConfig(level=logging.DEBUG, format='%(message)s') testImgs = ['smallRealBoard1.JPG','images/image_2.jpeg','images/image_3.jpeg', 'images/image2_7.jpeg','images/image3_10.jpeg', 'images/image3_30.jpeg', 'images/image4_1.jpeg', 'images/image5_1.jpeg', 'images/image6_1.jpeg','images/image7_1.jpeg','images/image8_1.jpeg','images/image9_1.jpeg','images/image10_1.jpeg','images/image11_1.jpeg','images/image12_1.jpeg','images/image13_1.jpeg','images/image14_1.jpeg','images/image15_1.jpeg','images/image16_1.jpeg','images/image17_1.jpeg','images/image18_1.jpeg','images/image19_1.jpeg','images/image20_1.jpeg','images/image21_1.jpeg'] _, _, error = DetermineSkew.createSkewMatrix(testImgs) print "Done" print "Calculated error = " + str(error) img1 = cv2.imread('smallRealBoard1.JPG') img2 = cv2.imread('calibresult.png') cv2.imshow("ORIGINAL", img1) cv2.imshow("CORRECTED", img2) cv2.waitKey(0)
def setSkewCorrectionValues(self, calib_photos): ''' Finds mtx values for a list of calibration photos - sets class variables Args: calib_photos: list of photos taken specifically for skew calibration Returns: None ''' # If self.use_skew_correction = None, then we are calibrating for skew self.use_skew_correction = None # Find dst and roi matrices mtx, dist, newmtx = DetermineSkew.createSkewMatrix(calib_photos) self.skew_mtx = mtx self.skew_dist = dist self.skew_newcameramtx = newmtx