[opencv] 16/53: Solve issue #8264

Nobuhiro Iwamatsu iwamatsu at moszumanska.debian.org
Sun Aug 27 23:27:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

iwamatsu pushed a commit to annotated tag 2.4.13.3
in repository opencv.

commit b8d99e1ffb1f16c295bdbf6b756c91cb59c304c0
Author: umbraclet16 <448101470 at qq.com>
Date:   Sat Feb 25 16:16:23 2017 +0800

    Solve issue #8264
    
    Fix bug in camera_calibration.cpp that the program tries to
    parse input of type VIDEO_FILE as IMAGE_LIST which causes the
    program to crash.
---
 .../calib3d/camera_calibration/camera_calibration.cpp        | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp b/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp
index 6df0c16..86d8892 100644
--- a/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp
+++ b/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp
@@ -101,7 +101,7 @@ public:
             }
             else
             {
-                if (readStringList(input, imageList))
+                if (isListOfImages(input) && readStringList(input, imageList))
                     {
                         inputType = IMAGE_LIST;
                         nrFrames = (nrFrames < (int)imageList.size()) ? nrFrames : (int)imageList.size();
@@ -169,6 +169,16 @@ public:
             l.push_back((string)*it);
         return true;
     }
+
+    static bool isListOfImages( const string& filename)
+    {
+        string s(filename);
+        // Look for file extension
+        if( s.find(".xml") == string::npos && s.find(".yaml") == string::npos && s.find(".yml") == string::npos )
+            return false;
+        else
+            return true;
+    }
 public:
     Size boardSize;            // The size of the board -> Number of items by width and height
     Pattern calibrationPattern;// One of the Chessboard, circles, or asymmetric circle pattern

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list