Ask Your Question

Revision history [back]

Problem converting Mat values to float


after i used the SURF-Extractor i got a Mat with all the feature-vectors (one per row). I want to convert thoose vectors (rows of the Mat) into separate float-Attays.

I do this with the following code:

float vec[64];
for(int i=0;i<64;i++)
vec[i]=<float>(n,i);//the n`th row is written in vec

it works fine so far, but when i look at the original values in mat, using cout << "M = "<< endl << " " << mat << endl << endl; i see floats such as "3.5637853e-005" wich is good.

when i now look at the content of vec, the floats are "shorter", for example "3.5637853e-005" becomes "3.56379e-005".

How can i copy the values form mat to vec without them loosing accuracy?

Thank you.