编译makefile

CC=/home/编译器目录/aarch64-linux-gnu-g++
CFLAGS=--sysroot=/文件目录/s32v234evb \
    -I/文件目录/caffe_libs/include \         //caffe依赖库头文件
    -I/文件目录/caffe_libs/usr/include \    //caffe依赖库头文件
    -I/文件目录/caffe_libs/include/caffe \ //caffe层头文件
    -L/文件目录/caffe_libs/usr/lib \  //库
    -L/文件目录/caffe_libs/lib \
    -lopencv_core \
    -lopencv_imgproc \
    -lopencv_highgui \
    -lopencv_video \
    -pthread \
    -ljpeg 

CLIB=-L ../caffe_libs/lib -lcaffe-d -lpthread  -lprotobuf -lgfortran -lboost_thread -lhdf5 -lhdf5_hl -lpng16 -lglog -lgflags -lopenblas -lrt -lboost_system

all:
    ${CC} ${CFLAGS} ${CLIB} --std=c++11 -O3 -DDLIB_USE_BLAS -DCPU_ONLY -fPIC -shared -o libImageProcessing.so demo.cpp c++文件

 

xml 修改
import os  
import xml.etree.ElementTree as ET  
      
origin_ann_dir = '/home/nxp/caffeSSDNet/caffe/data/VOCdevkit/callsmoke/aaa/'  
new_ann_dir = '/home/nxp/caffeSSDNet/caffe/data/VOCdevkit/callsmoke/bbb/'

for dirpaths, dirnames, filenames in os.walk(origin_ann_dir):  
  for filename in filenames:  
     if os.path.isfile(r'%s%s' %(origin_ann_dir, filename)):  
       origin_ann_path = os.path.join(r'%s%s' %(origin_ann_dir, filename))  
       new_ann_path = os.path.join(r'%s%s' %(new_ann_dir, filename))  
       tree = ET.parse(origin_ann_path)  
        
       root = tree.getroot()  
       for object in root.findall('object'):  
          name = str(object.find('name').text)  
          if name == "headw" :
             object.find('name').text = "head"
             #root.remove(object)
             print(filename) 
          if name == "holdchind " :
             object.find('name').text = "holdchind"
             print(filename)
       tree.write(new_ann_path) 

 

1、opencv目录下的cmakelist.txt 添加

ocv_include_directories(./3rdparty/zlib/) 
ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})
ocv_include_directories(./3rdparty/zlib/) 

 

2、src/google/protobuf/stubs/common.cc

添加#define HAVE_PTHREAD

3、CMAKE_EXE_LINKER_FLAGS 添加 -lpthread -lrt -ldl

4、勾上 BUILD_JPEG 和 BUILD_JNP (此2项可选)

5、CMAKE_INSTALL_PREFIX写成新建的目录(放头文件和库)

 

posted @ 2020-03-04 10:38  crazybird123  阅读(289)  评论(0编辑  收藏  举报