def calculate(self):
self.calculated = True
self.count = 10
rms, camera_matrix, dist_coefs, rvecs, tvecs = cv2.calibrateCamera(np.array(self.obj_points), np.array(self.img_points),self.g_pool.capture.frame_size,None,None)
logger.info("Calibrated Camera, RMS:{}".format(rms))
camera_calibration = {'camera_matrix':camera_matrix,'dist_coefs':dist_coefs,'camera_name':self.g_pool.capture.name,'resolution':self.g_pool.capture.frame_size}
save_object(camera_calibration,os.path.join(self.g_pool.user_dir,"camera_calibration"))
logger.info("Calibration saved to user folder")
self.camera_intrinsics = camera_matrix,dist_coefs,self.g_pool.capture.frame_size
self.show_undistortion_switch.read_only=False
评论列表
文章目录