Commit e2a56ab342476fd296ec16112f3514dcfb9b2a72
1 parent
06edc90d
置信度添加
Showing
9 changed files
with
89 additions
and
30 deletions
src/left_over/ConExtraction.cpp
... | ... | @@ -55,6 +55,7 @@ CConExtraction::~CConExtraction() |
55 | 55 | *******************************************************************************/ |
56 | 56 | vector<CContour> CConExtraction::ExtractContours( |
57 | 57 | unsigned char *pSrcImage,// the point to the source imagedata |
58 | +float *MaskImgCfd, | |
58 | 59 | const int &width, // the pixel number of each coloum |
59 | 60 | const int &height, // the pixel number of each row(ÁÐ) |
60 | 61 | const int &step // the byte number of each colum |
... | ... | @@ -124,7 +125,7 @@ const int &step // the byte number of each colum |
124 | 125 | origin.x = x; |
125 | 126 | origin.y = y; |
126 | 127 | |
127 | - m_contour = FetchContour(img + step * y + x, step, origin); | |
128 | + m_contour = FetchContour(img + step * y + x, MaskImgCfd, step, origin); | |
128 | 129 | |
129 | 130 | // for debug use |
130 | 131 | //m_contour.label=0; |
... | ... | @@ -240,6 +241,7 @@ const int &step |
240 | 241 | *******************************************************************************/ |
241 | 242 | CContour CConExtraction::FetchContour( |
242 | 243 | unsigned char *pImage, // the pointer to the starting pixel position value of the external contour |
244 | +float * cfg, | |
243 | 245 | const int &step, // the byte number of each colum |
244 | 246 | iCPoint &pt // the starting point position of the external contour |
245 | 247 | ) |
... | ... | @@ -339,7 +341,25 @@ iCPoint &pt // the starting point position of the external contour |
339 | 341 | m_Contour.bottom = m_rect.bottom; |
340 | 342 | m_Contour.xCenter = (m_Contour.left + m_Contour.right) / 2; |
341 | 343 | m_Contour.yCenter = (m_Contour.top + m_Contour.bottom) / 2; |
342 | - m_Contour.label = true; | |
344 | + int count = 0; | |
345 | + double totalCfd = 0; | |
346 | + for (auto item : m_Pointvec) | |
347 | + { | |
348 | + if (cfg[item.y * step + item.x] > 0.001) | |
349 | + { | |
350 | + totalCfd += cfg[item.y * step + item.x]; | |
351 | + ++count; | |
352 | + } | |
353 | + } | |
354 | + if (count) | |
355 | + { | |
356 | + m_Contour.cfd = totalCfd / count; | |
357 | + m_Contour.label = true; | |
358 | + } | |
359 | + else | |
360 | + { | |
361 | + m_Contour.label = false; | |
362 | + } | |
343 | 363 | } |
344 | 364 | else |
345 | 365 | { |
... | ... | @@ -349,6 +369,7 @@ iCPoint &pt // the starting point position of the external contour |
349 | 369 | m_Contour.bottom = 0; |
350 | 370 | m_Contour.xCenter = 0; |
351 | 371 | m_Contour.yCenter = 0; |
372 | + m_Contour.cfd = 0; | |
352 | 373 | m_Contour.label = false; |
353 | 374 | } |
354 | 375 | } |
... | ... | @@ -360,6 +381,7 @@ iCPoint &pt // the starting point position of the external contour |
360 | 381 | m_Contour.bottom = 0; |
361 | 382 | m_Contour.xCenter = 0; |
362 | 383 | m_Contour.yCenter = 0; |
384 | + m_Contour.cfd = 0; | |
363 | 385 | m_Contour.label = false; |
364 | 386 | } |
365 | 387 | ... | ... |
src/left_over/ConExtraction.h
... | ... | @@ -35,6 +35,7 @@ typedef struct CContour |
35 | 35 | int bottom; |
36 | 36 | int xCenter; |
37 | 37 | int yCenter; |
38 | + float cfd; | |
38 | 39 | bool label; |
39 | 40 | }CContour; // the detected target external contour of the current frame |
40 | 41 | |
... | ... | @@ -63,7 +64,7 @@ public: |
63 | 64 | virtual ~CConExtraction(); |
64 | 65 | |
65 | 66 | public: |
66 | - vector<CContour> ExtractContours (unsigned char *pSrcImage, const int &width, const int &height, const int &step); | |
67 | + vector<CContour> ExtractContours (unsigned char *pSrcImage, float *MaskImgCfd, const int &width, const int &height, const int &step); | |
67 | 68 | |
68 | 69 | //vector<CForegroundTarget> DetectTarget(unsigned char *pSrcImage, const int &width, const int &height, const int &step); |
69 | 70 | |
... | ... | @@ -77,7 +78,7 @@ private: |
77 | 78 | iRect m_rect; //the rectangle of the contour |
78 | 79 | |
79 | 80 | private: |
80 | - CContour FetchContour(unsigned char *pImage, const int &step, iCPoint &pt); | |
81 | + CContour FetchContour(unsigned char *pImage, float * cfg, const int &step, iCPoint &pt); | |
81 | 82 | |
82 | 83 | void BoundingRect(vector<iCPoint> Pointvec); //get the corresponding rectangle of a point set |
83 | 84 | ... | ... |
src/left_over/MSRegionSurveilance.h
... | ... | @@ -99,6 +99,7 @@ struct CForeground |
99 | 99 | { |
100 | 100 | CMRect m_rtConnect; |
101 | 101 | CMPoint m_ptCenter; |
102 | + float m_cfd; | |
102 | 103 | }; |
103 | 104 | |
104 | 105 | typedef struct CTarget |
... | ... | @@ -152,6 +153,7 @@ typedef struct CTarget |
152 | 153 | long nFrameCurr; // 记录当前逗留帧数 |
153 | 154 | int lastFrame; // 上次监测到逗留距离当前的帧数 |
154 | 155 | CMRect m_TarBox; |
156 | + float cfd; | |
155 | 157 | int dwGlobalID; |
156 | 158 | }CTarget; |
157 | 159 | |
... | ... | @@ -177,6 +179,7 @@ typedef struct MS_ObjectInfo { |
177 | 179 | MS_Trace trace; // 轨迹及报警状态 |
178 | 180 | int UniqueID; // 当前目标的特点ID |
179 | 181 | CMRect TarBox; // 目标外接矩形 |
182 | + float confidence; // 置信度 | |
180 | 183 | bool pbAlarmState[MAXROINUM]; // 对应区域是否报警 |
181 | 184 | int pbAlarmType[MAXROINUM]; // 对应区域是哪种报警 |
182 | 185 | }MS_ObjectInfo; |
... | ... | @@ -190,6 +193,7 @@ public: |
190 | 193 | int OBJECT_AREA_MAX; //默认最小过滤面积 by zl 20160304 |
191 | 194 | int stay_dis; |
192 | 195 | unsigned char* MaskImgData; |
196 | + float* MaskImgCfd; | |
193 | 197 | int gWinSize; |
194 | 198 | bool gfiltFlag; |
195 | 199 | ... | ... |
src/left_over/MSRegionSurveilanceCpu.cpp
... | ... | @@ -78,7 +78,7 @@ int IRegionSurveillanceCpu::rs_detect(const sy_img &img_data, region_info* regio |
78 | 78 | { |
79 | 79 | result->obj_infos[totalObjCount].curPos.x_ = ObjInfo[i].curPos.x+rect[k].left_; // 当前坐标 |
80 | 80 | result->obj_infos[totalObjCount].curPos.y_ = ObjInfo[i].curPos.y+rect[k].top_; // 当前坐标 |
81 | - | |
81 | + result->obj_infos[totalObjCount].confidence = ObjInfo[i].confidence; | |
82 | 82 | result->obj_infos[totalObjCount].trace.trace_num = ObjInfo[i].trace.nTraceNum; // 轨迹及报警状态 |
83 | 83 | //printf("nTraceNum = %d\n", ObjInfo[i].trace.nTraceNum); |
84 | 84 | for (int j = 0; j < MAXTRACENUM; ++j) |
... | ... | @@ -115,7 +115,7 @@ int IRegionSurveillanceCpu::rs_detect(const sy_img &img_data, region_info* regio |
115 | 115 | { |
116 | 116 | result->del_infos[totalDelCount].curPos.x_ = DelInfo[i].curPos.x + rect[k].left_; // 当前坐标 |
117 | 117 | result->del_infos[totalDelCount].curPos.y_ = DelInfo[i].curPos.y + rect[k].top_; // 当前坐标 |
118 | - | |
118 | + result->del_infos[totalDelCount].confidence = DelInfo[i].confidence; | |
119 | 119 | result->del_infos[totalDelCount].trace.trace_num = DelInfo[i].trace.nTraceNum; // 轨迹及报警状态 |
120 | 120 | //printf("del_infos nTraceNum = %d\n", DelInfo[i].trace.nTraceNum); |
121 | 121 | for (int j = 0; j < MAXTRACENUM; ++j) | ... | ... |
src/left_over/RegionSurveillanceProcess.h
... | ... | @@ -2,7 +2,9 @@ |
2 | 2 | #include "left_over_det.h" |
3 | 3 | #include <atomic> |
4 | 4 | #include "header.h" |
5 | +#ifndef _MSC_VER | |
5 | 6 | #include "checkAuthor.h" |
7 | +#endif | |
6 | 8 | #define DEVICE_GPU 10 |
7 | 9 | typedef struct rs_params |
8 | 10 | { |
... | ... | @@ -63,7 +65,9 @@ public: |
63 | 65 | bool init_flag = false; |
64 | 66 | sy_rect rect[MAXVERTEXNUM]; //有效区域 |
65 | 67 | unsigned char rect_num; //有效区域数量 |
68 | +#ifndef _MSC_VER | |
66 | 69 | CheckAuthor * auth = nullptr; |
70 | +#endif | |
67 | 71 | private: |
68 | 72 | //int mode; //运行模式0 cpu |
69 | 73 | //MS_RegionSurveillance MS1; | ... | ... |
src/left_over/left_over_det.h
... | ... | @@ -92,7 +92,9 @@ typedef struct rs_param |
92 | 92 | double scale; //缩小比例 |
93 | 93 | sy_rect rect[MAXVERTEXNUM]; //有效区域 |
94 | 94 | unsigned char rect_num; //有效区域数量 |
95 | +#ifndef _MSC_VER | |
95 | 96 | rs_auth_config auth; |
97 | +#endif | |
96 | 98 | rs_auth_type type; |
97 | 99 | }rs_param; |
98 | 100 | #endif |
... | ... | @@ -111,12 +113,13 @@ typedef struct ms_trace { |
111 | 113 | #ifndef __RS_INFO__ |
112 | 114 | #define __RS_INFO__ |
113 | 115 | typedef struct ms_object_info { |
114 | - sy_point curPos; // 当前坐标 | |
116 | + sy_point curPos; // 当前坐标 | |
115 | 117 | ms_trace trace; // 轨迹及报警状态 |
116 | 118 | int unique_id; // 当前目标的特点ID |
117 | - sy_rect tar_box; // 目标外接矩形 | |
118 | - bool pb_alarm_state[MAXROINUM]; // 对应区域是否报警 | |
119 | - int pb_alarm_type[MAXROINUM]; // 对应区域是哪种报警 | |
119 | + sy_rect tar_box; // 目标外接矩形 | |
120 | + float confidence; // 置信度 | |
121 | + bool pb_alarm_state[MAXROINUM]; // 对应区域是否报警 | |
122 | + int pb_alarm_type[MAXROINUM]; // 对应区域是哪种报警 | |
120 | 123 | }ms_object_info; |
121 | 124 | #endif |
122 | 125 | ... | ... |
src/left_over/ms_region_surveilance.cpp
... | ... | @@ -124,13 +124,18 @@ int rs_init(void **handle, rs_param param) |
124 | 124 | bool auth_type = false; |
125 | 125 | if(param.type == PRODUCT_ID) |
126 | 126 | { |
127 | +#ifndef _MSC_VER | |
127 | 128 | char uuid[36] = {}; |
128 | 129 | FILE *Uuid = fopen("/proc/sys/kernel/random/uuid", "r"); |
129 | 130 | fgets(uuid, 36, Uuid); |
130 | 131 | fclose(Uuid); |
132 | + | |
131 | 133 | regin->auth = new CheckAuthor; |
132 | 134 | regin->auth->Init(param.auth.url, param.auth.port, uuid, productSN, 1); |
133 | 135 | auth_type = regin->auth->GetAuthorStatus(); |
136 | +#else | |
137 | + auth_type = true; | |
138 | +#endif | |
134 | 139 | } |
135 | 140 | if (param.type == TIME) |
136 | 141 | { |
... | ... | @@ -237,11 +242,13 @@ int rs_process(void *handle, sy_img img_data, rs_result *result) |
237 | 242 | return -1; |
238 | 243 | } |
239 | 244 | RegionSurveillanceProcess* regin = (RegionSurveillanceProcess*)handle; |
245 | +#ifndef _MSC_VER | |
240 | 246 | if (regin->type == PRODUCT_ID && (regin->auth && 0 == regin->auth->GetAuthorStatus())) |
241 | 247 | { |
242 | 248 | printf("auth error \n"); |
243 | 249 | return -1; |
244 | 250 | } |
251 | +#endif | |
245 | 252 | region_info pRegionInfo; |
246 | 253 | pRegionInfo.alarm_info = 6; |
247 | 254 | pRegionInfo.frame_num = regin->frame_num; |
... | ... | @@ -383,11 +390,13 @@ void rs_release(void **handle) |
383 | 390 | printf("handle is NULL \n"); |
384 | 391 | return; |
385 | 392 | } |
393 | +#ifndef _MSC_VER | |
386 | 394 | if (regin->type == PRODUCT_ID && regin->auth) |
387 | 395 | { |
388 | 396 | regin->auth->Uninit(); |
389 | 397 | delete regin->auth; |
390 | 398 | } |
399 | +#endif | |
391 | 400 | delete regin; |
392 | 401 | regin = nullptr; |
393 | 402 | } | ... | ... |
src/left_over/svibe.cpp
... | ... | @@ -157,9 +157,11 @@ int RegionSurveillance::RSinit(int nWidth, int nHeight, int widthstep, unsigned |
157 | 157 | } |
158 | 158 | */ |
159 | 159 | |
160 | - MaskImgData = (unsigned char*) malloc(sizeof(unsigned char*) * GlobelWidth * GlobelHeight); | |
161 | - memset(MaskImgData, 0, sizeof(unsigned char*)* GlobelWidth * GlobelHeight); | |
160 | + MaskImgData = (unsigned char*) malloc(sizeof(unsigned char) * GlobelWidth * GlobelHeight); | |
161 | + memset(MaskImgData, 0, sizeof(unsigned char)* GlobelWidth * GlobelHeight); | |
162 | 162 | |
163 | + MaskImgCfd = (float *)malloc(sizeof(float) * GlobelWidth * GlobelHeight); | |
164 | + memset(MaskImgCfd, 0, sizeof(float)* GlobelWidth * GlobelHeight); | |
163 | 165 | if (!vbM) |
164 | 166 | { |
165 | 167 | // 初始化模型 |
... | ... | @@ -371,7 +373,7 @@ VibeModel_t* RegionSurveillance::VibeModelInitC3(uint8_t *image_data) |
371 | 373 | return vbM; |
372 | 374 | } |
373 | 375 | |
374 | -void RegionSurveillance::VibeModelUpdateC1(VibeModel_t *model, uint8_t *image, uint8_t *output) | |
376 | +void RegionSurveillance::VibeModelUpdateC1(VibeModel_t *model, uint8_t *image, uint8_t *output, float * confidence) | |
375 | 377 | { |
376 | 378 | int32_t x, y, xNG, yNG, count, index, dist, sampleOffset, imageOffset; |
377 | 379 | uint32_t rand; |
... | ... | @@ -402,7 +404,7 @@ void RegionSurveillance::VibeModelUpdateC1(VibeModel_t *model, uint8_t *image, u |
402 | 404 | if (count < model->nMatch) |
403 | 405 | { |
404 | 406 | output[imageOffset] = VBPARAM->DEFAULT_COLOR_FOREGROUND; |
405 | - | |
407 | + confidence[imageOffset] = 1.00 - ((float)count / (float)model->nMatch); | |
406 | 408 | if (g_frameCount < model->nSample) |
407 | 409 | { |
408 | 410 | rand = GetRand() % (model->nSample); |
... | ... | @@ -415,7 +417,7 @@ void RegionSurveillance::VibeModelUpdateC1(VibeModel_t *model, uint8_t *image, u |
415 | 417 | else |
416 | 418 | { |
417 | 419 | output[imageOffset] = VBPARAM->DEFAULT_COLOR_BACKGROUND; |
418 | - | |
420 | + confidence[imageOffset] = 0.00; | |
419 | 421 | if (g_frameCount < model->nSample) |
420 | 422 | { |
421 | 423 | rand = GetRand() % (model->nSample); |
... | ... | @@ -699,7 +701,7 @@ void RegionSurveillance::RSDetect(unsigned char* frameImgData, RegionInfo* pRegi |
699 | 701 | delete[] inputData; |
700 | 702 | } |
701 | 703 | |
702 | - VibeModelUpdateC1(vbM, greyImgData, MaskImgData); | |
704 | + VibeModelUpdateC1(vbM, greyImgData, MaskImgData, MaskImgCfd); | |
703 | 705 | } |
704 | 706 | else |
705 | 707 | { |
... | ... | @@ -729,7 +731,7 @@ void RegionSurveillance::RSDetect(unsigned char* frameImgData, RegionInfo* pRegi |
729 | 731 | delete[] inputData; |
730 | 732 | } |
731 | 733 | |
732 | - VibeModelUpdateC1(vbM, frameImgData, MaskImgData); | |
734 | + VibeModelUpdateC1(vbM, frameImgData, MaskImgData, MaskImgCfd); | |
733 | 735 | } |
734 | 736 | |
735 | 737 | //VibeModelUpdateC1(vbM, greyImgData, MaskImgData); |
... | ... | @@ -748,7 +750,7 @@ void RegionSurveillance::RSDetect(unsigned char* frameImgData, RegionInfo* pRegi |
748 | 750 | */ |
749 | 751 | |
750 | 752 | //get trace |
751 | - VibeModelGetTrace(MaskImgData, frameImgData, pRegionInfo); | |
753 | + VibeModelGetTrace(MaskImgData, MaskImgCfd, frameImgData, pRegionInfo); | |
752 | 754 | } |
753 | 755 | |
754 | 756 | |
... | ... | @@ -1104,7 +1106,7 @@ void RegionSurveillance::SortForeground(vector<CForeground> &ForegroundArray) |
1104 | 1106 | std::sort(ForegroundArray.begin(),ForegroundArray.end(), SortByPoint); |
1105 | 1107 | } |
1106 | 1108 | |
1107 | - | |
1109 | +#include <math.h> | |
1108 | 1110 | int RegionSurveillance::dwGlobalID; |
1109 | 1111 | /****************************************************************************** |
1110 | 1112 | * Function: VibeModelGetTrace |
... | ... | @@ -1134,7 +1136,7 @@ int RegionSurveillance::dwGlobalID; |
1134 | 1136 | m_AlarmNum 报警编号 |
1135 | 1137 | //m_TarBox 目标的外接矩形 |
1136 | 1138 | *******************************************************************************/ |
1137 | -void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, unsigned char* pRGBIn, RegionInfo* pRegionInfo) | |
1139 | +void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *MaskImgCfd, unsigned char* pRGBIn, RegionInfo* pRegionInfo) | |
1138 | 1140 | { |
1139 | 1141 | /* |
1140 | 1142 | memset(regionAlarm, 0, sizeof(bool) * MAXROINUM); |
... | ... | @@ -1157,11 +1159,11 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, unsigned c |
1157 | 1159 | // 满足条件的(像素点 面积等条件100)前景外接矩形 |
1158 | 1160 | if (channel_num == 3) |
1159 | 1161 | { |
1160 | - foreContours = pConExtraction->ExtractContours(pSourceImg, GlobelWidth, GlobelHeight, GlobelWidthstep / 3); | |
1162 | + foreContours = pConExtraction->ExtractContours(pSourceImg, MaskImgCfd,GlobelWidth, GlobelHeight, GlobelWidthstep / 3); | |
1161 | 1163 | } |
1162 | 1164 | else |
1163 | 1165 | { |
1164 | - foreContours = pConExtraction->ExtractContours(pSourceImg, GlobelWidth, GlobelHeight, GlobelWidthstep); | |
1166 | + foreContours = pConExtraction->ExtractContours(pSourceImg, MaskImgCfd, GlobelWidth, GlobelHeight, GlobelWidthstep); | |
1165 | 1167 | } |
1166 | 1168 | |
1167 | 1169 | //轨迹匹配-zhm |
... | ... | @@ -1176,8 +1178,8 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, unsigned c |
1176 | 1178 | testTarget.m_rtConnect.bottom = foreContours[i].bottom; |
1177 | 1179 | testTarget.m_ptCenter.x = (testTarget.m_rtConnect.left + testTarget.m_rtConnect.right) / 2; |
1178 | 1180 | testTarget.m_ptCenter.y = (testTarget.m_rtConnect.top + testTarget.m_rtConnect.bottom) / 2; |
1179 | - | |
1180 | - | |
1181 | + testTarget.m_cfd = foreContours[i].cfd; | |
1182 | + | |
1181 | 1183 | //大于最小过滤面积且小于最大过滤面积 by zl 20160304 |
1182 | 1184 | int targetArea = abs((testTarget.m_rtConnect.left - testTarget.m_rtConnect.right) * (testTarget.m_rtConnect.top - testTarget.m_rtConnect.bottom)); |
1183 | 1185 | if ( targetArea > OBJECT_AREA_MIN && targetArea < OBJECT_AREA_MAX) |
... | ... | @@ -1318,7 +1320,7 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, unsigned c |
1318 | 1320 | //m_TargetArray[dwBestMatch].m_AlarmState5 = false; |
1319 | 1321 | m_TargetArray[dwBestMatch].m_dwLostFrame = 0; |
1320 | 1322 | m_TargetArray[dwBestMatch].m_ptArray.push_back(ForegroundArray[i].m_ptCenter); |
1321 | - | |
1323 | + m_TargetArray[dwBestMatch].cfd = ForegroundArray[i].m_cfd; | |
1322 | 1324 | // Update current reference point |
1323 | 1325 | int dwPointCount = m_TargetArray[dwBestMatch].m_ptArray.size(); |
1324 | 1326 | |
... | ... | @@ -1395,6 +1397,7 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, unsigned c |
1395 | 1397 | m_TargetArray[dwBestMatch].m_CurRefPoint.y += (double)ForegroundArray[i].m_ptCenter.y / m_dwFrameWnd; |
1396 | 1398 | |
1397 | 1399 | m_TargetArray[dwBestMatch].m_TarBox = ForegroundArray[i].m_rtConnect; |
1400 | + m_TargetArray[dwBestMatch].cfd = ForegroundArray[i].m_cfd; | |
1398 | 1401 | } |
1399 | 1402 | |
1400 | 1403 | |
... | ... | @@ -2102,6 +2105,8 @@ void RegionSurveillance::getObjectInfo(int ObjCount, MS_ObjectInfo* ObjInfo) |
2102 | 2105 | { |
2103 | 2106 | int dwPointCount = m_FinalArray[i].m_ptArray.size(); |
2104 | 2107 | ObjInfo[i].curPos = m_FinalArray[i].m_ptArray[dwPointCount - 1]; |
2108 | + ObjInfo[i].confidence = m_FinalArray[i].cfd; | |
2109 | + | |
2105 | 2110 | int temp_dwPointCount = dwPointCount; |
2106 | 2111 | if (dwPointCount > MAXTRACENUM) |
2107 | 2112 | { |
... | ... | @@ -2149,7 +2154,8 @@ void RegionSurveillance::getObjectInfo(int ObjCount, MS_ObjectInfo* ObjInfo) |
2149 | 2154 | */ |
2150 | 2155 | // unique ID for current object |
2151 | 2156 | ObjInfo[i].TarBox = m_FinalArray[i].m_TarBox; //目标外接矩形 |
2152 | - ObjInfo[i].UniqueID = m_FinalArray[i].m_dwID; //当前目标的特点ID | |
2157 | + ObjInfo[i].UniqueID = m_FinalArray[i].m_dwID; //当前目标的特点ID | |
2158 | + //printf("UniqueID = %d, cfd = %f\n", ObjInfo[i].UniqueID, ObjInfo[i].confidence); | |
2153 | 2159 | } |
2154 | 2160 | } |
2155 | 2161 | |
... | ... | @@ -2161,6 +2167,7 @@ void RegionSurveillance::getDeleteInfo(int DelCount, MS_ObjectInfo* ObjInfo) |
2161 | 2167 | { |
2162 | 2168 | int dwPointCount = m_DelArray[i].m_ptArray.size(); |
2163 | 2169 | ObjInfo[i].curPos = m_DelArray[i].m_ptArray[dwPointCount - 1]; |
2170 | + | |
2164 | 2171 | int temp_dwPointCount = dwPointCount; |
2165 | 2172 | if (dwPointCount > MAXTRACENUM) |
2166 | 2173 | { |
... | ... | @@ -2208,7 +2215,8 @@ void RegionSurveillance::getDeleteInfo(int DelCount, MS_ObjectInfo* ObjInfo) |
2208 | 2215 | */ |
2209 | 2216 | // unique ID for current object |
2210 | 2217 | ObjInfo[i].TarBox = m_DelArray[i].m_TarBox; //目标外接矩形 |
2211 | - ObjInfo[i].UniqueID = m_DelArray[i].m_dwID; //当前目标的特点ID | |
2218 | + ObjInfo[i].UniqueID = m_DelArray[i].m_dwID; //当前目标的特点ID | |
2219 | + ObjInfo[i].confidence = m_DelArray[i].cfd; | |
2212 | 2220 | } |
2213 | 2221 | } |
2214 | 2222 | |
... | ... | @@ -3340,6 +3348,13 @@ void RegionSurveillance::RSrelease() |
3340 | 3348 | //m_TargetArray.swap(vector<CTarget>(0)); |
3341 | 3349 | //m_FinalArray.swap(vector<CTarget>(0)); |
3342 | 3350 | |
3351 | + | |
3352 | + if (MaskImgCfd != NULL) | |
3353 | + { | |
3354 | + free(MaskImgCfd); | |
3355 | + MaskImgCfd = NULL; | |
3356 | + } | |
3357 | + | |
3343 | 3358 | if (MaskImgData != NULL) |
3344 | 3359 | { |
3345 | 3360 | free(MaskImgData); | ... | ... |
src/left_over/svibe.h
... | ... | @@ -29,7 +29,7 @@ typedef struct VIBEPARAM //by zl 20160520 代替宏定义 目的:可修改 |
29 | 29 | int DEFAULT_COLOR_BACKGROUND; |
30 | 30 | int DEFAULT_COLOR_FOREGROUND; |
31 | 31 | int P_UPSPEED; |
32 | - VIBEPARAM(int samples = 20, int threshold = 35, int p_match = 2, int bgcolor = 0, int forecolor = 255, int upspeed = 16) | |
32 | + VIBEPARAM(int samples = 20, int threshold = 35, int p_match = 20, int bgcolor = 0, int forecolor = 255, int upspeed = 16) | |
33 | 33 | { |
34 | 34 | P_SAMPLES = samples; |
35 | 35 | P_THRESHOLD = threshold; |
... | ... | @@ -70,8 +70,8 @@ public: |
70 | 70 | VibeModel_t* VibeModelInitC1(uint8_t *image_data); |
71 | 71 | VibeModel_t* VibeModelInitC3(uint8_t *image_data); |
72 | 72 | |
73 | - void VibeModelGetTrace(unsigned char* inputdata,unsigned char* pRgbInData,RegionInfo* pRegionInfo); | |
74 | - void VibeModelUpdateC1(VibeModel_t *model, uint8_t *image, uint8_t *output); | |
73 | + void VibeModelGetTrace(unsigned char* inputdata, float *MaskImgCfd, unsigned char* pRgbInData,RegionInfo* pRegionInfo); | |
74 | + void VibeModelUpdateC1(VibeModel_t *model, uint8_t *image, uint8_t *output, float * confidence); | |
75 | 75 | void VibeModelUpdateC3(VibeModel_t *model, uint8_t *image, uint8_t *output); |
76 | 76 | |
77 | 77 | int RSinit(int nWidth, int nHeight, int widthstep, unsigned char* frameImgData, |
... | ... | @@ -119,6 +119,7 @@ public: |
119 | 119 | stay_dis = 5; |
120 | 120 | greyImgData = NULL; |
121 | 121 | MaskImgData = NULL; |
122 | + MaskImgCfd = NULL; | |
122 | 123 | gWinSize = 3; |
123 | 124 | g_randTable = NULL; |
124 | 125 | g_XTable = NULL; | ... | ... |