Jetson|Ubuntu(Jetson nano) qtcreator配置Libtorch、Qt、opencv

opencv配置 jetson nano自带opencv

#opencv INCLUDEPATH += \ /usr/include/opencv4/opencv2 \ /usr/include/opencv4LIBS += /usr/lib/aarch64-linux-gnu/libopencv*

libtorch 注意nvidia改成自己的用户名,如果按照官方教程进行安装,这是libtorch的默认安装位置
#libtorch INCLUDEPATH += \ /home/nvidia/.local/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/ \ /home/nvidia/.local/lib/python3.6/site-packages/torch/include/ \LIBS += \ /home/nvidia/.local/lib/python3.6/site-packages/torch/lib/*.so \ -L/home/nvidia/.local/lib/python3.6/site-packages/torch/lib/ \ -Wl,--no-as-needed -ltorch_cuda # force to link torch_cuda

【Jetson|Ubuntu(Jetson nano) qtcreator配置Libtorch、Qt、opencv】补充:
  1. 关于qt和libtorch冲突问题,引入torch头文件时使用这种方式,qt的slots和libtorch的slots冲突了
#undef slots #include #include #define slots Q_SLOTS

  1. 关于opencv和libtorch冲突的问题,由于libtorch和opencv有些命名空间冲突了,需要修改源码。大部分的修改方式是需要看报错,报哪个东西冲突了,就在该文件的最上面的using namespace at{ 的下面一行补上using namespcae c10::xxxxx(xxx指的就是冲突的那个东西)一些参考

    推荐阅读