Commit c3d0b30dc55d3e3951ed369ab6cefc0717555295

Authored by Hu Chunming
1 parent 0b2e2301

代码优化,未做逻辑修改

vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp
... ... @@ -132,7 +132,15 @@ static long long get_cur_time_ms(){
132 132 std::function<void(DxGPUFrame&)> show_gpu_img_func = show_gpu_image_;
133 133  
134 134 void check_thread(void* handle);
135   -DWORD ThreadProcess(LPVOID param);
  135 +
  136 +static void algorthim_process_thread(void* arg) {
  137 + CMutliSourceVideoProcess* _this=(CMutliSourceVideoProcess*)arg;
  138 + if(_this != nullptr){
  139 + _this->algorthim_process();
  140 + } else {
  141 + LOG_ERROR("算法处理线程启动失败 !");
  142 + }
  143 +}
136 144  
137 145  
138 146 //std::ofstream g_os("./cudaMem.txt", std::ofstream::out | std::ofstream::trunc);
... ... @@ -140,57 +148,6 @@ CMutliSourceVideoProcess::CMutliSourceVideoProcess()
140 148 {
141 149 }
142 150  
143   -// dump�ļ�
144   -//static LONG WINAPI CustomExceptionCrashHandler(_In_ EXCEPTION_POINTERS *CONST pException)
145   -//{
146   -// char dumpPath[MAX_PATH];
147   -//
148   -// BOOL tempDump = FALSE;
149   -// do {
150   -//
151   -// if (0 == GetTempPath(_countof(dumpPath), dumpPath))
152   -// break;
153   -//
154   -// // %temp%Ŀ¼���½�dump�ļ���
155   -// if (!PathAppend(dumpPath, "dump"))
156   -// break;
157   -// CreateDirectory(dumpPath, NULL);
158   -// // dump�ļ�����dump�ļ��ļ��� ���Զ����޸�
159   -// if (!PathAppend(dumpPath, "HSTProcessor"))
160   -// break;
161   -//
162   -// SYSTEMTIME lclTm;
163   -// GetLocalTime(&lclTm);
164   -// char ext[29];
165   -// // dump�ļ�������ʱ����
166   -// if (FAILED(StringCchPrintf(ext, _countof(ext), ".%04hu%02hu%02hu%02hu%02hu%02hu.unhdlexc.dmp", lclTm.wYear, lclTm.wMonth, lclTm.wDay, lclTm.wHour, lclTm.wMinute, lclTm.wSecond)))
167   -// break;
168   -// if (FAILED(StringCchCat(dumpPath, _countof(dumpPath), ext)))
169   -// break;
170   -//
171   -// tempDump = TRUE;
172   -// } while (FALSE);
173   -// HANDLE CONST dumpFile = CreateFile(dumpPath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
174   -// if (INVALID_HANDLE_VALUE == dumpPath)
175   -// {
176   -// return EXCEPTION_EXECUTE_HANDLER;
177   -// }
178   -//
179   -// MINIDUMP_EXCEPTION_INFORMATION dumpInfo;
180   -// dumpInfo.ThreadId = GetCurrentThreadId();
181   -// dumpInfo.ExceptionPointers = pException;
182   -// dumpInfo.ClientPointers = TRUE;
183   -//
184   -// if (FAILED(MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), dumpFile, MiniDumpNormal, &dumpInfo, NULL, NULL)))
185   -// {
186   -// CloseHandle(dumpFile);
187   -// }
188   -// CloseHandle(dumpFile);
189   -//
190   -// return EXCEPTION_EXECUTE_HANDLER;
191   -//}
192   -
193   -
194 151 CMutliSourceVideoProcess::~CMutliSourceVideoProcess()
195 152 {
196 153 //��־����ʼ��
... ... @@ -345,7 +302,7 @@ int CMutliSourceVideoProcess::InitAlgorthim(mvpt_param vptParam, VIDEO_OBJECT_IN
345 302 m_face_det_config = vptParam.face_det_config;
346 303  
347 304 m_snaphot_helper.snapshot_helper_init(vptParam.gpuid, gpu_total_memory, vptParam.vrdbpath, vptParam.auth_license, vptParam.wait_framecount, m_hp_analysis_config, \
348   - m_hcp_analysis_config, m_vehicle_analysis_config, m_vehicle_recg_config, m_vehicle_plate_det_recg_config, m_hf_recg_config, m_hcf_recg_config, m_vcf_recg_config);
  305 + m_hcp_analysis_config, m_vehicle_analysis_config, m_vehicle_recg_config, m_vehicle_plate_det_recg_config, m_hf_recg_config, m_hcf_recg_config, m_vcf_recg_config, m_face_det_config);
349 306 if (ret == SUCCESS) //�ɹ�
350 307 {
351 308 licence_status = 0;
... ... @@ -634,12 +591,13 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh
634 591  
635 592 if (!ProcessFlag) {
636 593 m_bProcessExit = false;
637   - ProcessThread = std::thread(ThreadProcess, this);
  594 + ProcessThread = std::thread(algorthim_process_thread, this);
638 595 ProcessFlag = true;
639 596 }
640   -
641   - printf("-----------------------add task: %d-----------------------\n", tasks.size() - 1);
  597 +
642 598 AddTaskSucFlag = 1;
  599 +
  600 + LOG_INFO("add task: {}", new_task.taskID);
643 601 return true;
644 602 }
645 603  
... ... @@ -766,61 +724,6 @@ void CMutliSourceVideoProcess::OperatorTask()
766 724 }
767 725 }
768 726  
769   -
770   -int CMutliSourceVideoProcess::SaveResultInFile(const OBJ_KEY & obj_key, const OBJ_VALUE & obj_value)
771   -{
772   - if (0 == obj_value.index.index && obj_value.snapShotLittle.width == HP_WIDTH && obj_value.snapShotLittle.height == HP_HEIGHT)
773   - {
774   - if (m_face_det_config == SY_CONFIG_OPEN)
775   - {
776   - m_snaphot_helper.save_face_snapshot(obj_key);
777   - }
778   -
779   - if (m_hp_analysis_config == SY_CONFIG_OPEN || m_hf_recg_config == SY_CONFIG_OPEN)
780   - {
781   - m_snaphot_helper.save_snapshot(obj_key);
782   - m_snaphot_helper.hp_analysis(obj_key);
783   - }
784   - else
785   - {
786   - m_snaphot_helper.save_without_analysis(obj_key);
787   - }
788   - }
789   - else if ((1 == obj_value.index.index || 2 == obj_value.index.index) && obj_value.snapShotLittle.width == HCP_WIDTH && obj_value.snapShotLittle.height == HCP_HEIGHT)
790   - {
791   - if (m_hcp_analysis_config == SY_CONFIG_OPEN || m_hcf_recg_config == SY_CONFIG_OPEN)
792   - {
793   - m_snaphot_helper.save_snapshot(obj_key);
794   - m_snaphot_helper.hcp_analysis(obj_key);
795   - }
796   - else
797   - {
798   - m_snaphot_helper.save_without_analysis(obj_key);
799   - }
800   - }
801   - else if ((8 == obj_value.index.index || (obj_value.index.index >= 4 && obj_value.index.index <= 6)) && obj_value.snapShotLittle.width == VEHICLE_WIDTH && obj_value.snapShotLittle.height == VEHICLE_HEIGHT)
802   - {
803   - //VEHICLEAnalysis(obj_key, obj_value);
804   - if (m_vehicle_analysis_config == SY_CONFIG_OPEN || m_vcf_recg_config == SY_CONFIG_OPEN)
805   - {
806   - m_snaphot_helper.save_snapshot(obj_key);
807   - m_snaphot_helper.vehicle_analysis(obj_key);
808   - }
809   - else
810   - {
811   - m_snaphot_helper.save_without_analysis(obj_key);
812   - }
813   -
814   - }
815   - else
816   - {
817   - m_snaphot_helper.save_without_analysis(obj_key);
818   - }
819   -
820   - return 0;
821   -}
822   -
823   -
824 727 //#define LOG_INFO
825 728 void CMutliSourceVideoProcess::callTaskObjInfoCallbackFunc(int objCount, VPT_ObjInfo *obj, int taskFrameCount, int taskId)
826 729 {
... ... @@ -866,7 +769,7 @@ void CMutliSourceVideoProcess::callTaskObjInfoCallbackFunc(int objCount, VPT_Obj
866 769  
867 770 }
868 771 }
869   -DWORD ThreadProcess(LPVOID param)
  772 +void CMutliSourceVideoProcess::algorthim_process()
