@@ -9,11 +9,12 @@ namespace cv { namespace photometric_calib{
9
9
10
10
unsigned long Reader::getNumImages () const
11
11
{
12
- return (unsigned long )files .size ();
12
+ return (unsigned long )images .size ();
13
13
}
14
14
15
15
void Reader::loadTimestamps (const std::string ×File)
16
16
{
17
+ // check the extension of the time file.
17
18
CV_Assert (timesFile.substr (timesFile.find_last_of (" ." ) + 1 ) == " yaml" || timesFile.substr (timesFile.find_last_of (" ." ) + 1 ) == " yml" );
18
19
19
20
FileStorage timeFile;
@@ -44,28 +45,31 @@ void Reader::loadTimestamps(const std::string ×File)
44
45
Reader::Reader (const std::string &folderPath, const std::string ×Path)
45
46
{
46
47
String cvFolderPath (folderPath);
47
- glob (cvFolderPath, files );
48
- CV_Assert (files .size () > 0 );
49
- std::sort (files .begin (), files .end ());
48
+ glob (cvFolderPath, images );
49
+ CV_Assert (images .size () > 0 );
50
+ std::sort (images .begin (), images .end ());
50
51
loadTimestamps (timesPath);
51
52
52
- width = 0 ;
53
- height = 0 ;
53
+ _width = 0 ;
54
+ _height = 0 ;
54
55
55
- for (size_t i = 0 ; i < files.size (); ++i)
56
+ // images should be of CV_8U and same size
57
+ for (size_t i = 0 ; i < images.size (); ++i)
56
58
{
57
- Mat img = imread (files [i]);
59
+ Mat img = imread (images [i]);
58
60
CV_Assert (img.type () == CV_8U);
59
61
if (i == 0 )
60
62
{
61
- width = img.cols ;
62
- height = img.rows ;
63
+ _width = img.cols ;
64
+ _height = img.rows ;
63
65
}
64
66
else
65
67
{
66
- CV_Assert (width == img.cols && height == img.rows );
68
+ CV_Assert (_width == img.cols && _height == img.rows );
67
69
}
68
70
}
71
+
72
+ _folderPath = folderPath;
69
73
}
70
74
71
75
double Reader::getTimestamp (unsigned long id) const
@@ -79,6 +83,17 @@ float Reader::getExposureDuration(unsigned long id) const
79
83
CV_Assert (id < exposureDurations.size ());
80
84
return exposureDurations[id];
81
85
}
86
+
87
+ int Reader::getWidth () const {
88
+ return _width;
89
+ }
90
+
91
+ int Reader::getHeight () const {
92
+ return _height;
93
+ }
94
+
95
+ const std::string &Reader::getFolderPath () const {
96
+ return _folderPath;
82
97
}
83
98
84
99
}} // namespace photometric_calib, cv
0 commit comments