-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_xml.cpp
61 lines (43 loc) · 1.05 KB
/
read_xml.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <opencv2/core/core.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main(int argc, char** argv)
{
int array_dim= 20;
int i;
int n_o_image=1;
Mat frame[array_dim];
// read file
stringstream ss;
string str = ss.str();
// string filename = "golf_head.ymal";
string filename;
cout << "filename to be read(e.g., xxx.xml): ";
cin >> filename;
FileStorage fsr(filename, FileStorage::READ);
fsr["n_o_image"]>>n_o_image; //read an integer
for (i=0;i<=n_o_image;i++)
{
ss <<"img"<< i<<"_jpg";
str = ss.str();
ss.str("");
fsr[str]>>frame[i];
}
fsr.release();
//Size size(128,128);//the dst image size,e.g.100x100
Mat dst;//dst image
for (i=0;i<=n_o_image;i++)
{
ss <<"img"<< i<<"_jpg";
str = ss.str();
ss.str("");
imshow(str,frame[i]);
}
waitKey(0);
return 0;
}