Skip to content

Commit 2570a5a

Browse files
committed
Merge pull request opencv#8292 from sovrasov:backport_8267
2 parents 220d1f0 + 17ece58 commit 2570a5a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class Settings
109109
}
110110
else
111111
{
112-
if (readStringList(input, imageList))
112+
if (isListOfImages(input) && readStringList(input, imageList))
113113
{
114114
inputType = IMAGE_LIST;
115115
nrFrames = (nrFrames < (int)imageList.size()) ? nrFrames : (int)imageList.size();
@@ -190,6 +190,16 @@ class Settings
190190
l.push_back((string)*it);
191191
return true;
192192
}
193+
194+
static bool isListOfImages( const string& filename)
195+
{
196+
string s(filename);
197+
// Look for file extension
198+
if( s.find(".xml") == string::npos && s.find(".yaml") == string::npos && s.find(".yml") == string::npos )
199+
return false;
200+
else
201+
return true;
202+
}
193203
public:
194204
Size boardSize; // The size of the board -> Number of items by width and height
195205
Pattern calibrationPattern; // One of the Chessboard, circles, or asymmetric circle pattern

0 commit comments

Comments
 (0)