File to read
Example
%YAML:1.0
calibration_time: "Wed 08 Sep 2010 01:49:24 PM ICT"
image_count: 10
image_width: 640
image_height: 480
board_width: 8
board_height: 6
square_size: 3.
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 7.0670231633826893e+02, 0., 2.9776351172468094e+02, 0.,
7.0623929245059901e+02, 2.6088449526885739e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 1
cols: 4
dt: d
data: [ -5.8713493296008348e-02, 3.5972311978605072e-02,
1.0258503131952429e-02, -2.5861511364179125e-04 ]
avg_reprojection_error: 2.8090511932969092e-01
per_view_reprojection_errors: !!opencv-matrix
rows: 1
cols: 10
dt: d
data: [ 3.5422265529632568e-01, 3.9157994588216144e-01,
1.9369331995646158e-01, 2.4840275446573892e-01,
1.7604033586879572e-01, 2.6437775293986004e-01,
2.4450556437174478e-01, 2.3067680994669595e-01,
4.2982764355838299e-01, 2.7572441101074219e-01 ]
Example
char *out_filename = "/home/dsin/Pursuit/Project/pursuit/calibration/_out_camera_data.yml";
CvFileStorage* fs = cvOpenFileStorage( out_filename, 0, CV_STORAGE_READ );
CvFileNode* camera_matrix_node = cvGetFileNodeByName( fs, 0, "camera_matrix" );
CvFileNode* rows_node = cvGetFileNodeByName( fs, camera_matrix_node, "rows" );
int rows = cvReadInt(rows_node, 0);
printf("rows: %d\n", rows);
CvMat *camera_matrix = (CvMat*)cvRead( fs, camera_matrix_node );
dispMat(camera_matrix, "camera_matrix");
ความคิดเห็น