Code is the most simple use filestorage reads the XML file
# include & lt; iostream>
# include & lt; string>
# include & lt; Opencv2/core/core. Hpp>
using namespace std;
Using the namespace CV;
Void main () {
FileStorage fs2 (" test. XML, "FileStorage: : READ);
//the first method: use (type) operator on FileNode.
Int the frameCount=(int) fs2 [] "the frameCount";
STD: : string date;
//the second method: use FileNode: : operator & gt;>
"CalibrationDate" fs2 [] & gt;> date;
Mat cameraMatrix2 distCoeffs2;
"CameraMatrix" fs2 [] & gt;> CameraMatrix2;
"DistCoeffs" fs2 [] & gt;> DistCoeffs2;
Cout & lt; <"The frameCount:" & lt;
FileNode the features=fs2 (" features "),
FileNodeIterator it=the features. The begin (), it_end=the features. The end ();
int idx=0;
STD: : vector
//to iterate through a sequence using FileNodeIterator
for (; It!=it_end; + + it, idx++)
{
Cout & lt; <"Feature #" & lt;
//you can also easily read numerical arrays using FileNode & gt;> STD: : vector operator.
(* it) [" LBP "] & gt;> Lbpval;
For (int I=0; i <(int) lbpval. The size (); I++)
Cout & lt; <"" & lt; <(int) lbpval [I];
Cout & lt; <") "& lt;
Fs2. Release ();
}
CodePudding user response:
I also met the same problem