870 773 {
871 774 set<int> k;
872 775 int count = 0;
... ... @@ -874,12 +777,10 @@ DWORD ThreadProcess(LPVOID param)
874 777  
875 778 DxGPUFrame frame = {};
876 779  
877   - CMutliSourceVideoProcess *pThreadParam = (CMutliSourceVideoProcess *)param;
878   -
879   - cudaSetDevice(pThreadParam->mgpuid);
  780 + cudaSetDevice(mgpuid);
880 781  
881 782 CUdevice cuDevice;
882   - cuDeviceGet(&cuDevice, pThreadParam->mgpuid);
  783 + cuDeviceGet(&cuDevice, mgpuid);
883 784 CUcontext context;
884 785 cuCtxCreate(&context, 0, cuDevice);
885 786 cuCtxPushCurrent(context);
... ... @@ -892,9 +793,9 @@ DWORD ThreadProcess(LPVOID param)
892 793 long long last_time = get_cur_time_ms();
893 794  
894 795 {
895   - while (!pThreadParam->m_bProcessExit)
  796 + while (!m_bProcessExit)
896 797 {
897   - if (pThreadParam->licence_status <= -3)
  798 + if (licence_status <= -3)
898 799 {
899 800 printf("authority failed!\n");
900 801 break;
... ... @@ -902,24 +803,23 @@ DWORD ThreadProcess(LPVOID param)
902 803  
903 804 double time_val, time_val_p = 0;
904 805 {
905   - std::lock_guard<std::mutex> l(pThreadParam->taskMutex);
906   - pThreadParam->OperatorTask();
  806 + std::lock_guard<std::mutex> l(taskMutex);
  807 + OperatorTask();
907 808 }
908   - pThreadParam->taskCondVar.notify_all();
  809 + taskCondVar.notify_all();
909 810  
910   - int curTaskSize = pThreadParam->tasks.size();
  811 + int curTaskSize = tasks.size();
911 812  
912 813 count = 0;
913 814 static int ncount = 0;
914 815 map<int, vector<int>> finishTaskDeleteObj;
915 816 int curPlayTaskCount = 0;
916 817  
917   - //�жϵ�ǰPLAY����Ľ���״̬��������ڽ����쳣��·������������·����
918 818 for (int i = 0; i < curTaskSize; i++)
919 819 {
920   - if ((pThreadParam->tasks[i].taskState == PLAY || pThreadParam->tasks[i].taskState == DECODEERROR))
  820 + if ((tasks[i].taskState == PLAY || tasks[i].taskState == DECODEERROR))
921 821 {
922   - if (!pThreadParam->tasks[i].taskTcuvid->DxDecoderIsRun())
  822 + if (!tasks[i].taskTcuvid->DxDecoderIsRun())
923 823 {
924 824 cudaError_t cudaStatus = cudaGetLastError();
925 825 if (cudaStatus != cudaSuccess) {
... ... @@ -927,18 +827,18 @@ DWORD ThreadProcess(LPVOID param)
927 827 }
928 828  
929 829 cout << "***************** Task " << i << " is Finished *****************" << endl;
930   - pThreadParam->tasks[i].taskState = FINISH;
  830 + tasks[i].taskState = FINISH;
931 831  
932   - pThreadParam->FinishTask(pThreadParam->tasks[i].taskID);
  832 + FinishTask(tasks[i].taskID);
933 833  
934   - pThreadParam->tasks[i].taskTcuvid->DxCloseDecoder();
935   - delete pThreadParam->tasks[i].taskTcuvid;
936   - pThreadParam->tasks[i].taskTcuvid = NULL;
937   - int taskid = pThreadParam->tasks[i].taskID;
  834 + tasks[i].taskTcuvid->DxCloseDecoder();
  835 + delete tasks[i].taskTcuvid;
  836 + tasks[i].taskTcuvid = NULL;
  837 + int taskid = tasks[i].taskID;
938 838  
939 839 //ѭ���ȴ� ֱ��finished_analysis_ss_info�����и�·Ŀ�궼�Ѿ����ظ��û����ſ���������������
940   - std::unique_lock<std::mutex> lock(pThreadParam->m_snaphot_helper.analysisThreadMutex);
941   - while (std::find_if(pThreadParam->m_snaphot_helper.finished_analysis_ss_info.begin(), pThreadParam->m_snaphot_helper.finished_analysis_ss_info.end(), [&taskid](const std::pair<OBJ_KEY, video_object_snapshot> & item) ->bool {
  840 + std::unique_lock<std::mutex> lock(m_snaphot_helper.analysisThreadMutex);
  841 + while (std::find_if(m_snaphot_helper.finished_analysis_ss_info.begin(), m_snaphot_helper.finished_analysis_ss_info.end(), [&taskid](const std::pair<OBJ_KEY, video_object_snapshot> & item) ->bool {
942 842 if (item.first.videoID == taskid)
943 843 {
944 844 return true;
... ... @@ -948,7 +848,7 @@ DWORD ThreadProcess(LPVOID param)
948 848 return false;
949 849 }
950 850  
951   - }) != pThreadParam->m_snaphot_helper.finished_analysis_ss_info.end())
  851 + }) != m_snaphot_helper.finished_analysis_ss_info.end())
952 852 {
953 853 lock.unlock();
954 854 std::this_thread::yield();
... ... @@ -957,27 +857,27 @@ DWORD ThreadProcess(LPVOID param)
957 857 }
958 858  
959 859 //�ص�֪ͨ�û� ��·�����������
960   - if (pThreadParam->taskFinishCallbackFunc != nullptr)
  860 + if (taskFinishCallbackFunc != nullptr)
961 861 {
962   - std::lock_guard<std::mutex> l(pThreadParam->m_snaphot_helper.callback_tx);
963   - pThreadParam->taskFinishCallbackFunc(pThreadParam->tasks[i].taskID);
  862 + std::lock_guard<std::mutex> l(m_snaphot_helper.callback_tx);
  863 + taskFinishCallbackFunc(tasks[i].taskID);
964 864 }
965 865  
966   - pThreadParam->TaskinPlay--;
  866 + TaskinPlay--;
967 867 }
968 868 }
969 869  
970   - if (pThreadParam->tasks[i].taskState == FINISH)
  870 + if (tasks[i].taskState == FINISH)
971 871 count++;
972 872 }
973 873  
974 874 //�������������FINISH״̬
975   - if (count >= pThreadParam->tasks.size()) //have no decode video, break
  875 + if (count >= tasks.size()) //have no decode video, break
976 876 {
977 877 {
978   - std::lock_guard<std::mutex> l(pThreadParam->taskMutex);
  878 + std::lock_guard<std::mutex> l(taskMutex);
979 879 //�ж���������ȴ������Ƿ����µ���������
980   - if (pThreadParam->HasNewTask())
  880 + if (HasNewTask())
981 881 {
982 882 continue;
983 883 }
... ... @@ -991,38 +891,38 @@ DWORD ThreadProcess(LPVOID param)
991 891 //continue;
992 892  
993 893 //printf("0708\n");
994   - //pThreadParam->ProcessFlag = false;
  894 + //ProcessFlag = false;
995 895 break;
996 896 }
997 897 }
998 898 }
999 899  
1000 900 //��ǰû��PLAY������ ѭ���ȴ�
1001   - curPlayTaskCount = pThreadParam->TaskinPlay;
  901 + curPlayTaskCount = TaskinPlay;
1002 902 if (curPlayTaskCount <= 0) {
1003 903 Sleep(30);
1004 904 continue;
1005 905 }
1006 906  
1007 907 k.clear();
1008   - pThreadParam->TaskinPlayID.clear();
  908 + TaskinPlayID.clear();
1009 909  
1010 910 //��ȡ��������
1011 911 getdata_flag:
1012 912 for (int i = 0; i < curTaskSize; i++)
1013 913 {
1014   - if (k.find(i) == k.end() && pThreadParam->tasks[i].taskState == PLAY && pThreadParam->tasks[i].taskTcuvid->DxDecoderIsRun())
  914 + if (k.find(i) == k.end() && tasks[i].taskState == PLAY && tasks[i].taskTcuvid->DxDecoderIsRun())
1015 915 {
1016   - if(pThreadParam->tasks[i].taskTcuvid->DxLockFrame(&pThreadParam->tasks[i].task_algorithm_data) == 0) {
  916 + if(tasks[i].taskTcuvid->DxLockFrame(&tasks[i].task_algorithm_data) == 0) {
1017 917 k.insert(i);
1018   - pThreadParam->TaskinPlayID.insert(pThreadParam->tasks[i].taskID);
  918 + TaskinPlayID.insert(tasks[i].taskID);
1019 919 }
1020 920 }
1021   - else if (k.find(i) == k.end() && pThreadParam->tasks[i].taskState == PLAY && !pThreadParam->tasks[i].taskTcuvid->DxDecoderIsRun())
  921 + else if (k.find(i) == k.end() && tasks[i].taskState == PLAY && !tasks[i].taskTcuvid->DxDecoderIsRun())
1022 922 {
1023   - pThreadParam->tasks[i].taskState = DECODEERROR;
  923 + tasks[i].taskState = DECODEERROR;
1024 924 curPlayTaskCount--;
1025   - FinishTaskTracker(pThreadParam->VPT_Handle, pThreadParam->tasks[i].taskID);
  925 + FinishTaskTracker(VPT_Handle, tasks[i].taskID);
1026 926 }
1027 927 }
1028 928  
... ... @@ -1053,19 +953,19 @@ DWORD ThreadProcess(LPVOID param)
1053 953 /////////////////////////////////////////////////////////////
1054 954  
1055 955 vector<vector<int>> deleteObjectID;
1056   - set<int>::iterator iter = pThreadParam->TaskinPlayID.begin();
  956 + set<int>::iterator iter = TaskinPlayID.begin();
1057 957  
1058 958 int cur_batch_size = 0;
1059   - cur_batch_size = pThreadParam->section_batch_size;
  959 + cur_batch_size = section_batch_size;
1060 960  
1061 961 if (0)
1062 962 {
1063   - if (pThreadParam->section_batch_size == 20)
1064   - cur_batch_size = pThreadParam->section_batch_size;
  963 + if (section_batch_size == 20)
  964 + cur_batch_size = section_batch_size;
1065 965 else
1066 966 {
1067   - if (curPlayTaskCount <= 2 * pThreadParam->section_batch_size)
1068   - cur_batch_size = pThreadParam->section_batch_size;
  967 + if (curPlayTaskCount <= 2 * section_batch_size)
  968 + cur_batch_size = section_batch_size;
1069 969 else if (curPlayTaskCount >= 2 * MAX_BATCH)
1070 970 cur_batch_size = MAX_BATCH;
1071 971 else
... ... @@ -1077,7 +977,7 @@ DWORD ThreadProcess(LPVOID param)
1077 977  
1078 978 vector<vector<VPT_Result>> unUsedResult;
1079 979 vector<unsigned long long> vec_frameIndex;
1080   - unUsedResult.resize(pThreadParam->VPTResult.size());
  980 + unUsedResult.resize(VPTResult.size());
1081 981 int cycleTimes = curPlayTaskCount / cur_batch_size + (curPlayTaskCount % cur_batch_size == 0 ? 0 : 1);
1082 982 for (int c = 0; c < cycleTimes; c++)
1083 983 {
... ... @@ -1087,7 +987,7 @@ DWORD ThreadProcess(LPVOID param)
1087 987 vec_frameIndex.clear();
1088 988 for (int i = 0; i < batchsize; i++)
1089 989 {
1090   - DxGPUFrame task_algorithm_data = pThreadParam->tasks[*iter].task_algorithm_data;
  990 + DxGPUFrame task_algorithm_data = tasks[*iter].task_algorithm_data;
1091 991 int w = task_algorithm_data.width;
1092 992 int h = task_algorithm_data.height;
1093 993 int npitch = task_algorithm_data.size;
... ... @@ -1099,7 +999,7 @@ DWORD ThreadProcess(LPVOID param)
1099 999  
1100 1000 vector<vector<int>> tempDeleteObjectID;
1101 1001 tempDeleteObjectID.resize(batchsize);
1102   - int flag = VPT_Process_GPU(pThreadParam->GetVPT_Handle(), batch_img, startbatch, batchsize, vec_frameIndex, pThreadParam->VPTResult, tempDeleteObjectID, unUsedResult);
  1002 + int flag = VPT_Process_GPU(GetVPT_Handle(), batch_img, startbatch, batchsize, vec_frameIndex, VPTResult, tempDeleteObjectID, unUsedResult);
1103 1003 process_times++ ;
1104 1004  
1105 1005 for (auto iter : tempDeleteObjectID)
... ... @@ -1114,89 +1014,89 @@ DWORD ThreadProcess(LPVOID param)
1114 1014  
1115 1015 long long result_analysis_time = get_cur_time_ms();
1116 1016  
1117   - iter = pThreadParam->TaskinPlayID.begin();
  1017 + iter = TaskinPlayID.begin();
1118 1018 for (int i = 0; i < curPlayTaskCount; i++)
1119 1019 {
1120   - pThreadParam->tasks[*iter].taskFrameCount = pThreadParam->tasks[*iter].task_algorithm_data.timestamp;
  1020 + tasks[*iter].taskFrameCount = tasks[*iter].task_algorithm_data.timestamp;
1121 1021 //若该路任务当前帧未检测到目标,返回ID为-1的目标表明未检测到目标
1122   - if (pThreadParam->VPTResult[i].objCount == 0)
  1022 + if (VPTResult[i].objCount == 0)
1123 1023 {
1124   - pThreadParam->callTaskObjInfoCallbackFunc(0, nullptr, pThreadParam->tasks[*iter].taskFrameCount, *iter);
  1024 + callTaskObjInfoCallbackFunc(0, nullptr, tasks[*iter].taskFrameCount, *iter);
1125 1025 }
1126 1026  
1127 1027 //实时查看模块,若存在实时查看,把当前视频画面cp回内存
1128 1028 bool view = false;
1129   - int frameHeight = pThreadParam->tasks[*iter].task_algorithm_data.height;
1130   - int frameWidth = pThreadParam->tasks[*iter].task_algorithm_data.width;
  1029 + int frameHeight = tasks[*iter].task_algorithm_data.height;
  1030 + int frameWidth = tasks[*iter].task_algorithm_data.width;
1131 1031  
1132   - if (*iter == pThreadParam->viewTaskID)
  1032 + if (*iter == viewTaskID)
1133 1033 {
1134   - cudaMemcpy(pThreadParam->tasks[*iter].frameImage.data, pThreadParam->tasks[*iter].task_algorithm_data.frame, 3 * pThreadParam->tasks[*iter].task_algorithm_data.width * pThreadParam->tasks[*iter].task_algorithm_data.height * sizeof(unsigned char), cudaMemcpyDeviceToHost);
  1034 + cudaMemcpy(tasks[*iter].frameImage.data, tasks[*iter].task_algorithm_data.frame, 3 * tasks[*iter].task_algorithm_data.width * tasks[*iter].task_algorithm_data.height * sizeof(unsigned char), cudaMemcpyDeviceToHost);
1135 1035 view = true;
1136 1036 }
1137 1037  
1138 1038 //跟踪帧也需要返回跟踪的结果
1139   - if (pThreadParam->tasks[*iter].taskLastFrameCount > 0)
  1039 + if (tasks[*iter].taskLastFrameCount > 0)
1140 1040 {
1141 1041 vector<VPT_Result> OneUnUsedResult = unUsedResult[i];
1142 1042 if (OneUnUsedResult.size() == 0)
1143 1043 {
1144   - pThreadParam->callTaskObjInfoCallbackFunc(0, nullptr, pThreadParam->tasks[*iter].taskLastFrameCount + 1, *iter);
  1044 + callTaskObjInfoCallbackFunc(0, nullptr, tasks[*iter].taskLastFrameCount + 1, *iter);
1145 1045 }
1146 1046 for (int k = 0; k < OneUnUsedResult.size(); ++k)
1147 1047 {
1148 1048 if (OneUnUsedResult[k].objCount == 0)
1149 1049 {
1150   - pThreadParam->callTaskObjInfoCallbackFunc(0, nullptr, pThreadParam->tasks[*iter].taskLastFrameCount + k + 1, *iter);
  1050 + callTaskObjInfoCallbackFunc(0, nullptr, tasks[*iter].taskLastFrameCount + k + 1, *iter);
1151 1051 }
1152 1052 else
1153 1053 {
1154 1054 //cout << "OneUnUsedResult.size = " << OneUnUsedResult.size() << " k=" << k << " OneUnUsedResult[k].objCount = " << OneUnUsedResult[k].objCount << endl;
1155   - pThreadParam->callTaskObjInfoCallbackFunc(OneUnUsedResult[k].objCount, OneUnUsedResult[k].obj, pThreadParam->tasks[*iter].taskLastFrameCount + k + 1, *iter);
  1055 + callTaskObjInfoCallbackFunc(OneUnUsedResult[k].objCount, OneUnUsedResult[k].obj, tasks[*iter].taskLastFrameCount + k + 1, *iter);
1156 1056 }
1157 1057 }
1158 1058 }
1159   - pThreadParam->tasks[*iter].taskLastFrameCount = pThreadParam->tasks[*iter].taskFrameCount;
  1059 + tasks[*iter].taskLastFrameCount = tasks[*iter].taskFrameCount;
1160 1060  
1161   - unsigned char* snapshot_image_data[MAX_OBJ_COUNT]{};// = new unsigned char*[pThreadParam->VPTResult[i].objCount];
1162   - int snapshot_left[MAX_OBJ_COUNT]{};// = new int[pThreadParam->VPTResult[i].objCount];
1163   - int snapshot_right[MAX_OBJ_COUNT]{};// = new int[pThreadParam->VPTResult[i].objCount];
1164   - int snapshot_top[MAX_OBJ_COUNT]{};// = new int[pThreadParam->VPTResult[i].objCount];
1165   - int snapshot_bottom[MAX_OBJ_COUNT]{};// = new int[pThreadParam->VPTResult[i].objCount];
1166   - int snapshot_dst_width[MAX_OBJ_COUNT]{};// = new int[pThreadParam->VPTResult[i].objCount];
1167   - int snapshot_dst_height[MAX_OBJ_COUNT]{};// = new int[pThreadParam->VPTResult[i].objCount];
  1061 + unsigned char* snapshot_image_data[MAX_OBJ_COUNT]{};// = new unsigned char*[VPTResult[i].objCount];
  1062 + int snapshot_left[MAX_OBJ_COUNT]{};// = new int[VPTResult[i].objCount];
  1063 + int snapshot_right[MAX_OBJ_COUNT]{};// = new int[VPTResult[i].objCount];
  1064 + int snapshot_top[MAX_OBJ_COUNT]{};// = new int[VPTResult[i].objCount];
  1065 + int snapshot_bottom[MAX_OBJ_COUNT]{};// = new int[VPTResult[i].objCount];
  1066 + int snapshot_dst_width[MAX_OBJ_COUNT]{};// = new int[VPTResult[i].objCount];
  1067 + int snapshot_dst_height[MAX_OBJ_COUNT]{};// = new int[VPTResult[i].objCount];
1168 1068  
1169 1069 int copy_obj_count = 0; //用于记录该路有多少个目标需要进行显存图像的更新
1170 1070 vector<int> human_idx; //用于记录快照数组中那些是人脸
1171 1071 vector<OBJ_KEY> human_obj_keys;
1172 1072  
1173   - pThreadParam->callTaskObjInfoCallbackFunc(pThreadParam->VPTResult[i].objCount, pThreadParam->VPTResult[i].obj, pThreadParam->tasks[*iter].taskFrameCount, *iter);
1174   - for (int c = 0; c < pThreadParam->VPTResult[i].objCount; c++)
  1073 + callTaskObjInfoCallbackFunc(VPTResult[i].objCount, VPTResult[i].obj, tasks[*iter].taskFrameCount, *iter);
  1074 + for (int c = 0; c < VPTResult[i].objCount; c++)
1175 1075 {
1176   - OBJ_KEY newObj = { (*iter), pThreadParam->VPTResult[i].obj[c].id };
  1076 + OBJ_KEY newObj = { (*iter), VPTResult[i].obj[c].id };
1177 1077  
1178 1078 int index = 0;
1179   - if (pThreadParam->m_snaphot_helper.snapShotInfo.find(newObj) == pThreadParam->m_snaphot_helper.snapShotInfo.end())
1180   - index = pThreadParam->VPTResult[i].obj[c].index;
  1079 + if (m_snaphot_helper.snapShotInfo.find(newObj) == m_snaphot_helper.snapShotInfo.end())
  1080 + index = VPTResult[i].obj[c].index;
1181 1081 else
1182   - index = pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index;
  1082 + index = m_snaphot_helper.snapShotInfo[newObj].index.index;
1183 1083  
1184 1084 //实时查看模块 绘制目标框到画面上
1185 1085 if (view)
1186 1086 {
1187 1087 //cout << "---- vew ---- ";
1188   - int p1 = pThreadParam->VPTResult[i].obj[c].left - 10 > 0 ? pThreadParam->VPTResult[i].obj[c].left - 10 : 0;
1189   - int p2 = pThreadParam->VPTResult[i].obj[c].top - 15 > 0 ? pThreadParam->VPTResult[i].obj[c].top - 15 : 0;
  1088 + int p1 = VPTResult[i].obj[c].left - 10 > 0 ? VPTResult[i].obj[c].left - 10 : 0;
  1089 + int p2 = VPTResult[i].obj[c].top - 15 > 0 ? VPTResult[i].obj[c].top - 15 : 0;
1190 1090  
1191   - cv::rectangle(pThreadParam->tasks[*iter].frameImage, Rect(pThreadParam->VPTResult[i].obj[c].left, pThreadParam->VPTResult[i].obj[c].top,
1192   - pThreadParam->VPTResult[i].obj[c].right - pThreadParam->VPTResult[i].obj[c].left,
1193   - pThreadParam->VPTResult[i].obj[c].bottom - pThreadParam->VPTResult[i].obj[c].top), Scalar(158, 52, 254), 3, 1, 0);
  1091 + cv::rectangle(tasks[*iter].frameImage, Rect(VPTResult[i].obj[c].left, VPTResult[i].obj[c].top,
  1092 + VPTResult[i].obj[c].right - VPTResult[i].obj[c].left,
  1093 + VPTResult[i].obj[c].bottom - VPTResult[i].obj[c].top), Scalar(158, 52, 254), 3, 1, 0);
1194 1094 #ifdef _MSC_VER
1195 1095 string resss = "" + to_string(index) + " " + ObjTypes[index];
1196   - putTextZH(pThreadParam->tasks[*iter].frameImage, resss.c_str(), { p1, p2 }, Scalar(20, 255, 20), 14, "Arial");
  1096 + putTextZH(tasks[*iter].frameImage, resss.c_str(), { p1, p2 }, Scalar(20, 255, 20), 14, "Arial");
1197 1097 #else
1198   - string resss = "" + to_string(pThreadParam->VPTResult[i].obj[c].id) + " " + ObjTypesEnglish[pThreadParam->VPTResult[i].obj[c].index];
1199   - cv::putText(pThreadParam->tasks[*iter].frameImage, resss.c_str(), cv::Point(p1, p2), cv::FONT_HERSHEY_COMPLEX, 2, Scalar(20, 255, 20), 2, 8, 0);
  1098 + string resss = "" + to_string(VPTResult[i].obj[c].id) + " " + ObjTypesEnglish[VPTResult[i].obj[c].index];
  1099 + cv::putText(tasks[*iter].frameImage, resss.c_str(), cv::Point(p1, p2), cv::FONT_HERSHEY_COMPLEX, 2, Scalar(20, 255, 20), 2, 8, 0);
1200 1100 #endif
1201 1101 }
1202 1102  
... ... @@ -1204,54 +1104,54 @@ DWORD ThreadProcess(LPVOID param)
1204 1104 int boundary = 10;
1205 1105 int boundaryLittle = 4;
1206 1106  
1207   - int cur_real_width = (pThreadParam->VPTResult[i].obj[c].right - pThreadParam->VPTResult[i].obj[c].left);
1208   - int cur_real_height = (pThreadParam->VPTResult[i].obj[c].bottom - pThreadParam->VPTResult[i].obj[c].top);
1209   - int cur_real_index = pThreadParam->VPTResult[i].obj[c].index;
  1107 + int cur_real_width = (VPTResult[i].obj[c].right - VPTResult[i].obj[c].left);
  1108 + int cur_real_height = (VPTResult[i].obj[c].bottom - VPTResult[i].obj[c].top);
  1109 + int cur_real_index = VPTResult[i].obj[c].index;
1210 1110  
1211 1111 //第一次添加快照
1212   - if (pThreadParam->m_snaphot_helper.snapShotInfo.find(newObj) == pThreadParam->m_snaphot_helper.snapShotInfo.end())
  1112 + if (m_snaphot_helper.snapShotInfo.find(newObj) == m_snaphot_helper.snapShotInfo.end())
1213 1113 {
1214 1114 //DxAppendLog(DxLOG_INFO, "30");
1215   - if (LegalMinArea(cur_real_width, cur_real_height, pThreadParam->tasks[*iter].task_min_boxsize[cur_real_index]))
  1115 + if (LegalMinArea(cur_real_width, cur_real_height, tasks[*iter].task_min_boxsize[cur_real_index]))
1216 1116 {
1217 1117 //DxAppendLog(DxLOG_INFO, "31");
1218 1118 //--------------------- 保存快照视频截图 -----------------------------//
1219 1119  
1220   - int left = max(0, (int)(pThreadParam->VPTResult[i].obj[c].left - boundaryLittle));
1221   - int top = max(0, (int)(pThreadParam->VPTResult[i].obj[c].top - boundaryLittle));
1222   - int right = min({ frameWidth - 1, (int)(pThreadParam->VPTResult[i].obj[c].right + boundaryLittle) });
1223   - int bottom = min({ frameHeight - 1, (int)(pThreadParam->VPTResult[i].obj[c].bottom + boundaryLittle) });
1224   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].frameCount = pThreadParam->tasks[*iter].taskFrameCount;
1225   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].isupdate = true;
1226   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].lost = 0;
  1120 + int left = max(0, (int)(VPTResult[i].obj[c].left - boundaryLittle));
  1121 + int top = max(0, (int)(VPTResult[i].obj[c].top - boundaryLittle));
  1122 + int right = min({ frameWidth - 1, (int)(VPTResult[i].obj[c].right + boundaryLittle) });
  1123 + int bottom = min({ frameHeight - 1, (int)(VPTResult[i].obj[c].bottom + boundaryLittle) });
  1124 + m_snaphot_helper.snapShotInfo[newObj].frameCount = tasks[*iter].taskFrameCount;
  1125 + m_snaphot_helper.snapShotInfo[newObj].isupdate = true;
  1126 + m_snaphot_helper.snapShotInfo[newObj].lost = 0;
1227 1127  
1228   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.count++;
1229   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index = pThreadParam->VPTResult[i].obj[c].index;
  1128 + m_snaphot_helper.snapShotInfo[newObj].index.count++;
  1129 + m_snaphot_helper.snapShotInfo[newObj].index.index = VPTResult[i].obj[c].index;
1230 1130  
1231   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].confidence = pThreadParam->VPTResult[i].obj[c].confidence;
  1131 + m_snaphot_helper.snapShotInfo[newObj].confidence = VPTResult[i].obj[c].confidence;
1232 1132  
1233   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.left = left;
1234   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.top = top;
1235   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.right = right;
1236   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.bottom = bottom;
1237   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].lastArea = (bottom - top)*(right - left);
  1133 + m_snaphot_helper.snapShotInfo[newObj].box.left = left;
  1134 + m_snaphot_helper.snapShotInfo[newObj].box.top = top;
  1135 + m_snaphot_helper.snapShotInfo[newObj].box.right = right;
  1136 + m_snaphot_helper.snapShotInfo[newObj].box.bottom = bottom;
  1137 + m_snaphot_helper.snapShotInfo[newObj].lastArea = (bottom - top)*(right - left);
1238 1138  
1239   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].flags[0] = left < minDistance[0] + SCALE_OUT ? 0 : 1; //left
1240   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].flags[1] = top < minDistance[1] + SCALE_OUT ? 0 : 1; //top
1241   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].flags[2] = right > frameWidth - minDistance[2] - SCALE_OUT ? 0 : 1; //right
1242   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].flags[3] = bottom > frameHeight - minDistance[3] - SCALE_OUT ? 0 : 1; //bottom
  1139 + m_snaphot_helper.snapShotInfo[newObj].flags[0] = left < minDistance[0] + SCALE_OUT ? 0 : 1; //left
  1140 + m_snaphot_helper.snapShotInfo[newObj].flags[1] = top < minDistance[1] + SCALE_OUT ? 0 : 1; //top
  1141 + m_snaphot_helper.snapShotInfo[newObj].flags[2] = right > frameWidth - minDistance[2] - SCALE_OUT ? 0 : 1; //right
  1142 + m_snaphot_helper.snapShotInfo[newObj].flags[3] = bottom > frameHeight - minDistance[3] - SCALE_OUT ? 0 : 1; //bottom
1243 1143  
1244   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame = NULL;
1245   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShot.frame = NULL;
  1144 + m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame = NULL;
  1145 + m_snaphot_helper.snapShotInfo[newObj].snapShot.frame = NULL;
1246 1146  
1247   - if (pThreadParam->tasks[*iter].folderName != NULL)
  1147 + if (tasks[*iter].folderName != NULL)
1248 1148 {
1249 1149 //DxAppendLog(DxLOG_INFO, "32");
1250   - FRAME_KEY frame_id = { (*iter),pThreadParam->tasks[*iter].taskFrameCount };
1251   - pThreadParam->m_snaphot_helper.ImgSaveCache.insert(newObj, frame_id, pThreadParam->tasks[*iter].task_algorithm_data);
  1150 + FRAME_KEY frame_id = { (*iter),tasks[*iter].taskFrameCount };
  1151 + m_snaphot_helper.ImgSaveCache.insert(newObj, frame_id, tasks[*iter].task_algorithm_data);
1252 1152  
1253   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShot.height = frameHeight;
1254   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShot.width = frameWidth;
  1153 + m_snaphot_helper.snapShotInfo[newObj].snapShot.height = frameHeight;
  1154 + m_snaphot_helper.snapShotInfo[newObj].snapShot.width = frameWidth;
1255 1155 }
1256 1156  
1257 1157  
... ... @@ -1261,18 +1161,18 @@ DWORD ThreadProcess(LPVOID param)
1261 1161 int vRight = 0;
1262 1162 int vBottom = 0;
1263 1163  
1264   - vLeft = max(0, pThreadParam->VPTResult[i].obj[c].left - boundary);
1265   - vTop = max(0, pThreadParam->VPTResult[i].obj[c].top - boundary);
1266   - vRight = min({ frameWidth - 1, pThreadParam->VPTResult[i].obj[c].right + boundary });
1267   - vBottom = min({ frameHeight - 1, pThreadParam->VPTResult[i].obj[c].bottom + boundary });
  1164 + vLeft = max(0, VPTResult[i].obj[c].left - boundary);
  1165 + vTop = max(0, VPTResult[i].obj[c].top - boundary);
  1166 + vRight = min({ frameWidth - 1, VPTResult[i].obj[c].right + boundary });
  1167 + vBottom = min({ frameHeight - 1, VPTResult[i].obj[c].bottom + boundary });
1268 1168 //DxAppendLog(DxLOG_INFO, "34");
1269   - if (pThreadParam->tasks[*iter].folderNameLittle != NULL)
  1169 + if (tasks[*iter].folderNameLittle != NULL)
1270 1170 {
1271 1171 //DxAppendLog(DxLOG_INFO, "35");
1272 1172 int cur_width = 0;
1273 1173 int cur_height = 0;
1274 1174  
1275   - if (0 == pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index)
  1175 + if (0 == m_snaphot_helper.snapShotInfo[newObj].index.index)
1276 1176 {
1277 1177 cur_width = HP_WIDTH;
1278 1178 cur_height = HP_HEIGHT;
... ... @@ -1280,12 +1180,12 @@ DWORD ThreadProcess(LPVOID param)
1280 1180 human_idx.emplace_back(copy_obj_count);
1281 1181 human_obj_keys.emplace_back (newObj);
1282 1182 }
1283   - else if (1 == pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index || 2 == pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index)
  1183 + else if (1 == m_snaphot_helper.snapShotInfo[newObj].index.index || 2 == m_snaphot_helper.snapShotInfo[newObj].index.index)
1284 1184 {
1285 1185 cur_width = HCP_WIDTH;
1286 1186 cur_height = HCP_HEIGHT;
1287 1187 }
1288   - else if (8 == pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index || (pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index >= 4 && pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index <= 6))
  1188 + else if (8 == m_snaphot_helper.snapShotInfo[newObj].index.index || (m_snaphot_helper.snapShotInfo[newObj].index.index >= 4 && m_snaphot_helper.snapShotInfo[newObj].index.index <= 6))
1289 1189 {
1290 1190 cur_width = VEHICLE_WIDTH;
1291 1191 cur_height = VEHICLE_HEIGHT;
... ... @@ -1298,11 +1198,11 @@ DWORD ThreadProcess(LPVOID param)
1298 1198  
1299 1199 if (cur_width != 0 && cur_height != 0)
1300 1200 {
1301   - cudaMalloc((void**)&pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, IMG_CHANNELS * cur_width * cur_height * sizeof(unsigned char));
1302   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height = cur_height;
1303   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width = cur_width;
  1201 + cudaMalloc((void**)&m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, IMG_CHANNELS * cur_width * cur_height * sizeof(unsigned char));
  1202 + m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height = cur_height;
  1203 + m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width = cur_width;
1304 1204  
1305   - snapshot_image_data[copy_obj_count] = (unsigned char*)pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame;
  1205 + snapshot_image_data[copy_obj_count] = (unsigned char*)m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame;
1306 1206 snapshot_left[copy_obj_count] = vLeft;
1307 1207 snapshot_top[copy_obj_count] = vTop;
1308 1208 snapshot_right[copy_obj_count] = vRight;
... ... @@ -1318,59 +1218,59 @@ DWORD ThreadProcess(LPVOID param)
1318 1218 {
1319 1219 //DxAppendLog(DxLOG_INFO, "36");
1320 1220 bool updateShotInfo = false;
1321   - int oldIndex = pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index;
1322   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].frameCount = pThreadParam->tasks[*iter].taskFrameCount;
1323   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].isupdate = true;
1324   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].lost = 0;
  1221 + int oldIndex = m_snaphot_helper.snapShotInfo[newObj].index.index;
  1222 + m_snaphot_helper.snapShotInfo[newObj].frameCount = tasks[*iter].taskFrameCount;
  1223 + m_snaphot_helper.snapShotInfo[newObj].isupdate = true;
  1224 + m_snaphot_helper.snapShotInfo[newObj].lost = 0;
1325 1225  
1326   - if (pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.count == 0)
  1226 + if (m_snaphot_helper.snapShotInfo[newObj].index.count == 0)
1327 1227 {
1328   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.count++;
1329   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index = pThreadParam->VPTResult[i].obj[c].index;
  1228 + m_snaphot_helper.snapShotInfo[newObj].index.count++;
  1229 + m_snaphot_helper.snapShotInfo[newObj].index.index = VPTResult[i].obj[c].index;
1330 1230 }
1331 1231 else
1332 1232 {
1333   - if (pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index == pThreadParam->VPTResult[i].obj[c].index)
1334   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.count++;
  1233 + if (m_snaphot_helper.snapShotInfo[newObj].index.index == VPTResult[i].obj[c].index)
  1234 + m_snaphot_helper.snapShotInfo[newObj].index.count++;
1335 1235 else
1336   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.count--;
  1236 + m_snaphot_helper.snapShotInfo[newObj].index.count--;
1337 1237 }
1338   - if (oldIndex != pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index)
  1238 + if (oldIndex != m_snaphot_helper.snapShotInfo[newObj].index.index)
1339 1239 {
1340 1240 updateShotInfo = true;
1341 1241 }
1342 1242  
1343   - int left = max(0, (int)(pThreadParam->VPTResult[i].obj[c].left - boundaryLittle));
1344   - int top = max(0, (int)(pThreadParam->VPTResult[i].obj[c].top - boundaryLittle));
1345   - int right = min(frameWidth - 1, (int)(pThreadParam->VPTResult[i].obj[c].right + boundaryLittle));
1346   - int bottom = min(frameHeight - 1, (int)(pThreadParam->VPTResult[i].obj[c].bottom + boundaryLittle));
  1243 + int left = max(0, (int)(VPTResult[i].obj[c].left - boundaryLittle));
  1244 + int top = max(0, (int)(VPTResult[i].obj[c].top - boundaryLittle));
  1245 + int right = min(frameWidth - 1, (int)(VPTResult[i].obj[c].right + boundaryLittle));
  1246 + int bottom = min(frameHeight - 1, (int)(VPTResult[i].obj[c].bottom + boundaryLittle));
1347 1247  
1348   - int maxArea = (pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.right - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.left)*(pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.bottom - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.top);
  1248 + int maxArea = (m_snaphot_helper.snapShotInfo[newObj].box.right - m_snaphot_helper.snapShotInfo[newObj].box.left)*(m_snaphot_helper.snapShotInfo[newObj].box.bottom - m_snaphot_helper.snapShotInfo[newObj].box.top);
1349 1249  
1350   - if ((LegalArea(maxArea, pThreadParam->m_snaphot_helper.snapShotInfo[newObj].lastArea, left, top, right, bottom)
1351   - && LegalPos(pThreadParam->m_snaphot_helper.snapShotInfo[newObj].flags, left, top, right, bottom, frameHeight, frameWidth)
1352   - && LegalMinArea(cur_real_width, cur_real_height, pThreadParam->tasks[*iter].task_min_boxsize[cur_real_index])) || updateShotInfo)
  1250 + if ((LegalArea(maxArea, m_snaphot_helper.snapShotInfo[newObj].lastArea, left, top, right, bottom)
  1251 + && LegalPos(m_snaphot_helper.snapShotInfo[newObj].flags, left, top, right, bottom, frameHeight, frameWidth)
  1252 + && LegalMinArea(cur_real_width, cur_real_height, tasks[*iter].task_min_boxsize[cur_real_index])) || updateShotInfo)
1353 1253 {
1354 1254 //DxAppendLog(DxLOG_INFO, "37");
1355   - int boundary_w = (pThreadParam->VPTResult[i].obj[c].right - pThreadParam->VPTResult[i].obj[c].left) * 0.1;
1356   - int boundary_h = (pThreadParam->VPTResult[i].obj[c].bottom - pThreadParam->VPTResult[i].obj[c].top)* 0.1;
  1255 + int boundary_w = (VPTResult[i].obj[c].right - VPTResult[i].obj[c].left) * 0.1;
  1256 + int boundary_h = (VPTResult[i].obj[c].bottom - VPTResult[i].obj[c].top)* 0.1;
1357 1257  
1358 1258 int boundary_left = boundary_w, boundary_right = boundary_w, boundary_top = boundary_h, boundary_bottom = boundary_h;
1359 1259  
1360   - ExpandMargin((left - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.left),
1361   - (bottom - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.bottom),
  1260 + ExpandMargin((left - m_snaphot_helper.snapShotInfo[newObj].box.left),
  1261 + (bottom - m_snaphot_helper.snapShotInfo[newObj].box.bottom),
1362 1262 boundary_w, boundary_h, boundary_left, boundary_right, boundary_top, boundary_bottom);
1363 1263  
1364   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.left = left;
1365   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.top = top;
1366   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.right = right;
1367   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].box.bottom = bottom;
  1264 + m_snaphot_helper.snapShotInfo[newObj].box.left = left;
  1265 + m_snaphot_helper.snapShotInfo[newObj].box.top = top;
  1266 + m_snaphot_helper.snapShotInfo[newObj].box.right = right;
  1267 + m_snaphot_helper.snapShotInfo[newObj].box.bottom = bottom;
1368 1268 //printf("ori: %d %d %d %d\n", left, top, right - left, bottom - top);
1369   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].confidence = pThreadParam->VPTResult[i].obj[c].confidence;
1370   - if (pThreadParam->tasks[*iter].folderName != NULL)
  1269 + m_snaphot_helper.snapShotInfo[newObj].confidence = VPTResult[i].obj[c].confidence;
  1270 + if (tasks[*iter].folderName != NULL)
1371 1271 {
1372   - FRAME_KEY frame_id = { (*iter),pThreadParam->tasks[*iter].taskFrameCount };
1373   - pThreadParam->m_snaphot_helper.ImgSaveCache.insert(newObj, frame_id, pThreadParam->tasks[*iter].task_algorithm_data);
  1272 + FRAME_KEY frame_id = { (*iter),tasks[*iter].taskFrameCount };
  1273 + m_snaphot_helper.ImgSaveCache.insert(newObj, frame_id, tasks[*iter].task_algorithm_data);
1374 1274 }
1375 1275  
1376 1276  
... ... @@ -1380,27 +1280,27 @@ DWORD ThreadProcess(LPVOID param)
1380 1280 int vRight = 0;
1381 1281 int vBottom = 0;
1382 1282  
1383   - vLeft = max(0, pThreadParam->VPTResult[i].obj[c].left - boundary_left);
1384   - vTop = max(0, pThreadParam->VPTResult[i].obj[c].top - boundary_top);
1385   - vRight = min(frameWidth - 1, pThreadParam->VPTResult[i].obj[c].right + boundary_right);
1386   - vBottom = min(frameHeight - 1, pThreadParam->VPTResult[i].obj[c].bottom + boundary_bottom);
1387   - if (pThreadParam->tasks[*iter].folderNameLittle != NULL)
  1283 + vLeft = max(0, VPTResult[i].obj[c].left - boundary_left);
  1284 + vTop = max(0, VPTResult[i].obj[c].top - boundary_top);
  1285 + vRight = min(frameWidth - 1, VPTResult[i].obj[c].right + boundary_right);
  1286 + vBottom = min(frameHeight - 1, VPTResult[i].obj[c].bottom + boundary_bottom);
  1287 + if (tasks[*iter].folderNameLittle != NULL)
1388 1288 {
1389 1289  
1390   - if (0 == pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index)
  1290 + if (0 == m_snaphot_helper.snapShotInfo[newObj].index.index)
1391 1291 {
1392   - if (pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width != HP_WIDTH || pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height != HP_HEIGHT)
  1292 + if (m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width != HP_WIDTH || m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height != HP_HEIGHT)
1393 1293 {
1394   - cudaFree(pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame); //释放显存
1395   - cudaMalloc((void**)&pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, 3 * HP_WIDTH * HP_HEIGHT * sizeof(unsigned char));
1396   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width = HP_WIDTH;
1397   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height = HP_HEIGHT;
  1294 + cudaFree(m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame); //释放显存
  1295 + cudaMalloc((void**)&m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, 3 * HP_WIDTH * HP_HEIGHT * sizeof(unsigned char));
  1296 + m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width = HP_WIDTH;
  1297 + m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height = HP_HEIGHT;
1398 1298 }
1399 1299  
1400 1300 human_idx.push_back(copy_obj_count);
1401 1301 human_obj_keys.emplace_back(newObj);
1402 1302  
1403   - snapshot_image_data[copy_obj_count] = (unsigned char*)pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame;
  1303 + snapshot_image_data[copy_obj_count] = (unsigned char*)m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame;
1404 1304 snapshot_left[copy_obj_count] = vLeft;
1405 1305 snapshot_top[copy_obj_count] = vTop;
1406 1306 snapshot_right[copy_obj_count] = vRight;
... ... @@ -1410,19 +1310,19 @@ DWORD ThreadProcess(LPVOID param)
1410 1310 snapshot_dst_height[copy_obj_count++] = HP_HEIGHT;
1411 1311  
1412 1312 }
1413   - else if (1 == pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index || 2 == pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index)
  1313 + else if (1 == m_snaphot_helper.snapShotInfo[newObj].index.index || 2 == m_snaphot_helper.snapShotInfo[newObj].index.index)
1414 1314 {
1415 1315 //DxAppendLog(DxLOG_INFO, "42");
1416   - if (pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width != HCP_WIDTH || pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height != HCP_HEIGHT)
  1316 + if (m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width != HCP_WIDTH || m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height != HCP_HEIGHT)
1417 1317 {
1418 1318 //DxAppendLog(DxLOG_INFO, "43");
1419   - cudaFree(pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame); //释放显存
1420   - cudaMalloc((void**)&pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, 3 * HCP_WIDTH * HCP_HEIGHT * sizeof(unsigned char));
1421   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width = HCP_WIDTH;
1422   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height = HCP_HEIGHT;
  1319 + cudaFree(m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame); //释放显存
  1320 + cudaMalloc((void**)&m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, 3 * HCP_WIDTH * HCP_HEIGHT * sizeof(unsigned char));
  1321 + m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width = HCP_WIDTH;
  1322 + m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height = HCP_HEIGHT;
1423 1323 }
1424 1324  
1425   - snapshot_image_data[copy_obj_count] = (unsigned char*)pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame;
  1325 + snapshot_image_data[copy_obj_count] = (unsigned char*)m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame;
1426 1326 snapshot_left[copy_obj_count] = vLeft;
1427 1327 snapshot_top[copy_obj_count] = vTop;
1428 1328 snapshot_right[copy_obj_count] = vRight;
... ... @@ -1432,19 +1332,19 @@ DWORD ThreadProcess(LPVOID param)
1432 1332 snapshot_dst_height[copy_obj_count++] = HCP_HEIGHT;
1433 1333  
1434 1334 }
1435   - else if (8 == pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index || (pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index >= 4 && pThreadParam->m_snaphot_helper.snapShotInfo[newObj].index.index <= 6))
  1335 + else if (8 == m_snaphot_helper.snapShotInfo[newObj].index.index || (m_snaphot_helper.snapShotInfo[newObj].index.index >= 4 && m_snaphot_helper.snapShotInfo[newObj].index.index <= 6))
1436 1336 {
1437 1337 //DxAppendLog(DxLOG_INFO, "43.1");
1438   - if (pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width != VEHICLE_WIDTH || pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height != VEHICLE_HEIGHT)
  1338 + if (m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width != VEHICLE_WIDTH || m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height != VEHICLE_HEIGHT)
1439 1339 {
1440 1340 //DxAppendLog(DxLOG_INFO, "44");
1441   - cudaFree(pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame); //释放显存
1442   - cudaMalloc((void**)&pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, 3 * VEHICLE_WIDTH * VEHICLE_HEIGHT * sizeof(unsigned char));
1443   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width = VEHICLE_WIDTH;
1444   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height = VEHICLE_HEIGHT;
  1341 + cudaFree(m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame); //释放显存
  1342 + cudaMalloc((void**)&m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, 3 * VEHICLE_WIDTH * VEHICLE_HEIGHT * sizeof(unsigned char));
  1343 + m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width = VEHICLE_WIDTH;
  1344 + m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height = VEHICLE_HEIGHT;
1445 1345 }
1446 1346  
1447   - snapshot_image_data[copy_obj_count] = (unsigned char*)pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame;
  1347 + snapshot_image_data[copy_obj_count] = (unsigned char*)m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame;
1448 1348 snapshot_left[copy_obj_count] = vLeft;
1449 1349 snapshot_top[copy_obj_count] = vTop;
1450 1350 snapshot_right[copy_obj_count] = vRight;
... ... @@ -1462,20 +1362,20 @@ DWORD ThreadProcess(LPVOID param)
1462 1362 int cur_height = vBottom - vTop;
1463 1363 if (cur_width != 0 && cur_height != 0) {
1464 1364 //----------------------------------------
1465   - cudaFree(pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame); //释放显存
1466   - cudaMalloc((void**)&pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, 3 * (vBottom - vTop)*(vRight - vLeft) * sizeof(unsigned char));
1467   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height = vBottom - vTop;
1468   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width = vRight - vLeft;
  1365 + cudaFree(m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame); //释放显存
  1366 + cudaMalloc((void**)&m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, 3 * (vBottom - vTop)*(vRight - vLeft) * sizeof(unsigned char));
  1367 + m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.height = vBottom - vTop;
  1368 + m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.width = vRight - vLeft;
1469 1369  
1470 1370 //printf("begin partMemCopy: %d %d %d %d %d %d\n", vLeft, vTop, vRight, vBottom, frameWidth, frameHeight);
1471   - partMemCopy((unsigned char*)pThreadParam->tasks[*iter].task_algorithm_data.frame, frameWidth, frameHeight,
1472   - (unsigned char*)pThreadParam->m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, vLeft, vTop, vRight, vBottom);
  1371 + partMemCopy((unsigned char*)tasks[*iter].task_algorithm_data.frame, frameWidth, frameHeight,
  1372 + (unsigned char*)m_snaphot_helper.snapShotInfo[newObj].snapShotLittle.frame, vLeft, vTop, vRight, vBottom);
1473 1373 }
1474 1374 }
1475 1375  
1476 1376 }
1477 1377 }
1478   - pThreadParam->m_snaphot_helper.snapShotInfo[newObj].lastArea = (bottom - top)*(right - left);
  1378 + m_snaphot_helper.snapShotInfo[newObj].lastArea = (bottom - top)*(right - left);
1479 1379 }
1480 1380  
1481 1381 }
... ... @@ -1483,14 +1383,14 @@ DWORD ThreadProcess(LPVOID param)
1483 1383 //若待抠图的快照数不为0 则进行批量抠图
1484 1384 if (0 != copy_obj_count)
1485 1385 {
1486   - cudaSetDevice(pThreadParam->mgpuid);
  1386 + cudaSetDevice(mgpuid);
1487 1387 cuCtxPushCurrent(context);
1488   - PartMemResizeBatch((unsigned char*)pThreadParam->tasks[*iter].task_algorithm_data.frame, frameWidth, frameHeight,
  1388 + PartMemResizeBatch((unsigned char*)tasks[*iter].task_algorithm_data.frame, frameWidth, frameHeight,
1489 1389 snapshot_image_data, copy_obj_count, snapshot_left, snapshot_top, snapshot_right, snapshot_bottom, snapshot_dst_width, snapshot_dst_height, 0, 0, 0, 1, 1, 1);
1490 1390 cuCtxPopCurrent(&context);
1491 1391  
1492 1392 //最新刚添加的人脸检测模块,针对存在的行人快照进行人脸检测+人脸快照框的优选
1493   - if (pThreadParam->m_face_det_config == SY_CONFIG_OPEN && !human_idx.empty())
  1393 + if (m_face_det_config == SY_CONFIG_OPEN && !human_idx.empty())
1494 1394 {
1495 1395 //需要做人脸检测
1496 1396 int human_count = human_idx.size();
... ... @@ -1511,7 +1411,7 @@ DWORD ThreadProcess(LPVOID param)
1511 1411 face_det_result[fd_i].info = new fd_info[10]; //内存由外部申请
1512 1412 }
1513 1413  
1514   - if (pThreadParam->m_face_det_module->face_det_module_process(human_img, human_count, face_det_result, ori_points) == SUCCESS)
  1414 + if (m_face_det_module->face_det_module_process(human_img, human_count, face_det_result, ori_points) == SUCCESS)
1515 1415 {
1516 1416 //printf("finish face_det_module_process: %d\n", human_count);
1517 1417 for (int idx = 0; idx < human_count; idx++)
... ... @@ -1543,7 +1443,7 @@ DWORD ThreadProcess(LPVOID param)
1543 1443 }
1544 1444  
1545 1445 fd_info& cur_det_info = cur_det_res.info[face_idx];
1546   - if (pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame == nullptr)
  1446 + if (m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame == nullptr)
1547 1447 {
1548 1448 sy_rect face_ori_rect = { (int)(snapshot_left[ii] + cur_det_info.face_position.left_ ),
1549 1449 (int)(snapshot_top[ii] + cur_det_info.face_position.top_),
... ... @@ -1551,8 +1451,8 @@ DWORD ThreadProcess(LPVOID param)
1551 1451  
1552 1452 int new_left = max(0, face_ori_rect.left_ - face_ori_rect.width_);
1553 1453 int new_top = max(0, face_ori_rect.top_ - face_ori_rect.height_);
1554   - int new_right = min((int)pThreadParam->tasks[*iter].task_algorithm_data.width - 1, (face_ori_rect.left_ + 2 * face_ori_rect.width_));
1555   - int new_bottom = min((int)pThreadParam->tasks[*iter].task_algorithm_data.height - 1, (face_ori_rect.top_ + 2 * face_ori_rect.height_));
  1454 + int new_right = min((int)tasks[*iter].task_algorithm_data.width - 1, (face_ori_rect.left_ + 2 * face_ori_rect.width_));
  1455 + int new_bottom = min((int)tasks[*iter].task_algorithm_data.height - 1, (face_ori_rect.top_ + 2 * face_ori_rect.height_));
1556 1456 int new_width = new_right - new_left;
1557 1457 int new_height = new_bottom - new_top;
1558 1458  
... ... @@ -1560,18 +1460,18 @@ DWORD ThreadProcess(LPVOID param)
1560 1460  
1561 1461 int face_img_length = 3 * face_expand_rect.width_ * face_expand_rect.height_;
1562 1462  
1563   - cudaError_t cudaStatus = cudaMalloc((void**)&pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame, face_img_length * sizeof(unsigned char));
  1463 + cudaError_t cudaStatus = cudaMalloc((void**)&m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame, face_img_length * sizeof(unsigned char));
1564 1464 if (cudaStatus != cudaSuccess) {
1565 1465 fprintf(stderr, "here cudaMalloc frame[0] failed! error: %s\n", cudaGetErrorString(cudaStatus));
1566 1466 break;
1567 1467 }
1568 1468  
1569   - pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.width = face_expand_rect.width_;
1570   - pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.height = face_expand_rect.height_;
1571   - memcpy((void*)&pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].face_info, (void*)&cur_det_info, sizeof(fd_info));
  1469 + m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.width = face_expand_rect.width_;
  1470 + m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.height = face_expand_rect.height_;
  1471 + memcpy((void*)&m_snaphot_helper.snapShotInfo[cur_obj_key].face_info, (void*)&cur_det_info, sizeof(fd_info));
1572 1472  
1573 1473 //矫正坐标 从行人抠图检测结果 -> 人脸外扩抠图坐标
1574   - fd_info& tmp_info = pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].face_info;
  1474 + fd_info& tmp_info = m_snaphot_helper.snapShotInfo[cur_obj_key].face_info;
1575 1475  
1576 1476 for (int p = 0; p < FACIALFEAPOINTSIZE; p++)
1577 1477 {
... ... @@ -1581,14 +1481,14 @@ DWORD ThreadProcess(LPVOID param)
1581 1481 tmp_info.facial_fea_point[p].y_ - tmp_info.face_position.top_ + (face_ori_rect.top_ - face_expand_rect.top_);
1582 1482 }
1583 1483  
1584   - pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].face_info.face_position =
  1484 + m_snaphot_helper.snapShotInfo[cur_obj_key].face_info.face_position =
1585 1485 { (face_ori_rect.left_ - face_expand_rect.left_), (face_ori_rect.top_ - face_expand_rect.top_), face_ori_rect.width_, face_ori_rect.height_ };
1586 1486  
1587 1487  
1588   - cudacommon::CropImgGpu((unsigned char*)pThreadParam->tasks[*iter].task_algorithm_data.frame, pThreadParam->tasks[*iter].task_algorithm_data.width, pThreadParam->tasks[*iter].task_algorithm_data.height,
1589   - (unsigned char*)pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame, face_expand_rect.left_, face_expand_rect.top_, face_expand_rect.width_, face_expand_rect.height_);
  1488 + cudacommon::CropImgGpu((unsigned char*)tasks[*iter].task_algorithm_data.frame, tasks[*iter].task_algorithm_data.width, tasks[*iter].task_algorithm_data.height,
  1489 + (unsigned char*)m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame, face_expand_rect.left_, face_expand_rect.top_, face_expand_rect.width_, face_expand_rect.height_);
1590 1490  
1591   - //show_gpu_img_func(pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace);
  1491 + //show_gpu_img_func(m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace);
1592 1492 }
1593 1493 else
1594 1494 {
... ... @@ -1598,12 +1498,12 @@ DWORD ThreadProcess(LPVOID param)
1598 1498  
1599 1499 //更新人脸快照条件:① 角度满足条件 ② 面积比之前人脸面积大
1600 1500 if (validAngle(cur_det_res.info[face_idx].roll, cur_det_res.info[face_idx].yaw, cur_det_res.info[face_idx].pitch, 15.0, 20.0)
1601   - && betterArea(face_ori_rect, pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].face_info.face_position))
  1501 + && betterArea(face_ori_rect, m_snaphot_helper.snapShotInfo[cur_obj_key].face_info.face_position))
