VehicleAnalysis.h 1.53 KB
#ifndef __AI_ENGINE_MODULE_VEHICLE_ANALYSIS_H__
#define __AI_ENGINE_MODULE_VEHICLE_ANALYSIS_H__

#include "include.h"

#include "vehicle_analysis.h"

#include "../village_inc.h"

struct DriverInfo {
    sy_rect driver_rect;
    float driver_prob;
    int driver_color;
};

struct VehicleAnalysisParam {
    int devId;
    std::string sdk_root;
    int max_batch_size;
};

struct VehicleAnalysisResult{
    int shot_type;
    sy_rect vehicle_rect;
    string vehicle_type;

    sy_rect plate_rect;//车牌检测坐标
	float plate_det_score;//车牌检测置信度
    string plate_num;
    string character_prob;
	float plate_num_score;//识别置信度
	int plate_type;	//车牌类型:0-单排蓝色 1-单排黄色 2-单排白色 3-单排黑色 4-双排黄色 5-双排白色 6-新能源黄绿色 7-新能源白绿色
	int special_type;						//常规车牌、临时车牌、低速车牌。0-common,1-temporary_license_plate,2-low_speed_license_plate.

    vector<DriverInfo> vec_drivers;     // 副驾也被认为是司机

    int motor_helmeted;
    int motor_manned{0};
};

class VehicleAnalysis
{
private:
    /* data */
public:
    VehicleAnalysis(/* args */);
    ~VehicleAnalysis();

    int init(VehicleAnalysisParam tParam);

    vector<AnalysisResult> detect(vector<sy_img> vec_img);

private:
    void release();

    vector<AnalysisResult> va_result2AnalysisResult(va_result* result, int batchsize);

private:
    void* m_handle{nullptr};
    
    float m_threshold;
	int m_max_batchsize{1};
};


#endif      // __AI_ENGINE_MODULE_VEHICLE_ANALYSIS_H__