Ask Your Question
0

why cant i read this yaml file ?

asked 2017-04-20 11:26:59 -0600

Nbb gravatar image

How do i read this yaml file into an opencv matrix ? It always prints an empty matrix.

cv::Mat dx;
cv::FileStorage fs;
fs.open("C:\\Users\\Documents\\Visual Studio 2015\\Projects\\UCM\\x64\\Release\\farid_x.yaml", cv::FileStorage::READ);
fs["data"] >> dx;
cout << dx;;

It always prints an empty matrix [].

%YAML:1.0
    dx: !!opencv-matrix
        rows: 9
        cols: 9
        dt: f
        data: [ 0.000003, 0.000048, 0.000282, 
            0.000744, 0.001015, 0.000744, 0.000282, 
            0.000048, 0.000003, 0.000032, 0.000530, 
            0.003114, 0.008213, 0.011194, 0.008213, 
            0.003114, 0.000530, 0.000032, 0.000109, 
            0.001802, 0.010595, 0.027946, 0.038087, 
            0.027946, 0.010595, 0.001802, 0.000109, 
            0.000134, 0.002208, 0.012985, 0.034251, 
            0.046681, 0.034251, 0.012985, 0.002208, 
            0.000134, 0.000000, 0.000000, 0.000000, 
            0.000000, 0.000000, 0.000000, 0.000000, 
            0.000000, 0.000000, -0.000134, -0.002208, 
            -0.012985, -0.034251, -0.046681, -0.034251, 
            -0.012985, -0.002208, -0.000134, -0.000109, 
            -0.001802, -0.010595, -0.027946, -0.038087, 
            -0.027946, -0.010595, -0.001802, -0.000109, 
            -0.000032, -0.000530, -0.003114, -0.008213, 
            -0.011194, -0.008213, -0.003114, -0.000530, 
            -0.000032, -0.000003, -0.000048, -0.000282, 
            -0.000744, -0.001015, -0.000744, -0.000282, 
            -0.000048, -0.000003]
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2017-04-20 11:28:22 -0600

LBerger gravatar image

It is not fs["data"] but fs["dx"]

edit flag offensive delete link more

Comments

oops thanks !

Nbb gravatar imageNbb ( 2017-04-20 11:40:55 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-04-20 11:26:59 -0600

Seen: 811 times

Last updated: Apr 20 '17