#ifndef OBJECT_DETECT_H #define OBJECT_DETECT_H #include <stdbool.h> /************************************************* 功能: 對象檢測(檢測視頻中的台標、人物等) 參數說明: src :輸入圖像數據(YUV420P) srcStride :輸入數據的長度 image_width :輸入圖像寬度 image_height :輸入圖像高度 model_path :對象檢測模型的路徑(.pb) pbtxt_path :模型對應的描述文件(.pbtxt 需通過opencv-4.2.0/sample/dnn/tf_text_graph_ssd.py進行生成) object_name_path:對象id到名稱的映射 min_match_rate :最小匹配率 show :是否顯示檢測到的結果 **************************************************/ #ifdef __cplusplus extern "C"{ #endif bool object_detect(unsigned char* src[8], int srcStride[8],int image_width,int image_height,char* model_path,char* pbtxt_path,char *object_name_path,float min_match_rate,bool show); #ifdef __cplusplus } #endif #endif
以上是庫文件對應的頭文件,頭文件必須有extern c 才能被C調用
[root@node0 lib_object_detect]# nm object_detect.so |grep object_detect 000000000001249e t _GLOBAL__sub_I_object_detect.cpp 0000000000010203 T object_detect 000000000021de30 b _ZGVZ13object_detectE8kWinName 0000000000017e08 r _ZZ13object_detectE8__func__ 000000000021de48 b _ZZ13object_detectE8kWinName [root@node0 lib_object_detect]# ls Makefile object_detect.cpp object_detect.h object_detect.so test.cpp
nm的符號中必須有object_detect才行,切object_detect前不能有其他字符