fix: plate id sdk add get default config method
| | |
| | | } cObjInfo; |
| | | |
| | | typedef struct _cPlateIDCfg { |
| | | int nFastMemorySize; // 单位 K |
| | | int nMemorySize; // 单位 M |
| | | int nMinPlateWidth; // 检测的最小车牌宽度,以像素为单位 |
| | | int nMaxPlateWidth; // 检测的最大车牌宽度,以像素为单位 |
| | | int nMaxImageWidth; // 最大图像宽度 |
| | |
| | | } |
| | | |
| | | 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)); |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | } |
| | | |
| | | type CPlateIDCfg struct { |
| | | FastMemorySize int32 // DSP等的片内内存大小 单位K |
| | | MemorySize int32 // 普通内存大小 单位 M |
| | | MinPlateWidth int32 // 检测的最小车牌宽度,以像素为单位 |
| | | MaxPlateWidth int32 // 检测的最大车牌宽度,以像素为单位 |
| | | MaxImageWidth int32 // 最大图像宽度 |
| | |
| | | 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]))) |