Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Print Mat values out to screen and vice versa

How can I break Mat into readable format i.e get the row and column values printed and convert that readable value back to Mat again

I want something like this Eg Mat something;

printf(something) = {{0,0},{0,1},{1,0},{1,1}...etc}

and now convert those back to Mat

{0,0},{0,1},{1,0},{1,1}...etc}=> something

I tried using this

for(int i=0 ; i<something.rows ; i++){
    for(int j=0 ; j<something.cols ; j++){
        printf("something rows and cols: %d %d \n", something.row(i),something.row(j));
    }
}

But I am getting same values

1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2

Any help is appreciated

Print Mat values out to screen and vice versa

How can I break Mat into readable format i.e get the row and column values printed and convert that readable value back to Mat again

I want something like this Eg Mat something;Eg

Mat something;
printf(something) = {{0,0},{0,1},{1,0},{1,1}...etc}

and now convert those back to Mat

{0,0},{0,1},{1,0},{1,1}...etc}=> something

I tried using this

for(int i=0 ; i<something.rows ; i++){
    for(int j=0 ; j<something.cols ; j++){
        printf("something rows and cols: %d %d \n", something.row(i),something.row(j));
    }
}

But I am getting same values

1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2

Any help is appreciated

click to hide/show revision 3
retagged

updated 2013-10-14 04:20:21 -0600

berak gravatar image

Print Mat values out to screen and vice versa

How can I break Mat into readable format i.e get the row and column values printed and convert that readable value back to Mat again

I want something like this Eg

Mat something;
printf(something) = {{0,0},{0,1},{1,0},{1,1}...etc}

and now convert those back to Mat

{0,0},{0,1},{1,0},{1,1}...etc}=> something

I tried using this

for(int i=0 ; i<something.rows ; i++){
    for(int j=0 ; j<something.cols ; j++){
        printf("something rows and cols: %d %d \n", something.row(i),something.row(j));
    }
}

But I am getting same values

1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2
1124057088 2

Any help is appreciated