1602 1502 {
1603 1503 int new_left = max(0, face_ori_rect.left_ - face_ori_rect.width_);
1604 1504 int new_top = max(0, face_ori_rect.top_ - face_ori_rect.height_);
1605   - int new_right = min((int)pThreadParam->tasks[*iter].task_algorithm_data.width - 1, (face_ori_rect.left_ + 2 * face_ori_rect.width_));
1606   - int new_bottom = min((int)pThreadParam->tasks[*iter].task_algorithm_data.height - 1, (face_ori_rect.top_ + 2 * face_ori_rect.height_));
  1505 + int new_right = min((int)tasks[*iter].task_algorithm_data.width - 1, (face_ori_rect.left_ + 2 * face_ori_rect.width_));
  1506 + int new_bottom = min((int)tasks[*iter].task_algorithm_data.height - 1, (face_ori_rect.top_ + 2 * face_ori_rect.height_));
1607 1507 int new_width = new_right - new_left;
1608 1508 int new_height = new_bottom - new_top;
1609 1509  
... ... @@ -1612,19 +1512,19 @@ DWORD ThreadProcess(LPVOID param)
1612 1512 //更新快照
1613 1513 int face_img_length = 3 * face_expand_rect.width_ * face_expand_rect.height_;
1614 1514  
1615   - cudaFree(pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame);
1616   - cudaError_t cudaStatus = cudaMalloc((void**)&pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame, face_img_length * sizeof(unsigned char));
  1515 + cudaFree(m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame);
  1516 + cudaError_t cudaStatus = cudaMalloc((void**)&m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame, face_img_length * sizeof(unsigned char));
1617 1517 if (cudaStatus != cudaSuccess) {
1618 1518 fprintf(stderr, "here cudaMalloc frame[0] failed! error: %s\n", cudaGetErrorString(cudaStatus));
1619 1519 break;
1620 1520 }
1621 1521  
1622   - pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.width = face_expand_rect.width_;
1623   - pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.height = face_expand_rect.height_;
1624   - memcpy((void*)&pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].face_info, (void*)&cur_det_info, sizeof(fd_info));
  1522 + m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.width = face_expand_rect.width_;
  1523 + m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.height = face_expand_rect.height_;
  1524 + memcpy((void*)&m_snaphot_helper.snapShotInfo[cur_obj_key].face_info, (void*)&cur_det_info, sizeof(fd_info));
