From 81b9be1623fde71c5efd6b3d656b2f525d1e46a4 Mon Sep 17 00:00:00 2001 From: Huu Nguyen Date: Tue, 16 Sep 2014 15:30:10 -0700 Subject: [PATCH] Fix implicit narrowing error in initializer list The implicit narrowing in the initializer list throws a compiler error for some compilers with C++11 support turned on. The specific error message is: "error: narrowing conversion of 'PyInt_AsLong(((PyObject*)o))' from 'long int' to 'double' inside { }". Tested on Clang 5.1.0 and Mac OS X 10.9.4. --- modules/python/src2/cv2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index f02ba5a12..b49176100 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -219,7 +219,7 @@ static bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo info) if( PyInt_Check(o) ) { - double v[] = {PyInt_AsLong((PyObject*)o), 0., 0., 0.}; + double v[] = {(double)PyInt_AsLong((PyObject*)o), 0., 0., 0.}; m = Mat(4, 1, CV_64F, v).clone(); return true; }