Video Analysis底层库拆分,sdk的go封装
zhangzengfei
2019-11-14 01f10af7d520bd93367f385f91e33849f5d8773e
fix: plate id sdk add get default config method
4个文件已修改
49 ■■■■■ 已修改文件
csdk_struct.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
csrc/buz/plate/detector.cpp 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
go2c.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gosdk.go 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
csdk_struct.h
@@ -70,6 +70,8 @@
} cObjInfo;
typedef struct _cPlateIDCfg {
    int nFastMemorySize;            // 单位 K
    int nMemorySize;                // 单位 M
    int nMinPlateWidth;                // 检测的最小车牌宽度,以像素为单位
    int nMaxPlateWidth;                // 检测的最大车牌宽度,以像素为单位
    int nMaxImageWidth;                // 最大图像宽度
csrc/buz/plate/detector.cpp
@@ -35,8 +35,8 @@
    }
    void init_plate_id_config(const cPlateIDCfg *params) {
        int fMemSize = 0x8000;
        int pMemSize = 200 * 1024 * 1024;
        int fMemSize = params->nFastMemorySize * 1024;
        int pMemSize = params->nMemorySize * 1024 * 1024;
        fmem = (unsigned char*)malloc(fMemSize * sizeof(unsigned char));
        pmem = (unsigned char*)malloc(pMemSize * sizeof(unsigned char));
@@ -78,9 +78,11 @@
    void set_enable_plate_format(const cPlateIDCfg *params) {
        if (params->bOnlyLocation == 1) {
            TH_SetEnabledPlateFormat(PARAM_ONLY_LOCATION_ON, &config);
            return;
        }
        if (params->bOnlyTwoRowYellow == 1) {
            TH_SetEnabledPlateFormat(PARAM_ONLY_TWOROWYELLOW_ON, &config);
            return;
        }
        if (params->bIndividual == 1) {
            TH_SetEnabledPlateFormat(PARAM_INDIVIDUAL_ON, &config);
@@ -133,7 +135,7 @@
        rcDetect.top = 0;
        rcDetect.right = img->width;
        rcDetect.bottom = img->height;
        rcDetect.left = 0;
        rcDetect.left = 0;
        int ret = TH_RecogImage((BYTE*)(img->data), img->width, img->height, result, &nResultNum, &rcDetect, &config);
        // printf("TH_RecogImage ret = %d\n", ret);
go2c.go
@@ -67,6 +67,8 @@
}
type CPlateIDCfg struct {
    FastMemorySize int32 // DSP等的片内内存大小 单位K
    MemorySize     int32 // 普通内存大小 单位 M
    MinPlateWidth  int32 // 检测的最小车牌宽度,以像素为单位
    MaxPlateWidth  int32 // 检测的最大车牌宽度,以像素为单位
    MaxImageWidth  int32 // 最大图像宽度
gosdk.go
@@ -411,6 +411,43 @@
    return allObjs, newObjs
}
func DefaultPlateIDSDKConfig() *CPlateIDCfg{
    return &CPlateIDCfg{
        FastMemorySize: 32,
        MemorySize: 400,
        MinPlateWidth: 60,
        MaxPlateWidth: 400,
        MaxImageWidth: 4096,
        MaxImageHeight: 2160,
        IsFieldImage: 0,
        MovingImage: 1,
        OrderOpt: 0,
        LeanCorrection: 1,
        ImproveSpeed: 0,
        CarLogo: 1,
        LotDetect: 1,
        Shadow: 1,
        ShieldRailing: 1,
        CarModel: 1,
        LocateTh: 5,
        OCRTh: 2,
        Individual: 1,
        TwoRowYellow: 1,
        ArmPolice: 1,
        ArmPolice2: 1,
        TwoRowArmy: 1,
        Tractor: 1,
        Embassy: 1,
        ChangNei: 1,
        MinHang: 1,
        Consulate: 1,
        NewEnergy: 1,
        OnlyTwoRowYellow: 0,
        OnlyLocation: 0,
    }
}
// InitPlateIDDetector init plateid detector
func InitPlateIDDetector(config *CPlateIDCfg, soPath []byte) {
    C.c_api_plate_id_init((*C.cPlateIDCfg)(unsafe.Pointer(config)), (*C.char)(unsafe.Pointer(&soPath[0])))