feat: add cloud plate sdk
| | |
| | | } |
| | | return |
| | | } |
| | | |
| | | // CPlateIDCloudPosArrayToGoArray convert CPlateIDCloudResult array to go |
| | | func CPlateIDCloudPosArrayToGoArray(cArray unsafe.Pointer, count int) (goArray []CPlateIDCloudResult) { |
| | | p := uintptr(cArray) |
| | | |
| | | for i := 0; i < count; i++ { |
| | | j := *(*CPlateIDCloudResult)(unsafe.Pointer(p)) |
| | | |
| | | goArray = append(goArray, j) |
| | | |
| | | p += unsafe.Sizeof(j) |
| | | } |
| | | return |
| | | } |
| | |
| | | return init_plate_id_detector(config, soPath); |
| | | } |
| | | |
| | | cPlateIDResult* c_api_plate_id_detect(int *plateIDCount, uchar *data, const int w, const int h) { |
| | | cPlateIDResult* c_api_plate_id_detect(int *plateIDCount, uchar *data, const int w, const int h, const cRECT *rcDetect) { |
| | | const cIMAGE img{data, w, h, 3}; |
| | | return plate_id_detect(plateIDCount, &img); |
| | | return plate_id_detect(plateIDCount, &img, rcDetect); |
| | | } |
| | | |
| | | int c_api_plate_id_free() { |
| | | return uninit_plate_id_detector(); |
| | | } |
| | | |
| | | // plateid cloud sdk api |
| | | int c_api_plate_id_cloud_init(const cPlateIDCloudSDKCfg *config, char *soPath, char *modelPath) { |
| | | return init_plate_id_cloud_sdk_detector(config, soPath, modelPath); |
| | | } |
| | | |
| | | cPlateIDCloudSDKResult* c_api_plate_id_cloud_detect(int *plateIDCount, uchar *data, const int w, const int h, const cRECT *rcDetect) { |
| | | const cIMAGE img{data, w, h, 3}; |
| | | return plate_id_cloud_sdk_detect(plateIDCount, &img, rcDetect); |
| | | } |
| | | |
| | | void c_api_plate_id_cloud_free() { |
| | | uninit_plate_id_cloud_sdk_detector(); |
| | | } |
| | |
| | | |
| | | // plateid api |
| | | int c_api_plate_id_init(const cPlateIDCfg *config, char *soPath); |
| | | cPlateIDResult* c_api_plate_id_detect(int *plateIDCount, uchar*data, const int w, const int h); |
| | | cPlateIDResult* c_api_plate_id_detect(int *plateIDCount, uchar*data, const int w, const int h, const cRECT *rcDetect); |
| | | int c_api_plate_id_free(); |
| | | |
| | | // plateid cloud sdk |
| | | int c_api_plate_id_cloud_init(const cPlateIDCloudSDKCfg *config, char *soPath, char *modelPath); |
| | | cPlateIDCloudSDKResult* c_api_plate_id_cloud_detect(int *plateIDCount, uchar *data, const int w, const int h, const cRECT *rcDetect); |
| | | void c_api_plate_id_cloud_free(); |
| | | |
| | | #ifdef __cplusplus |
| | | } |
| | | #endif |
| | |
| | | unsigned char bOnlyLocation; // 只定位车牌开启 |
| | | }cPlateIDCfg; |
| | | |
| | | typedef struct _cPlateIDResult |
| | | { |
| | | typedef struct _cPlateIDResult { |
| | | char license[16]; // 车牌字符串 |
| | | char color[8]; // 车牌颜色 |
| | | |
| | |
| | | unsigned short nCarModelConfidence; // 车型可信度 |
| | | }cPlateIDResult; |
| | | |
| | | typedef struct _cPlateIDCloudSDKCfg { |
| | | int iImageMode; //0:为帧模式 1:为场模式 |
| | | int iRecMode; //识别模式,0:单张图片识别,1:视频检测+识别,2:视频多帧融合识别(注:1模式比2模式快,但识别率和捕获率比2低) |
| | | |
| | | int iMinPlateWidth; //识别最小车牌宽度 |
| | | int iMaxPlateWidth; //识别最大车牌宽度 |
| | | |
| | | int iImageWidth; //图片宽度 |
| | | int iImageHeight; //图片高度 |
| | | |
| | | int iMinHorAngle; |
| | | int iMaxHorAngle; //水平矫正角度范围,支持最大角度为[-30°,30°] |
| | | int iMinVerAngle; |
| | | int iMaxVerAngle; //垂直矫正角度范围,支持最大角度为[-30°,30°] |
| | | |
| | | //此些项针对车型识别有用,其余无用 |
| | | float fExpLeftRightR; //车脸左右扩充(车牌的宽度)倍数 参考值为1.6 |
| | | float fExpTopR; //车脸上部扩充(车牌的高度)倍数 参考值为6.0 |
| | | float fExpBottomR; //车脸下部扩充(车牌的高度)倍数 参考值为1.5 |
| | | }cPlateIDCloudSDKCfg; |
| | | |
| | | typedef struct _cPlateIDCloudSDKResult { |
| | | char number[20]; //识别结果 |
| | | cRECT PlateRect; //车牌位置 |
| | | int x[4]; |
| | | int y[4]; |
| | | int iConfidence; //车牌置信度 |
| | | int ePlateType; //车牌类型 |
| | | int iMoveDir; //车辆运动方向 0:朝近运动,1:朝远运动,-1:未知 |
| | | int eVColor1; //车身主颜色 |
| | | int eVColor2; //车身次颜色 |
| | | int eVehicleBright; //车辆深浅色 |
| | | unsigned char *pResultBits; //视频识别模式中抓拍的图片,视频模式识别下有效,需要开辟 |
| | | |
| | | int iFramNo; //视频模式下帧号 |
| | | int sTime[7]; //视频识别模式中抓拍此张图的时间 |
| | | |
| | | //针对车脸识别应用此项,其余无用 |
| | | unsigned char *pVehicleFaceImage; //对应的车脸的图片,需要提前开辟内存,开辟个最大内存就可以,宽高可以都为1000 |
| | | int iVehicleFaceWidth; //车脸宽度 |
| | | int iVehicleFaceHeight; //车脸高度 |
| | | int iGrayFaceFlag; //车脸是否为灰度图 |
| | | |
| | | cRECT charLocation[20]; //车牌字符的位置(基于大图) |
| | | int charConfidence[20]; //字符识别置信度 |
| | | int iCharNum; //车牌字符数目 |
| | | }cPlateIDCloudSDKResult; |
| | | |
| | | #endif |
| | |
| | | |
| | | #include "buz/yolo/detector.cpp" |
| | | |
| | | #include "buz/plate/detector.cpp" |
| | | #include "buz/plate/eparking/detector.cpp" |
| | | #include "buz/plate/cloud/detector.cpp" |
| | | |
| | | #endif |
New file |
| | |
| | | #include "detector.h" |
| | | |
| | | #include <stdio.h> |
| | | #include <stdlib.h> |
| | | #include "LPRecognition.h" |
| | | |
| | | #include "csdk_struct.h" |
| | | |
| | | namespace csdk_wrap |
| | | { |
| | | static void* pInstance; |
| | | static LPR_RecParma RecParam; |
| | | |
| | | void init_plate_id_cloud_sdk_config(const cPlateIDCloudSDKCfg *params); |
| | | |
| | | int init_plate_id_cloud_sdk_detector(const cPlateIDCloudSDKCfg *params, char *keyPath, char *modelPath) { |
| | | // 读取授权 |
| | | int iInitFlag = LPR_ThreadInit(keyPath); |
| | | if(iInitFlag != LPR_OK) |
| | | { |
| | | return iInitFlag; |
| | | } |
| | | |
| | | // 初始化配置参数 |
| | | init_plate_id_cloud_sdk_config(params); |
| | | |
| | | // 设置Licence Manager运行路径 |
| | | pInstance = LPR_Cloud_Init(RecParam, modelPath); |
| | | |
| | | return pInstance == NULL ? 1 : 0; |
| | | } |
| | | |
| | | void init_plate_id_cloud_sdk_config(const cPlateIDCloudSDKCfg *params) { |
| | | RecParam.eImageType = E_LPR_BGR; |
| | | RecParam.iHorCorrect = 1; |
| | | RecParam.iVerCorrect = 1; |
| | | |
| | | RecParam.iPlateBornThr = 0; |
| | | RecParam.iPlateNumThr = 0; |
| | | RecParam.iPlateDeadThr = 0; |
| | | RecParam.iResultNum = 4; |
| | | |
| | | RecParam.iRecMode = params->iRecMode; |
| | | RecParam.iImageMode = params->iImageMode; |
| | | |
| | | RecParam.iMinPlateWidth = params->iMinPlateWidth; |
| | | RecParam.iMaxPlateWidth = params->iMaxPlateWidth; |
| | | |
| | | RecParam.iImageHeight = params->iImageHeight; |
| | | RecParam.iImageWidth = params->iImageWidth; |
| | | |
| | | RecParam.iMinHorAngle = params->iMinHorAngle; |
| | | RecParam.iMaxHorAngle = params->iMaxHorAngle; |
| | | RecParam.iMinVerAngle = params->iMinVerAngle; |
| | | RecParam.iMaxVerAngle = params->iMaxVerAngle; |
| | | |
| | | RecParam.fExpLeftRightR = params->fExpLeftRightR; |
| | | RecParam.fExpTopR = params->fExpTopR; |
| | | RecParam.fExpBottomR = params->fExpBottomR; |
| | | } |
| | | |
| | | cPlateIDCloudSDKResult* plate_id_cloud_sdk_detect(int *plateIDCount, const cIMAGE *img, const cRECT *rect) { |
| | | if (!img) { |
| | | return NULL; |
| | | } |
| | | |
| | | cPlateIDCloudSDKResult *ppos = NULL; |
| | | |
| | | ::LPR_Result pLprResult[20]; |
| | | memset(&pLprResult, 0, sizeof(pLprResult)); |
| | | |
| | | // 设置识别区域 |
| | | ::LPR_Rect rcDetect = {rect->left, rect->top, rect->right, rect->bottom}; |
| | | |
| | | int iVehicleNum = LPR_Cloud_RecImage((BYTE*)(img->data), img->width, img->height, pLprResult, &rcDetect, pInstance); |
| | | |
| | | if (iVehicleNum > 0){ |
| | | ppos = (cPlateIDCloudSDKResult*)malloc(iVehicleNum * sizeof(cPlateIDCloudSDKResult)); |
| | | *plateIDCount = iVehicleNum; |
| | | memcpy(ppos, pLprResult, sizeof(LPR_Result) * iVehicleNum); |
| | | } |
| | | return ppos; |
| | | } |
| | | |
| | | void uninit_plate_id_cloud_sdk_detector() { |
| | | LPR_Cloud_Uninit(pInstance); |
| | | } |
| | | |
| | | } // csdk_wrap |
New file |
| | |
| | | #ifndef _c_wrapper_plate_detector_hpp_ |
| | | #define _c_wrapper_plate_detector_hpp_ |
| | | |
| | | #include "../../base.hpp" |
| | | |
| | | struct _cPlateIDCloudSDKCfg; |
| | | struct _cPlateIDCloudSDKResult; |
| | | struct _cIMAGE; |
| | | struct _cRECT; |
| | | |
| | | namespace csdk_wrap{ |
| | | int init_plate_id_cloud_sdk_detector(const cPlateIDCloudSDKCfg *params, char *keyPath, char *modelPath); |
| | | cPlateIDCloudSDKResult* plate_id_cloud_sdk_detect(int *plateIDCount, const cIMAGE *img, const cRECT *rect); |
| | | void uninit_plate_id_cloud_sdk_detector(); |
| | | } |
| | | |
| | | #endif |
File was renamed from csrc/buz/plate/detector.cpp |
| | |
| | | } |
| | | } |
| | | |
| | | cPlateIDResult* plate_id_detect(int *plateIDCount, const cIMAGE *img) { |
| | | cPlateIDResult* plate_id_detect(int *plateIDCount, const cIMAGE *img, const cRECT *rect) { |
| | | if (!img) { |
| | | return NULL; |
| | | } |
| | |
| | | memset(&result[0], 0, sizeof(result)); |
| | | |
| | | // 设置识别区域 |
| | | ::TH_RECT rcDetect; |
| | | rcDetect.top = 0; |
| | | rcDetect.right = img->width; |
| | | rcDetect.bottom = img->height; |
| | | rcDetect.left = 0; |
| | | ::TH_RECT rcDetect = {rect->left, rect->top, rect->right, rect->bottom}; |
| | | |
| | | int ret = TH_RecogImage((BYTE*)(img->data), img->width, img->height, result, &nResultNum, &rcDetect, &config); |
| | | // printf("TH_RecogImage ret = %d\n", ret); |
File was renamed from csrc/buz/plate/detector.h |
| | |
| | | #ifndef _c_wrapper_plate_detector_hpp_ |
| | | #define _c_wrapper_plate_detector_hpp_ |
| | | |
| | | #include "../base.hpp" |
| | | #include "../../base.hpp" |
| | | |
| | | struct _cPlateIDCfg; |
| | | struct _cPlateIDResult; |
| | | struct _cIMAGE; |
| | | struct _cRECT; |
| | | |
| | | namespace csdk_wrap{ |
| | | int init_plate_id_detector(const cPlateIDCfg *params, char *soPath); |
| | | cPlateIDResult* plate_id_detect(int *plateIDCount, const cIMAGE *img); |
| | | cPlateIDResult* plate_id_detect(int *plateIDCount, const cIMAGE *img, const cRECT *rect); |
| | | int uninit_plate_id_detector(); |
| | | } |
| | | |
| | |
| | | NCarModel [2]uint8 // 车辆类型 |
| | | NCarModelConfidence [2]uint8 // 车型可信度 |
| | | } |
| | | |
| | | type CPlateIDCloudCfg struct { |
| | | NImageMode int32 //0:为帧模式 1:为场模式 |
| | | NRecMode int32 //识别模式,0:单张图片识别,1:视频检测+识别,2:视频多帧融合识别(注:1模式比2模式快,但识别率和捕获率比2低) |
| | | |
| | | NMinPlateWidth int32 //识别最小车牌宽度 |
| | | NMaxPlateWidth int32 //识别最大车牌宽度 |
| | | |
| | | NImageWidth int32 //图片宽度 |
| | | NImageHeight int32 //图片高度 |
| | | |
| | | NMinHorAngle int32 |
| | | NMaxHorAngle int32 //水平矫正角度范围,支持最大角度为[-30°,30°] |
| | | NMinVerAngle int32 |
| | | NMaxVerAngle int32 //垂直矫正角度范围,支持最大角度为[-30°,30°] |
| | | |
| | | //此些项针对车型识别有用,其余无用 |
| | | FExpLeftRightR float32 //车脸左右扩充(车牌的宽度)倍数 参考值为1.6 |
| | | FExpTopR float32 //车脸上部扩充(车牌的高度)倍数 参考值为6.0 |
| | | FExpBottomR float32 //车脸下部扩充(车牌的高度)倍数 参考值为1.5 |
| | | } |
| | | |
| | | type CPlateIDCloudResult struct { |
| | | License [20]uint8 //识别结果 |
| | | RcLocation CRECT //车牌位置 |
| | | X [4]int32 |
| | | Y [4]int32 |
| | | NConfidence int32 //车牌置信度 |
| | | NType int32 //车牌类型 |
| | | NDirection int32 //车辆运动方向 0:朝近运动,1:朝远运动,-1:未知 |
| | | NCarColor int32 //车身主颜色 |
| | | NCarColor1 int32 //车身次颜色 |
| | | NBright int32 //车辆深浅色 |
| | | PResultBits int32 //视频识别模式中抓拍的图片,视频模式识别下有效,需要开辟 |
| | | |
| | | FramNo int32 //视频模式下帧号 |
| | | Time [7]int32 //视频识别模式中抓拍此张图的时间 |
| | | |
| | | //针对车脸识别应用此项,其余无用 |
| | | FaceImage int32 //对应的车脸的图片,需要提前开辟内存,开辟个最大内存就可以,宽高可以都为1000 |
| | | FaceWidth int32 //车脸宽度 |
| | | FaceHeight int32 //车脸高度 |
| | | GrayFaceFlag int32 //车脸是否为灰度图 |
| | | |
| | | CharLocation [20]CRECT //车牌字符的位置(基于大图) |
| | | CharConfidence [20]CRECT //字符识别置信度 |
| | | CharNum int32 //车牌字符数目 |
| | | } |
| | |
| | | package gosdk |
| | | |
| | | /* |
| | | #cgo CFLAGS: -I. -I./sdk/face/include -I./sdk/darknet/include -I/usr/local/cuda/include -I./sdk/plate/include -w -g |
| | | #cgo CXXFLAGS: -I. -I./sdk/face/include -I./sdk/darknet/include -I/usr/local/cuda/include -I./sdk/plate/include -w -g -std=c++11 |
| | | #cgo LDFLAGS: -L/usr/local/cuda/lib64 -L${SRCDIR}/sdk/face/lib/gpu -L${SRCDIR}/sdk/darknet/lib -L${SRCDIR}/sdk/plate/lib |
| | | #cgo LDFLAGS: -Wl,-rpath,${SRCDIR}/sdk/face/lib/gpu:${SRCDIR}/sdk/darknet/lib |
| | | #cgo LDFLAGS: -ldarknet -lTHFaceImage -lTHFeature -lTHFaceProperty -lTHFaceTracking -lcudart -lcublas -lcurand -lrt -ldl -lpthread -lthplateid |
| | | #cgo CFLAGS: -I. -I./sdk/face/include -I./sdk/darknet/include -I/usr/local/cuda/include -w -g |
| | | #cgo CFLAGS: -I./sdk/plate/eparking/include -I./sdk/plate/cloud/include |
| | | #cgo CXXFLAGS: -I. -I./sdk/face/include -I./sdk/darknet/include -I/usr/local/cuda/include -w -g -std=c++11 |
| | | #cgo CXXFLAGS: -I./sdk/plate/eparking/include -I./sdk/plate/cloud/include |
| | | #cgo LDFLAGS: -L/usr/local/cuda/lib64 -L${SRCDIR}/sdk/face/lib/gpu -L${SRCDIR}/sdk/darknet/lib |
| | | #cgo LDFLAGS: -L${SRCDIR}/sdk/plate/eparking/lib -L${SRCDIR}/sdk/plate/cloud/lib |
| | | #cgo LDFLAGS: -Wl,-rpath,${SRCDIR}/sdk/face/lib/gpu:${SRCDIR}/sdk/darknet/lib:${SRCDIR}/sdk/plate/cloud/lib |
| | | #cgo LDFLAGS: -ldarknet -lTHFaceImage -lTHFeature -lTHFaceProperty -lTHFaceTracking -lcudart -lcublas -lcurand -lrt -ldl -lpthread -lthplateid -lLPRecognition |
| | | #include <stdlib.h> |
| | | #include "csdk.h" |
| | | */ |
| | |
| | | MaxImageWidth: 4096, |
| | | MaxImageHeight: 2160, |
| | | IsFieldImage: 0, |
| | | MovingImage: 1, |
| | | MovingImage: 0, |
| | | OrderOpt: 0, |
| | | LeanCorrection: 1, |
| | | ImproveSpeed: 0, |
| | |
| | | TwoRowArmy: 1, |
| | | Tractor: 1, |
| | | Embassy: 1, |
| | | ChangNei: 1, |
| | | MinHang: 1, |
| | | Consulate: 1, |
| | | ChangNei: 0, |
| | | MinHang: 0, |
| | | Consulate: 10, |
| | | NewEnergy: 1, |
| | | OnlyTwoRowYellow: 0, |
| | | OnlyLocation: 0, |
| | |
| | | } |
| | | |
| | | // PlateIDDetect plateid detect |
| | | func PlateIDDetect(img SDKImage) []CPlateIDResult { |
| | | func PlateIDDetect(img SDKImage, rcDetect *CRECT) []CPlateIDResult { |
| | | data := img.Data |
| | | w := img.Width |
| | | h := img.Height |
| | | |
| | | var count C.int |
| | | cppos := C.c_api_plate_id_detect(&count, (*C.uchar)(unsafe.Pointer(&data[0])), C.int(w), C.int(h)) |
| | | cppos := C.c_api_plate_id_detect(&count, (*C.uchar)(unsafe.Pointer(&data[0])), C.int(w), C.int(h), (*C.cRECT)(unsafe.Pointer(rcDetect))) |
| | | if cppos != nil { |
| | | defer C.free(unsafe.Pointer(cppos)) |
| | | return CPlateIDPosArrayToGoArray(unsafe.Pointer(cppos), int(count)) |
| | |
| | | |
| | | func FreePlateIdDetector() int{ |
| | | return int(C.c_api_plate_id_free()) |
| | | } |
| | | |
| | | |
| | | func DefaultPlateIDCloudSDKConfig() *CPlateIDCloudCfg{ |
| | | return &CPlateIDCloudCfg{ |
| | | NImageMode: 0, |
| | | NRecMode: 0, |
| | | |
| | | NMinPlateWidth: 60, |
| | | NMaxPlateWidth: 400, |
| | | |
| | | NImageWidth: 4096, |
| | | NImageHeight: 2160, |
| | | |
| | | NMinHorAngle: -15, |
| | | NMaxHorAngle: 15, |
| | | NMinVerAngle: -30, |
| | | NMaxVerAngle: 30, |
| | | |
| | | FExpLeftRightR: 1.6, |
| | | FExpTopR: 6.0, |
| | | FExpBottomR: 1.5, |
| | | } |
| | | } |
| | | |
| | | // InitPlateIDCloudSDKDetector init plateid detector |
| | | func InitPlateIDCloudSDKDetector(config *CPlateIDCloudCfg, keyPath, modelPath[]byte) int { |
| | | return int(C.c_api_plate_id_cloud_init((*C.cPlateIDCloudSDKCfg)(unsafe.Pointer(config)), (*C.char)(unsafe.Pointer(&keyPath[0])), (*C.char)(unsafe.Pointer(&modelPath[0])))) |
| | | } |
| | | |
| | | // PlateIDCloudSDKDetect plateid detect |
| | | func PlateIDCloudSDKDetect(img SDKImage, rcDetect *CRECT) []CPlateIDCloudResult { |
| | | data := img.Data |
| | | w := img.Width |
| | | h := img.Height |
| | | |
| | | var count C.int |
| | | cppos := C.c_api_plate_id_cloud_detect(&count, (*C.uchar)(unsafe.Pointer(&data[0])), C.int(w), C.int(h), (*C.cRECT)(unsafe.Pointer(rcDetect))) |
| | | if cppos != nil { |
| | | defer C.free(unsafe.Pointer(cppos)) |
| | | return CPlateIDCloudPosArrayToGoArray(unsafe.Pointer(cppos), int(count)) |
| | | } |
| | | return nil |
| | | } |
| | | |
| | | // FreePlateIDCloudSDKDetector free |
| | | func FreePlateIDCloudSDKDetector() { |
| | | C.c_api_plate_id_free() |
| | | } |
New file |
| | |
| | | #ifndef _LPRECOGNITION_H_ |
| | | #define _LPRECOGNITION_H_ |
| | | |
| | | |
| | | #define LPR_API extern "C" __attribute__((visibility("default"))) |
| | | |
| | | #define LPR_OK 0 //初始化正确 |
| | | #define LPR_KEY_ERROR -1 //未找到加密狗 |
| | | |
| | | |
| | | |
| | | //车牌类型 |
| | | typedef enum |
| | | { |
| | | E_PT_NOTKNOWN, //未知类型 |
| | | E_PT_NORMAL_BLUE, //普通蓝牌 |
| | | E_PT_NORMAL_BLACK, //普通黑牌 |
| | | E_PT_NORMAL_YELLOW,//普通单层黄牌 |
| | | E_PT_DOUBLE_YELLOW,//双层黄牌 |
| | | E_PT_POLICE, //白色警牌 |
| | | E_PT_WJ, //白色武警 |
| | | E_PT_ARMY, //白色军牌 |
| | | E_PT_GANG, //港牌 |
| | | E_PT_NONG, //农用车牌----拖拉机 |
| | | E_PT_ENERGY, //新能源车----绿色 |
| | | E_PT_ENERGY_Y, //新能源车----黄色 |
| | | E_PT_INDIVI, //个性化车牌 |
| | | E_PT_EMBASSY, //使馆车 |
| | | E_PT_YINGJI, //应急车牌 |
| | | }LPR_LPlateType; |
| | | |
| | | //车身颜色 |
| | | typedef enum |
| | | { |
| | | E_VC_NOTKNOWN, //δ֪ |
| | | E_VC_WHITE, //白 |
| | | E_VC_SILVER, //灰 |
| | | E_VC_YELLOW, //黄 |
| | | E_VC_RED, //红 |
| | | E_VC_GREEN, //绿 |
| | | E_VC_BLUE, //蓝 |
| | | E_VC_BLACK, //黑 |
| | | }LPR_LVehicleColor; |
| | | |
| | | typedef enum |
| | | { |
| | | E_VC_DARK, //深色 |
| | | E_VC_LIGHT, //dzɫ |
| | | }LPR_LVehicleBright; |
| | | |
| | | typedef enum |
| | | { |
| | | E_LPR_RGB, |
| | | E_LPR_BGR, |
| | | }LPR_ImageType; |
| | | |
| | | typedef struct |
| | | { |
| | | int iLeft; |
| | | int iTop; |
| | | int iRight; |
| | | int iBottom; |
| | | }LPR_Rect; |
| | | |
| | | typedef struct |
| | | { |
| | | LPR_ImageType eImageType; //图像类型 |
| | | int iImageMode; //0:为帧模式 1:为场模式 |
| | | int iRecMode; //识别模式,0:单张图片识别,1:视频检测+识别,2:视频多帧融合识别(注:1模式比2模式快,但识别率和捕获率比2低) |
| | | |
| | | int iResultNum; //输出结果参数,最多支持输出4个结果 |
| | | int iMinPlateWidth; //识别最小车牌宽度 |
| | | int iMaxPlateWidth; //识别最大车牌宽度 |
| | | |
| | | /******************矫正参数******************/ |
| | | int iHorCorrect; //是否做水平倾斜矫正,若不做水平倾斜矫正,则算法内部不会做垂直错切矫正 |
| | | int iVerCorrect; //是否做垂直错切矫正 |
| | | |
| | | int iMinHorAngle; |
| | | int iMaxHorAngle;//水平矫正角度范围,支持最大角度为[-30°,30°] |
| | | int iMinVerAngle; |
| | | int iMaxVerAngle;//垂直矫正角度范围,支持最大角度为[-30°,30°] |
| | | |
| | | int iPlateBornThr; //车牌输出帧数阈值:既车牌出现大于此帧数,则输出结果 |
| | | int iPlateNumThr; //车牌出现次数阈值:既车牌出现小于此数目,则不输出 |
| | | int iPlateDeadThr; //车牌消失帧数:针对视频应用,车牌消失大于此阈值,进行输出 |
| | | |
| | | int iImageWidth; //图片宽度 |
| | | int iImageHeight; //图片高度 |
| | | |
| | | char pLocalChinese[3]; //本地汉字字符,如果此字符设置为空或者31个省份之外的字,则不使用首汉字 |
| | | |
| | | //此些项针对车型识别有用,其余无用 |
| | | float fExpLeftRightR; //车脸左右扩充(车牌的宽度)倍数 参考值为1.6 |
| | | float fExpTopR; //车脸上部扩充(车牌的高度)倍数 参考值为6.0 |
| | | float fExpBottomR; //车脸下部扩充(车牌的高度)倍数 参考值为1.5 |
| | | }LPR_RecParma; |
| | | |
| | | typedef struct |
| | | { |
| | | int iYear; |
| | | int iMonth; |
| | | int iDay; |
| | | int iHour; |
| | | int iMinute; |
| | | int iSecond; |
| | | int iMilliseconds; |
| | | }LPR_Time; |
| | | |
| | | typedef struct |
| | | { |
| | | int iYear; |
| | | int iMonth; |
| | | int iDay; |
| | | }LPR_DATE; |
| | | typedef struct |
| | | { |
| | | char number[20]; //识别结果 |
| | | LPR_Rect PlateRect; //车牌位置 |
| | | int x[4]; |
| | | int y[4]; |
| | | int iConfidence; //车牌置信度 |
| | | LPR_LPlateType ePlateType; //车牌类型 |
| | | int iMoveDir; //车辆运动方向 0:朝近运动,1:朝远运动,-1:未知 |
| | | LPR_LVehicleColor eVColor1; //车身主颜色 |
| | | LPR_LVehicleColor eVColor2; //车身次颜色 |
| | | LPR_LVehicleBright eVehicleBright; //车辆深浅色 |
| | | unsigned char *pResultBits; //视频识别模式中抓拍的图片,视频模式识别下有效,需要开辟 |
| | | |
| | | int iFramNo; //视频模式下帧号 |
| | | LPR_Time sTime; //视频识别模式中抓拍此张图的时间 |
| | | |
| | | //针对车脸识别应用此项,其余无用 |
| | | unsigned char *pVehicleFaceImage; //对应的车脸的图片,需要提前开辟内存,开辟个最大内存就可以,宽高可以都为1000 |
| | | int iVehicleFaceWidth; //车脸宽度 |
| | | int iVehicleFaceHeight; //车脸高度 |
| | | int iGrayFaceFlag; //车脸是否为灰度图 |
| | | |
| | | LPR_Rect charLocation[20]; //车牌字符的位置(基于大图) |
| | | int charConfidence[20]; //字符识别置信度 |
| | | int iCharNum; //车牌字符数目 |
| | | }LPR_Result; |
| | | |
| | | LPR_API int LPR_ThreadInit(char* fullkeypath); |
| | | |
| | | LPR_API void LPR_SetRecThr(void* pInstance,int iThr); //设置车牌识别阈值:0~5,0最宽松,5最严格,默认为3 |
| | | |
| | | LPR_API void* LPR_Init(LPR_RecParma RecParma); //初始化,每个线程都必须调用一次 |
| | | |
| | | LPR_API int LPR_RecImage(unsigned char *pBits, int iWidth, int iHeight ,LPR_Result* pLprResult,LPR_Rect* recROI,void* pInstance);//识别 |
| | | |
| | | LPR_API int LPR_RecImage_mobile(unsigned char *pBits, int iWidth, int iHeight ,LPR_Result* pLprResult,LPR_Rect* recROI,void* pInstance);//识别 |
| | | |
| | | LPR_API void LPR_Uninit(void* pInstance); //释放 |
| | | |
| | | |
| | | |
| | | //云端识别接口 |
| | | LPR_API void* LPR_Cloud_Init(LPR_RecParma RecParma, char* fullModel); |
| | | |
| | | LPR_API int LPR_Cloud_RecImage(unsigned char *pBits, int iWidth, int iHeight ,LPR_Result* pLprResult,LPR_Rect* recROI,void* pInstance);//识别 |
| | | |
| | | LPR_API void LPR_Cloud_Uninit(void* pInstance); |
| | | |
| | | |
| | | |
| | | #endif |