1625 1525  
1626 1526 //矫正坐标 从行人抠图检测结果 -> 人脸外扩抠图坐标
1627   - fd_info& tmp_info = pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].face_info;
  1527 + fd_info& tmp_info = m_snaphot_helper.snapShotInfo[cur_obj_key].face_info;
1628 1528  
1629 1529 for (int p = 0; p < FACIALFEAPOINTSIZE; p++)
1630 1530 {
... ... @@ -1634,15 +1534,15 @@ DWORD ThreadProcess(LPVOID param)
1634 1534 tmp_info.facial_fea_point[p].y_ - tmp_info.face_position.top_ + (face_ori_rect.top_ - face_expand_rect.top_);
1635 1535 }
1636 1536  
1637   - pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].face_info.face_position =
  1537 + m_snaphot_helper.snapShotInfo[cur_obj_key].face_info.face_position =
1638 1538 {(face_ori_rect.left_ - face_expand_rect.left_), (face_ori_rect.top_ - face_expand_rect.top_), face_ori_rect.width_, face_ori_rect.height_};
1639 1539  
1640   - cudacommon::CropImgGpu((unsigned char*)pThreadParam->tasks[*iter].task_algorithm_data.frame, pThreadParam->tasks[*iter].task_algorithm_data.width, pThreadParam->tasks[*iter].task_algorithm_data.height,
1641   - (unsigned char*)pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame, face_expand_rect.left_, face_expand_rect.top_, face_expand_rect.width_, face_expand_rect.height_);
  1540 + cudacommon::CropImgGpu((unsigned char*)tasks[*iter].task_algorithm_data.frame, tasks[*iter].task_algorithm_data.width, tasks[*iter].task_algorithm_data.height,
  1541 + (unsigned char*)m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace.frame, face_expand_rect.left_, face_expand_rect.top_, face_expand_rect.width_, face_expand_rect.height_);
