【问题标题】:opencv_python build error on visual studio 11 and windows 7Visual Studio 11 和 Windows 7 上的 opencv_python 构建错误
【发布时间】:2017-03-27 05:16:12
【问题描述】:

当我使用opencv_contribvisual studio 11 从源代码中使用python 支持 构建opencv 3.2.0 时,我在cv2.cpp 中有一个错误,如下所示,我在网上找不到任何帮助

1>------ Build started: Project: opencv_python2, Configuration: Release Win32 ------
1>  cv2.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0(605): error C2129: static function 'PyObject *pyopencv_from<cv::Matx44d>(const T &)' declared but not defined
1>          with
1>          [
1>              T=cv::Matx44d
1>          ]
1>          C:\Users\tofaa\Downloads\Compressed\opencv\sources\opencv-3.2.0\opencv-3.2.0\modules\python\src2\cv2.cpp(207) : see declaration of 'pyopencv_from'
========== Build: 0 succeeded, 1 failed, 101 up-to-date, 0 skipped ==========

【问题讨论】:

    标签: python visual-studio opencv image-processing cmake


    【解决方案1】:

    这是因为 pyopencv_cv_ppf_match_3d_ppf_match_3d_ICP_registerModelToScene 在调用 pyopencv_from func 时不知道如何处理 4x4 矩阵。 您需要将 s stub(!) 添加到 模块/python/src2/cv2.cpp 类似于下面的“代码”,直到开发人员添加真正的功能。不要忘记由于这个存根会出现问题。 这也是所有在制作过程中忽略警告的人的答案: ImportError:dlopen(/OpenCV/StaticLibs/Lib/cv2.so,2):找不到符号:_PyCObject_Type 要么 __ZL13pyopencv_fromIN2cv4MatxIdLi4ELi4EEEEP7_objectRKT_ python import cv2时以此类推

    //your do_not_forget comment here
    template<>
    PyObject* pyopencv_from(const Matx44d& m) 
    {
    
        Mat temp, *p = (Mat*)&m;
        if(!p->u || p->allocator != &g_numpyAllocator)
        {
            temp.allocator = &g_numpyAllocator;
        }
        PyObject* o = (PyObject*)p->u->userdata;
        Py_INCREF(o);
        return o;
    }
    

    【讨论】:

      猜你喜欢
      • 2011-12-19
      • 2015-03-03
      • 2013-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-14
      • 2019-04-03
      • 1970-01-01
      相关资源
      最近更新 更多