zoukankan      html  css  js  c++  java
  • YOLOv3的Darknet在OpenCV3.4.1(bug)下编译出错填坑

    刚配置完环境

    https://www.cnblogs.com/clemente/p/11029117.html

    能正常跑原版 darknet ,但是跑了一下别人修改的版本出现了错误

    查Google之后才发现遇到这个问题的朋友不在少数,大概的原因是因为OpenCV 3.4.1在C的API里有bug,所以导致了这个编译问题。那么我将国外大神的办法转到这里,希望能够帮助大家解决这个问题,原帖地址在这,也衷心感谢这位国外大神。

    步骤有两步,需要修改两个c文件。

     

    第一步,找到:

    /usr/local/include/opencv2/core/cvdef.h

    修改485行左右的代码:

    #else
    #include <stdint.h>
    namespace cv {
    typedef ::int8_t int8_t;
    typedef ::uint8_t uint8_t;
    typedef ::int16_t int16_t;
    typedef ::uint16_t uint16_t;
    typedef ::int32_t int32_t;
    typedef ::uint32_t uint32_t;
    typedef ::int64_t int64_t;
    typedef ::uint64_t uint64_t;
    }
    #endif

    把这段代码注释掉,改为:

    #else
    #include <stdint.h>
    //namespace cv {
    //typedef ::int8_t int8_t;
    //typedef ::uint8_t uint8_t;
    //typedef ::int16_t int16_t;
    //typedef ::uint16_t uint16_t;
    //typedef ::int32_t int32_t;
    //typedef ::uint32_t uint32_t;
    //typedef ::int64_t int64_t;
    //typedef ::uint64_t uint64_t;
    //}
    #endif
     

    第二步,找到:

    /usr/local/include/opencv2/highgui/highgui_c.h

    修改139行左右的代码:

    CVAPI(cv::Rect)cvGetWindowImageRect(const char* name);

    修改类型为:

    CVAPI(CvRect)cvGetWindowImageRect(const char* name);

    这两步做完以后,再在darknet文件夹下执行make命令,应该就能编译通过了。编译通过以后别忘了把修改过的代码改回来,因为不知道以后什么时候万一还会用到,到时候忘了自己改过这里的话会很麻烦。

    参考

    https://zhuanlan.zhihu.com/p/36933700

  • 相关阅读:
    SQL查询
    SQL语句
    SQL语句
    查询设计分析
    数据库引擎调整顾问
    详解执行计划
    详解索引连接类型
    查询开销
    利用SQL Profiler处理开销较大的查询
    状压dp的题目列表 (一)
  • 原文地址:https://www.cnblogs.com/clemente/p/11031893.html
Copyright © 2011-2022 走看看