1642 1542  
1643   - //show_gpu_image_withfdinfo_(pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace, cur_det_info);
  1543 + //show_gpu_image_withfdinfo_(m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace, cur_det_info);
1644 1544  
1645   - //show_gpu_image_withfdinfo_(pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace, pThreadParam->m_snaphot_helper.snapShotInfo[cur_obj_key].face_info);
  1545 + //show_gpu_image_withfdinfo_(m_snaphot_helper.snapShotInfo[cur_obj_key].snapShotFace, m_snaphot_helper.snapShotInfo[cur_obj_key].face_info);
1646 1546 }
1647 1547 }
1648 1548 }
... ... @@ -1663,11 +1563,11 @@ DWORD ThreadProcess(LPVOID param)
1663 1563 //实时查看 绘制目标轨迹 回调函数返回
1664 1564 if (view)
1665 1565 {
1666   - DrawTracker(pThreadParam->VPT_Handle, *iter, &pThreadParam->tasks[*iter].frameImage);
1667   - if (pThreadParam->tasks[*iter].taskRealTimeCallbackFunc != nullptr)
1668   - pThreadParam->tasks[*iter].taskRealTimeCallbackFunc(pThreadParam->tasks[*iter].frameImage.data, pThreadParam->tasks[*iter].frameImage.rows, pThreadParam->tasks[*iter].frameImage.cols);
  1566 + DrawTracker(VPT_Handle, *iter, &tasks[*iter].frameImage);
  1567 + if (tasks[*iter].taskRealTimeCallbackFunc != nullptr)
  1568 + tasks[*iter].taskRealTimeCallbackFunc(tasks[*iter].frameImage.data, tasks[*iter].frameImage.rows, tasks[*iter].frameImage.cols);
1669 1569 }
1670   - // pThreadParam->tasks[*iter].taskFrameCount += pThreadParam->skip_frame_;
  1570 + // tasks[*iter].taskFrameCount += skip_frame_;
