39 from camera_calibration_parsers
import readCalibration
43 for files
in [(
'calib5.ini',
'calib5.yaml'), (
'calib8.ini',
'calib8.yaml')]:
44 for dir
in [
'',
'./']:
45 p = subprocess.Popen(
'rosrun camera_calibration_parsers convert $(rospack find camera_calibration_parsers)/test/%s %s%s' % (files[0], dir, files[1]), shell=
True, stderr=subprocess.PIPE)
46 out, err = p.communicate()
47 self.assertEqual(err,
'')
50 script_dir = os.path.dirname(os.path.realpath(__file__))
51 camera_name, camera_info =
readCalibration(os.path.join(script_dir,
'calib5.ini'))
52 self.assertEqual(camera_name,
'mono_left')
53 self.assertEqual(camera_info.height, 480)
54 self.assertEqual(camera_info.width, 640)
55 self.assertEqual(camera_info.P[0], 262.927429)
57 camera_name, camera_info =
readCalibration(os.path.join(script_dir,
'calib8.ini'))
58 self.assertEqual(camera_info.distortion_model,
'rational_polynomial')
60 if __name__ ==
'__main__':
61 rosunit.unitrun(
'camera_calibration_parsers',
'parser', TestParser)
bool readCalibration(const std::string &file_name, std::string &camera_name, sensor_msgs::CameraInfo &cam_info)
Read calibration parameters from a file.
def test_readCalibration(self)