Skip to content

Commit 0051744

Browse files
authored
Merge pull request opencv#8267 from umbraclet16:fixCalibSample
Solve issue opencv#8264
2 parents 54f65a4 + b8d99e1 commit 0051744

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
@@ -101,7 +101,7 @@ class Settings
101101
}
102102
else
103103
{
104-
if (readStringList(input, imageList))
104+
if (isListOfImages(input) && readStringList(input, imageList))
105105
{
106106
inputType = IMAGE_LIST;
107107
nrFrames = (nrFrames < (int)imageList.size()) ? nrFrames : (int)imageList.size();
@@ -169,6 +169,16 @@ class Settings
169169
l.push_back((string)*it);
170170
return true;
171171
}
172+
173+
static bool isListOfImages( const string& filename)
174+
{
175+
string s(filename);
176+
// Look for file extension
177+
if( s.find(".xml") == string::npos && s.find(".yaml") == string::npos && s.find(".yml") == string::npos )
178+
return false;
179+
else
180+
return true;
181+
}
172182
public:
173183
Size boardSize; // The size of the board -> Number of items by width and height
174184
Pattern calibrationPattern;// One of the Chessboard, circles, or asymmetric circle pattern

0 commit comments

Comments
 (0)