1671 1571 iter++;
1672 1572 }
1673 1573  
... ... @@ -1677,9 +1577,9 @@ DWORD ThreadProcess(LPVOID param)
1677 1577 #endif
1678 1578  
1679 1579  
1680   - auto task_iter = pThreadParam->TaskinPlayID.begin();
  1580 + auto task_iter = TaskinPlayID.begin();
1681 1581  
1682   - pThreadParam->AttributionAnalysis = false;
  1582 + AttributionAnalysis = false;
1683 1583  
1684 1584 long long second_analysis_time = get_cur_time_ms();
1685 1585  
... ... @@ -1689,20 +1589,20 @@ DWORD ThreadProcess(LPVOID param)
1689 1589 {
1690 1590 OBJ_KEY deleteObj = { *task_iter, deleteObjectID[i][j] };
1691 1591  
1692   - if (pThreadParam->m_snaphot_helper.snapShotInfo.find(deleteObj) == pThreadParam->m_snaphot_helper.snapShotInfo.end())
  1592 + if (m_snaphot_helper.snapShotInfo.find(deleteObj) == m_snaphot_helper.snapShotInfo.end())
1693 1593 continue;
1694 1594  
1695   - auto iter = pThreadParam->m_snaphot_helper.snapShotInfo.find(deleteObj);
  1595 + auto iter = m_snaphot_helper.snapShotInfo.find(deleteObj);
1696 1596 iter->second.finishTracker = true;
1697 1597  
1698   - pThreadParam->SaveResultInFile(iter->first, iter->second);
  1598 + m_snaphot_helper.SaveResultInFile(iter->first, iter->second);
1699 1599 }
1700 1600  
1701 1601 task_iter++;
1702 1602 }
1703 1603  
1704   - for (auto task_id: pThreadParam->TaskinPlayID) {
1705   - cudaFree(pThreadParam->tasks[task_id].task_algorithm_data.frame);
  1604 + for (auto task_id: TaskinPlayID) {
  1605 + cudaFree(tasks[task_id].task_algorithm_data.frame);
1706 1606 }
1707 1607  
1708 1608  
... ... @@ -1710,7 +1610,7 @@ DWORD ThreadProcess(LPVOID param)
1710 1610 vector<int>().swap(deleteObjectID[i]);
1711 1611 vector<vector<int>>().swap(deleteObjectID);
1712 1612  
1713   - pThreadParam->m_snaphot_helper.object_attri_analysis();
  1613 + m_snaphot_helper.object_attri_analysis();
1714 1614  
1715 1615 #ifdef LOG_INFO2
1716 1616 long long second_analysis_time2 = get_cur_time_ms();
... ... @@ -1743,8 +1643,8 @@ DWORD ThreadProcess(LPVOID param)
1743 1643 long long costTime1 = get_cur_time_ms() - begintime1;
1744 1644 LOG_INFO("Process Thread is Finished. total frame cost time = {} ms, process times: {}", costTime1, process_times);
1745 1645  
1746   - pThreadParam->m_snaphot_helper.snapShotInfo.clear();
1747   - pThreadParam->ProcessFlag = false;
  1646 + m_snaphot_helper.snapShotInfo.clear();
  1647 + ProcessFlag = false;
1748 1648  
1749 1649 if (batch_img != NULL)
1750 1650 {
... ... @@ -1754,8 +1654,6 @@ DWORD ThreadProcess(LPVOID param)
1754 1654  
1755 1655 cuCtxPopCurrent(nullptr);
1756 1656 cuCtxDestroy(context);
1757   -
1758   - return 0;
1759 1657 }
1760 1658  
1761 1659 int CMutliSourceVideoProcess::GetRuningNb() {
... ... @@ -1779,9 +1677,9 @@ void check_thread(void* handle)
1779 1677 char * time = wtime;
1780 1678 #endif
1781 1679  
1782   - CMutliSourceVideoProcess *pThreadParam = (CMutliSourceVideoProcess *)handle;
  1680 + CMutliSourceVideoProcess *_this = (CMutliSourceVideoProcess *)handle;
1783 1681  
1784   - while (!pThreadParam->m_bExit)
  1682 + while (!_this->m_bExit)
1785 1683 {
1786 1684 //printf("xxx check status on process...\n");
1787 1685 #ifdef _MSC_VER
... ... @@ -1792,14 +1690,14 @@ void check_thread(void* handle)
1792 1690 #endif
1793 1691 if (res < 0)
1794 1692 {
1795   - pThreadParam->licence_status = pThreadParam->licence_status - 1;
  1693 + _this->licence_status = _this->licence_status - 1;
1796 1694 printf("CMutliSourceVideoProcess licence error, ret: %d \n", res);
1797 1695 }
1798 1696 else
1799 1697 {
1800   - if (pThreadParam->licence_status < 0)
  1698 + if (_this->licence_status < 0)
1801 1699 {
1802   - pThreadParam->licence_status = 0;
  1700 + _this->licence_status = 0;
1803 1701 }
1804 1702 }
1805 1703 std::this_thread::sleep_for(std::chrono::seconds(300));
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.h
... ... @@ -225,11 +225,12 @@ public:
225 225 void ViewTask(const int taskID);
226 226 void FinishViewTask();
227 227 int FinishProcessThread();
228   - int SaveResultInFile(const OBJ_KEY & obj_key, const OBJ_VALUE & obj_value);
229 228 void FinishDecode(const int taskID);
230 229  
231 230 int GetRuningNb();
232 231  
  232 + void algorthim_process();
  233 +
233 234 private:
234 235 //bool ChangeTask;
235 236 //HANDLE handle_process;
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/HumanCarParsing.cpp
... ... @@ -73,7 +73,7 @@ int HumanCarParsing::init(int gpuid, char* auth_license)
73 73  
74 74 int HumanCarParsing::process(sy_img * batch_img, int batch_size, hcp_analysis_result *&result)
75 75 {
76   - LOG_INFO("batch_size: {}", batch_size);
  76 + LOG_DEBUG("batch_size: {}", batch_size);
77 77 hcp_batch(handle, batch_img, batch_size, result);
78 78  
79 79 for (int b = 0; b < batch_size; b++)
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.cpp
... ... @@ -90,7 +90,7 @@ void SnapshotImageWriteThreadProcess(const void * userPtr){
90 90 }
91 91  
92 92 void snapshot_helper::snapshot_helper_init(int gpuid, double gpu_total_memory, char* dbpath, char* auth_license, int wait_framecount, sy_command hp_analysis_config, \
93   - sy_command hcp_analysis_config, sy_command vehicle_analysis_config, sy_command vehicle_recg_config, sy_command vehicle_plate_det_recg_config, sy_command hf_recg_config, sy_command hcf_recg_config, sy_command vcf_recg_config)
  93 + sy_command hcp_analysis_config, sy_command vehicle_analysis_config, sy_command vehicle_recg_config, sy_command vehicle_plate_det_recg_config, sy_command hf_recg_config, sy_command hcf_recg_config, sy_command vcf_recg_config, sy_command face_detect_config)
94 94 {
95 95 hp_analysis_cf = hp_analysis_config;
96 96 hcp_analysis_cf = hcp_analysis_config;
... ... @@ -98,6 +98,7 @@ void snapshot_helper::snapshot_helper_init(int gpuid, double gpu_total_memory, c
98 98 hf_recg_cf = hf_recg_config;
99 99 hcf_recg_cf = hcf_recg_config;
100 100 vcf_recg_cf = vcf_recg_config;
  101 + face_detect_cf = face_detect_config;
101 102 char* dbpath_utf8 = nullptr;
102 103 #ifdef _MSC_VER
103 104 //dbpath_utf8 = GbkToUtf8(dbpath);
... ... @@ -2018,3 +2019,56 @@ int snapshot_helper::save_snapshot(bool is_image, bool on_image_display, OBJ_KEY
2018 2019 }
2019 2020 return 1;
2020 2021 }
  2022 +
  2023 +int snapshot_helper::SaveResultInFile(const OBJ_KEY & obj_key, const OBJ_VALUE & obj_value)
  2024 +{
  2025 + if (0 == obj_value.index.index && obj_value.snapShotLittle.width == HP_WIDTH && obj_value.snapShotLittle.height == HP_HEIGHT)
  2026 + {
  2027 + if (face_detect_cf == SY_CONFIG_OPEN)
  2028 + {
  2029 + save_face_snapshot(obj_key);
  2030 + }
  2031 +
  2032 + if (hp_analysis_cf == SY_CONFIG_OPEN || hf_recg_cf == SY_CONFIG_OPEN)
  2033 + {
  2034 + save_snapshot(obj_key);
  2035 + hp_analysis(obj_key);
  2036 + }
  2037 + else
  2038 + {
  2039 + save_without_analysis(obj_key);
  2040 + }
  2041 + }
  2042 + else if ((1 == obj_value.index.index || 2 == obj_value.index.index) && obj_value.snapShotLittle.width == HCP_WIDTH && obj_value.snapShotLittle.height == HCP_HEIGHT)
  2043 + {
  2044 + if (hcp_analysis_cf == SY_CONFIG_OPEN || hcf_recg_cf == SY_CONFIG_OPEN)
  2045 + {
  2046 + save_snapshot(obj_key);
  2047 + hcp_analysis(obj_key);
  2048 + }
  2049 + else
  2050 + {
  2051 + save_without_analysis(obj_key);
  2052 + }
  2053 + }
  2054 + else if ((8 == obj_value.index.index || (obj_value.index.index >= 4 && obj_value.index.index <= 6)) && obj_value.snapShotLittle.width == VEHICLE_WIDTH && obj_value.snapShotLittle.height == VEHICLE_HEIGHT)
  2055 + {
  2056 + //VEHICLEAnalysis(obj_key, obj_value);
  2057 + if (vehicle_analysis_cf == SY_CONFIG_OPEN || vcf_recg_cf == SY_CONFIG_OPEN)
  2058 + {
  2059 + save_snapshot(obj_key);
  2060 + vehicle_analysis(obj_key);
  2061 + }
  2062 + else
  2063 + {
  2064 + save_without_analysis(obj_key);
  2065 + }
  2066 +
  2067 + }
  2068 + else
  2069 + {
  2070 + save_without_analysis(obj_key);
  2071 + }
  2072 +
  2073 + return 0;
  2074 +}
2021 2075 \ No newline at end of file
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.h
... ... @@ -51,26 +51,6 @@ struct AABBBOX
51 51 int bottom;
52 52 };
53 53  
54   -//struct OBJ_KEY {
55   -// int videoID;
56   -// int objID;
57   -//
58   -// bool operator< (OBJ_KEY const& _A) const
59   -// {
60   -// if (videoID < _A.videoID) return true;
61   -// if (videoID == _A.videoID) return objID < _A.objID;
62   -//
63   -// return false;
64   -// }
65   -// bool operator== (OBJ_KEY const& _A) const
66   -// {
67   -// if (videoID == _A.videoID && objID == _A.objID)
68   -// return true;
69   -// else
70   -// return false;
71   -// }
72   -//};
73   -
74 54 struct OBJ_INDEX {
75 55 int index;
76 56 int count; //用于对index的计数
... ... @@ -140,12 +120,6 @@ enum {
140 120 VC_ALL_ANALYSIS
141 121 };
142 122  
143   -//enum class VC_ANALYSIS_TYPE {
144   -// VC_ANALYSIS,
145   -// VR_VF_ANALYSIS,
146   -// VPDR_ANALYSIS
147   -//};
148   -
149 123 enum class V_ANALYSIS_TYPE {
150 124 VC_ANALYSIS,
151 125 VR_VF_ANALYSIS,
... ... @@ -157,54 +131,6 @@ extern string ObjTypesEnglish[];
157 131  
158 132 class snapshot_helper
159 133 {
160   -private:
161   - queue<OBJ_KEY> count_person;
162   - queue<OBJ_KEY> count_bike;
163   - queue<OBJ_KEY> count_vehicle;
164   - //map<OBJ_KEY, hp_result> snapShotInfo_hpf;
165   - //map<OBJ_KEY, hcp_result> snapShotInfo_hcpf;
166   -
167   - vector<OBJ_KEY> count_vehicle_v; //车的二次属性分析拆为三部分时,不再使用队列,只能使用数组
168   -
169   - vector<vehicle_result> vehicle_result_v;
170   -
171   - sy_img * batch_hp = nullptr;
172   - sy_img * batch_hcp = nullptr;
173   - sy_img * batch_vehicle = nullptr;
174   - sy_img * batch_vehicle_vf = nullptr;
175   -
176   - void * hp_handle = nullptr;
177   - void * vc_handle = nullptr;
178   - void * vp_handle = nullptr;
179   - void * vr_handle = nullptr;
180   - void * vrr_handle = nullptr;
181   - void * nvf_handle = nullptr;
182   - void * vhd_handle = nullptr;
183   - void * vf_handle = nullptr;
184   - sy_command hp_analysis_cf;
185   - sy_command hcp_analysis_cf;
186   - sy_command vehicle_analysis_cf;
187   -
188   - sy_command hf_recg_cf;
189   - sy_command hcf_recg_cf;
190   - sy_command vcf_recg_cf;
191   -
192   - void * hf_handle = nullptr;
193   - void * hcf_handle = nullptr;
194   - sy_command vehicle_recg_cf;
195   - sy_command vehicle_plate_det_recg_cf;
196   - int count_vehivle_finishanalysis = 0;
197   - int OBJ_SCALE = 2;
198   - int OBJ_BATCH_COUNT = 0;
199   - int OBJ_BATCH_COUNT_VEHICLE = 0;
200   -
201   - int hp_wait_count, hcp_wait_count, vehicle_wait_count;
202   - int wait_framecount;
203   -
204   - std::thread* ProcessSnapshotThread;
205   - std::vector<std::thread*> m_vec_writeThread;
206   - bool m_bExit {false};
207   -
208 134 public:
209 135 void snapshot_thread_process();
210 136 void snapshot_imagewrite_thread_process();
... ... @@ -227,16 +153,13 @@ public:
227 153 //VC_ANALYSIS_TYPE vc_analysis;
228 154 V_ANALYSIS_TYPE v_analysis;
229 155 void snapshot_helper_init(int gpuid, double gpu_total_memory, char* dbpath, char* auth_license, int wait_framecount, sy_command hp_analysis_config, \
230   - sy_command hcp_analysis_config, sy_command vehicle_analysis_config, sy_command vehicle_recg_config, sy_command vehicle_plate_det_recg_config, sy_command hf_recg_config, sy_command hcf_recg_config, sy_command vcf_recg_config);
  156 + sy_command hcp_analysis_config, sy_command vehicle_analysis_config, sy_command vehicle_recg_config, sy_command vehicle_plate_det_recg_config, sy_command hf_recg_config, sy_command hcf_recg_config, sy_command vcf_recg_config, sy_command face_detect_config);
231 157 void snapshot_helper_release();
232 158 void add_task_info(int new_task_id, TASK_INFO new_task_info);
233 159 void delete_task_info(int new_task_id, TASK_INFO new_task_info);
234   - int save_snapshot(bool is_image, bool on_image_display, OBJ_KEY obj_key, char* filename, char* mode, float* imgData, int width, int height, int taskID, int objID, int recFlag, int left, int top, int right, int bottom);
235   - int save_snapshot(bool is_image, bool on_image_display, OBJ_KEY obj_key, char* filename, char* mode, unsigned char* imgData, int width, int height, int taskID, int objID, int recFlag, int left, int top, int right, int bottom);
236   - int save_snapshot(OBJ_KEY obj_key);
237   - int save_face_snapshot(OBJ_KEY obj_key);
  160 +
  161 + int SaveResultInFile(const OBJ_KEY & obj_key, const OBJ_VALUE & obj_value);
238 162  
239   - void save_without_analysis(OBJ_KEY obj_key);
240 163 void erase_snapshotImage(OBJ_KEY obj_key);
241 164 //整体的三种二次属性分析
242 165 void hp_analysis(OBJ_KEY obj_key);
... ... @@ -248,14 +171,69 @@ public:
248 171 bool vehicle_color_analysis();
249 172 bool vehicle_recg_analysis();
250 173 bool vehicle_plate_dr_analysis();
251   -
252 174  
253 175 void finish_task_ss_analysis(int task_id, sy_command hp_analysis_config, sy_command hcp_analysis_config, sy_command vehicle_analysis_config, sy_command hf_recg_config, sy_command hcf_recg_config, sy_command vcf_recg_config);
254   - //针对车拆开的二次属性分析
255   - void VehicleRecog_Process(sy_img * batch_img, int batchsize, vr_result *&vresult, OBJ_KEY* obj_keys);
  176 +
256 177 void object_attri_analysis();
257 178 void snapshot_res_callback(OBJ_KEY obj_key,/* OBJ_VALUE obj_value,*/ void* analysisRes = NULL);
258 179  
259 180 private:
  181 + int save_snapshot(bool is_image, bool on_image_display, OBJ_KEY obj_key, char* filename, char* mode, float* imgData, int width, int height, int taskID, int objID, int recFlag, int left, int top, int right, int bottom);
  182 + int save_snapshot(bool is_image, bool on_image_display, OBJ_KEY obj_key, char* filename, char* mode, unsigned char* imgData, int width, int height, int taskID, int objID, int recFlag, int left, int top, int right, int bottom);
  183 + int save_snapshot(OBJ_KEY obj_key);
  184 + int save_face_snapshot(OBJ_KEY obj_key);
  185 +
  186 + void save_without_analysis(OBJ_KEY obj_key);
  187 +
  188 + //针对车拆开的二次属性分析
  189 + void VehicleRecog_Process(sy_img * batch_img, int batchsize, vr_result *&vresult, OBJ_KEY* obj_keys);
  190 +
  191 +private:
260 192 HumanCarParsing m_human_car_parsing;
  193 +
  194 + queue<OBJ_KEY> count_person;
  195 + queue<OBJ_KEY> count_bike;
  196 + queue<OBJ_KEY> count_vehicle;
  197 +
  198 + vector<OBJ_KEY> count_vehicle_v; //车的二次属性分析拆为三部分时,不再使用队列,只能使用数组
  199 +
  200 + vector<vehicle_result> vehicle_result_v;
  201 +
  202 + sy_img * batch_hp = nullptr;
  203 + sy_img * batch_hcp = nullptr;
  204 + sy_img * batch_vehicle = nullptr;
  205 + sy_img * batch_vehicle_vf = nullptr;
  206 +
  207 + void * hp_handle = nullptr;
  208 + void * vc_handle = nullptr;
  209 + void * vp_handle = nullptr;
  210 + void * vr_handle = nullptr;
  211 + void * vrr_handle = nullptr;
  212 + void * nvf_handle = nullptr;
  213 + void * vhd_handle = nullptr;
  214 + void * vf_handle = nullptr;
  215 + sy_command hp_analysis_cf;
  216 + sy_command hcp_analysis_cf;
  217 + sy_command vehicle_analysis_cf;
  218 + sy_command hf_recg_cf;
  219 + sy_command hcf_recg_cf;
  220 + sy_command vcf_recg_cf;
  221 + sy_command vehicle_recg_cf;
  222 + sy_command vehicle_plate_det_recg_cf;
  223 + sy_command face_detect_cf;
  224 +
  225 + void * hf_handle = nullptr;
  226 + void * hcf_handle = nullptr;
  227 +
  228 + int count_vehivle_finishanalysis = 0;
  229 + int OBJ_SCALE = 2;
  230 + int OBJ_BATCH_COUNT = 0;
  231 + int OBJ_BATCH_COUNT_VEHICLE = 0;
  232 +
  233 + int hp_wait_count, hcp_wait_count, vehicle_wait_count;
  234 + int wait_framecount;
  235 +
  236 + std::thread* ProcessSnapshotThread;
  237 + std::vector<std::thread*> m_vec_writeThread;
  238 + bool m_bExit {false};
261 239 };
262 240 \ No newline at end of file
... ...