Ask Your Question

Revision history [back]

The best way to export opencv data and import in matlab

So I've a question as from title. But I want underline that I will want avoid the mex-file but only use the binary file or xml file. My question in particular is related to export the points tracked with calcOpticalFlowPyrLK and relative error. Up to now, I used the following code but I don't know if it's correct way [code] outfile.open("file.bin", ios::out | ios::binary); outfile << status.size() << endl; for( int i=0; i < status.size(); i++ ) {
if( !status[i] ) outfile<< 0 << endl; else outfile << 1 <<endl;< p="">

}
outfile << points1 << endl;
outfile << points2<< endl;

stringstream ss (stringstream::in | stringstream::out); 
for(int i=0; i < err.size(); ++i)
{
   ss << err[i] << endl;
}
outfile << ss.str(); 
outfile.close();

[/code] where points1 and point2 are the features points tracked by LK algorithm in first frame and second frame respectively. Can you help me?

The best way to export opencv data and import in matlab

So I've a question as from title. But I want underline that I will want avoid the mex-file but only use the binary file or xml file. My question in particular is related to export the points tracked with calcOpticalFlowPyrLK and relative error. Up to now, I used the following code but I don't know if it's correct way [code]

outfile.open("file.bin", ios::out | ios::binary);
 outfile << status.size() << endl; 
 for( int i=0; i < status.size(); i++ )
 { 
if( !status[i] ) outfile<< 0 << endl; else outfile << 1 <<endl;< p="">

<<endl;

}
outfile << points1 << endl;
outfile << points2<< endl;

stringstream ss (stringstream::in | stringstream::out); 
for(int i=0; i < err.size(); ++i)
{
   ss << err[i] << endl;
}
outfile << ss.str(); 
outfile.close();

[/code] where points1 and point2 are the features points tracked by LK algorithm in first frame and second frame respectively. Can you help me?