I am trying to build opencv 3.3.0 on raspberry pi 3 but facing an error at 93% saying invalid conversion. Details are provided below any help will be greatly appreciated. please help.
This error message is showing up.
/home/pi/opencv-3.3.0/modules/python/src2/cv2.cpp: In function ‘bool pyopencv_to(PyObject*, T&, const char*) [with T = cv::String; PyObject = _object]’:/home/pi/opencv-3.3.0/modules/python/src2/cv2.cpp:854:34: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive] char* str = PyString_AsString(obj);In file included from /home/pi/opencv-3.3.0/modules/python/src2/cv2.c
I Tried these commands
cd ~/opencv-3.3.0/
$ mkdir build $ cd build $ cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \ -D BUILD_EXAMPLES=ON ..
#cv2.cpp code at error location.
template<>
bool pyopencv_to(PyObject* obj, String& value, const char* name)
{
(void)name;
if(!obj || obj == Py_None)
return true;
char* str = PyString_AsString(obj);
if(!str)
return false;
value = String(str);
return true;
}