OpenCV错误:断言重复失败(ny> 0 && nx> 0),文件opencv / modules / core / src / copy.cpp,

时间:2019-05-07 16:47:25

标签: c++ opencv cmake mxnet

我正在使用以下代码编译源代码:

  

g ++ -o bc main.cpp comm_lib.cpp mxnet_mtcnn.cpp utils.cpp -std = c ++ 11   -o3 $(pkg-config --cflags --libs opencv)

     

-I /用户/ xxx /下载/apache-mxnet-src-1.3.0-incubating/include/   -I /用户/ xxx /下载/apache-mxnet-src-1.3.0-incubating/cpp-package/include   -I /用户/ xxx /下载/apache-mxnet-src-1.3.0-incubating/3rdparty/tvm/nnvm/include/   -I /用户/ xxx /下载/apache-mxnet-src-1.3.0-incubating/3rdparty/dmlc-core/include   -L /用户/ xxx /下载/apache-mxnet-src-1.3.0-incubating/lib -lmxnet

及生成的文件正常工作,打开相机等。

当尝试通过CMakeList.txt进行编译时。与:

> cmake_minimum_required(VERSION 2.8.9) project (BCFacev4)
> SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -std=c++11 ")
> 
> set(MXNET /Users/xxx/Downloads/apache-mxnet-src-1.3.0-incubating/lib)
> 
> find_package( OpenCV REQUIRED )
> 
> 
> include_directories(/Users/xxx/Downloads/apache-mxnet-src-1.3.0-incubating/include/
> )
> include_directories(/Users/xxx/Downloads/apache-mxnet-src-1.3.0-incubating/cpp-package/include
> )
> include_directories(/Users/xxx/Downloads/apache-mxnet-src-1.3.0-incubating/3rdparty/tvm/nnvm/include/
> )
> include_directories(/Users/xxx/Downloads/apache-mxnet-src-1.3.0-incubating/3rdparty/dmlc-core/include
> )
> include_directories(/Users/xxx/Downloads/apache-mxnet-src-1.3.0-incubating/lib)
> 
> SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}
> -L/Users/xxx/Downloads/apache-mxnet-src-1.3.0-incubating/lib  -lmxnet ")
> 
> 
> 
> ADD_EXECUTABLE(main  main.cpp comm_lib.cpp mxnet_mtcnn.cpp utils.cpp)
> TARGET_LINK_LIBRARIES(main   ${OpenCV_LIBS} ${MXNET_LIBS} )

它还编译并运行程序BUT,但出现以下错误:

> OpenCV Error: Assertion failed (ny > 0 && nx > 0) in repeat, file
> /Users/xxx/Projects/opencv/modules/core/src/copy.cpp, line 864
> libc++abi.dylib: terminating with uncaught exception of type
> cv::Exception:
> /Users/xxx/Projects/opencv/modules/core/src/copy.cpp:864: error:
> (-215) ny > 0 && nx > 0 in function repeat

我不明白为什么cmake编译的二进制文件会出现此错误?我是否缺少某些配置?

谢谢

1 个答案:

答案 0 :(得分:0)

我发现了偷偷摸摸的问题:()

源编译文件中的一个文件,生成的二进制文件找到了该文件并正常工作。

Bur Cmake和CLion创建了不同的构建文件夹并在其中运行,因此默默地找不到该文件,痛苦开始了。

对此表示抱歉。

我发现了问题。

最佳