Commit b6e71beb2708712aaf2eba28977da8a970bb79f5
1 parent
3c2078c9
初步调通jni,定时抓拍功能暂未实现;初始化中缺少人脸检测初始化
Showing
4 changed files
with
294 additions
and
152 deletions
.vscode/c_cpp_properties.json
0 → 100644
1 | +{ | |
2 | + "configurations": [ | |
3 | + { | |
4 | + "name": "linux-gcc-x64", | |
5 | + "includePath": [ | |
6 | + "${workspaceFolder}/**" | |
7 | + ], | |
8 | + "compilerPath": "/usr/bin/gcc", | |
9 | + "cStandard": "${default}", | |
10 | + "cppStandard": "${default}", | |
11 | + "intelliSenseMode": "linux-gcc-x64", | |
12 | + "compilerArgs": [ | |
13 | + "" | |
14 | + ] | |
15 | + } | |
16 | + ], | |
17 | + "version": 4 | |
18 | +} | |
0 | 19 | \ No newline at end of file | ... | ... |
.vscode/settings.json
1 | 1 | { |
2 | - "files.associations": { | |
3 | - "iostream": "cpp", | |
4 | - "array": "cpp", | |
5 | - "atomic": "cpp", | |
6 | - "hash_map": "cpp", | |
7 | - "hash_set": "cpp", | |
8 | - "bit": "cpp", | |
9 | - "*.tcc": "cpp", | |
10 | - "cctype": "cpp", | |
11 | - "chrono": "cpp", | |
12 | - "clocale": "cpp", | |
13 | - "cmath": "cpp", | |
14 | - "complex": "cpp", | |
15 | - "condition_variable": "cpp", | |
16 | - "cstdarg": "cpp", | |
17 | - "cstddef": "cpp", | |
18 | - "cstdint": "cpp", | |
19 | - "cstdio": "cpp", | |
20 | - "cstdlib": "cpp", | |
21 | - "cstring": "cpp", | |
22 | - "ctime": "cpp", | |
23 | - "cwchar": "cpp", | |
24 | - "cwctype": "cpp", | |
25 | - "deque": "cpp", | |
26 | - "list": "cpp", | |
27 | - "map": "cpp", | |
28 | - "set": "cpp", | |
29 | - "unordered_map": "cpp", | |
30 | - "unordered_set": "cpp", | |
31 | - "vector": "cpp", | |
32 | - "exception": "cpp", | |
33 | - "algorithm": "cpp", | |
34 | - "functional": "cpp", | |
35 | - "iterator": "cpp", | |
36 | - "memory": "cpp", | |
37 | - "memory_resource": "cpp", | |
38 | - "numeric": "cpp", | |
39 | - "optional": "cpp", | |
40 | - "random": "cpp", | |
41 | - "ratio": "cpp", | |
42 | - "string": "cpp", | |
43 | - "string_view": "cpp", | |
44 | - "system_error": "cpp", | |
45 | - "tuple": "cpp", | |
46 | - "type_traits": "cpp", | |
47 | - "utility": "cpp", | |
48 | - "fstream": "cpp", | |
49 | - "initializer_list": "cpp", | |
50 | - "iomanip": "cpp", | |
51 | - "iosfwd": "cpp", | |
52 | - "istream": "cpp", | |
53 | - "limits": "cpp", | |
54 | - "mutex": "cpp", | |
55 | - "new": "cpp", | |
56 | - "ostream": "cpp", | |
57 | - "sstream": "cpp", | |
58 | - "stdexcept": "cpp", | |
59 | - "streambuf": "cpp", | |
60 | - "thread": "cpp", | |
61 | - "cinttypes": "cpp", | |
62 | - "typeinfo": "cpp", | |
63 | - "bitset": "cpp", | |
64 | - "regex": "cpp", | |
65 | - "shared_mutex": "cpp", | |
66 | - "variant": "cpp", | |
67 | - "future": "cpp", | |
68 | - "typeindex": "cpp", | |
69 | - "codecvt": "cpp", | |
70 | - "*.cpp1": "cpp" | |
71 | - } | |
2 | + "files.associations": { | |
3 | + "iostream": "cpp", | |
4 | + "array": "cpp", | |
5 | + "atomic": "cpp", | |
6 | + "hash_map": "cpp", | |
7 | + "hash_set": "cpp", | |
8 | + "bit": "cpp", | |
9 | + "*.tcc": "cpp", | |
10 | + "cctype": "cpp", | |
11 | + "chrono": "cpp", | |
12 | + "clocale": "cpp", | |
13 | + "cmath": "cpp", | |
14 | + "complex": "cpp", | |
15 | + "condition_variable": "cpp", | |
16 | + "cstdarg": "cpp", | |
17 | + "cstddef": "cpp", | |
18 | + "cstdint": "cpp", | |
19 | + "cstdio": "cpp", | |
20 | + "cstdlib": "cpp", | |
21 | + "cstring": "cpp", | |
22 | + "ctime": "cpp", | |
23 | + "cwchar": "cpp", | |
24 | + "cwctype": "cpp", | |
25 | + "deque": "cpp", | |
26 | + "list": "cpp", | |
27 | + "map": "cpp", | |
28 | + "set": "cpp", | |
29 | + "unordered_map": "cpp", | |
30 | + "unordered_set": "cpp", | |
31 | + "vector": "cpp", | |
32 | + "exception": "cpp", | |
33 | + "algorithm": "cpp", | |
34 | + "functional": "cpp", | |
35 | + "iterator": "cpp", | |
36 | + "memory": "cpp", | |
37 | + "memory_resource": "cpp", | |
38 | + "numeric": "cpp", | |
39 | + "optional": "cpp", | |
40 | + "random": "cpp", | |
41 | + "ratio": "cpp", | |
42 | + "string": "cpp", | |
43 | + "string_view": "cpp", | |
44 | + "system_error": "cpp", | |
45 | + "tuple": "cpp", | |
46 | + "type_traits": "cpp", | |
47 | + "utility": "cpp", | |
48 | + "fstream": "cpp", | |
49 | + "initializer_list": "cpp", | |
50 | + "iomanip": "cpp", | |
51 | + "iosfwd": "cpp", | |
52 | + "istream": "cpp", | |
53 | + "limits": "cpp", | |
54 | + "mutex": "cpp", | |
55 | + "new": "cpp", | |
56 | + "ostream": "cpp", | |
57 | + "sstream": "cpp", | |
58 | + "stdexcept": "cpp", | |
59 | + "streambuf": "cpp", | |
60 | + "thread": "cpp", | |
61 | + "cinttypes": "cpp", | |
62 | + "typeinfo": "cpp", | |
63 | + "bitset": "cpp", | |
64 | + "regex": "cpp", | |
65 | + "shared_mutex": "cpp", | |
66 | + "variant": "cpp", | |
67 | + "future": "cpp", | |
68 | + "typeindex": "cpp", | |
69 | + "codecvt": "cpp", | |
70 | + "*.cpp1": "cpp" | |
71 | + }, | |
72 | + "C_Cpp_Runner.cCompilerPath": "gcc", | |
73 | + "C_Cpp_Runner.cppCompilerPath": "g++", | |
74 | + "C_Cpp_Runner.debuggerPath": "gdb", | |
75 | + "C_Cpp_Runner.cStandard": "", | |
76 | + "C_Cpp_Runner.cppStandard": "", | |
77 | + "C_Cpp_Runner.msvcBatchPath": "", | |
78 | + "C_Cpp_Runner.useMsvc": false, | |
79 | + "C_Cpp_Runner.warnings": [ | |
80 | + "-Wall", | |
81 | + "-Wextra", | |
82 | + "-Wpedantic", | |
83 | + "-Wshadow", | |
84 | + "-Wformat=2", | |
85 | + "-Wcast-align", | |
86 | + "-Wconversion", | |
87 | + "-Wsign-conversion", | |
88 | + "-Wnull-dereference" | |
89 | + ], | |
90 | + "C_Cpp_Runner.msvcWarnings": [ | |
91 | + "/W4", | |
92 | + "/permissive-", | |
93 | + "/w14242", | |
94 | + "/w14287", | |
95 | + "/w14296", | |
96 | + "/w14311", | |
97 | + "/w14826", | |
98 | + "/w44062", | |
99 | + "/w44242", | |
100 | + "/w14905", | |
101 | + "/w14906", | |
102 | + "/w14263", | |
103 | + "/w44265", | |
104 | + "/w14928" | |
105 | + ], | |
106 | + "C_Cpp_Runner.enableWarnings": true, | |
107 | + "C_Cpp_Runner.warningsAsError": false, | |
108 | + "C_Cpp_Runner.compilerArgs": [], | |
109 | + "C_Cpp_Runner.linkerArgs": [], | |
110 | + "C_Cpp_Runner.includePaths": [], | |
111 | + "C_Cpp_Runner.includeSearch": [ | |
112 | + "*", | |
113 | + "**/*" | |
114 | + ], | |
115 | + "C_Cpp_Runner.excludeSearch": [ | |
116 | + "**/build", | |
117 | + "**/build/**", | |
118 | + "**/.*", | |
119 | + "**/.*/**", | |
120 | + "**/.vscode", | |
121 | + "**/.vscode/**" | |
122 | + ], | |
123 | + "C_Cpp_Runner.useAddressSanitizer": false, | |
124 | + "C_Cpp_Runner.useUndefinedSanitizer": false, | |
125 | + "C_Cpp_Runner.useLeakSanitizer": false, | |
126 | + "C_Cpp_Runner.showCompilationTime": false, | |
127 | + "C_Cpp_Runner.useLinkTimeOptimization": false, | |
128 | + "C_Cpp_Runner.msvcSecureNoWarnings": false | |
72 | 129 | } |
73 | 130 | \ No newline at end of file | ... | ... |
src/ai_platform/header.h
... | ... | @@ -480,6 +480,15 @@ typedef struct algor_config_param_snapshot { |
480 | 480 | #endif |
481 | 481 | |
482 | 482 | |
483 | +//共性算法适配使用 | |
484 | +#ifndef __SY_DIRECTION__ | |
485 | +#define __SY_DIRECTION__ | |
486 | +typedef struct sy_direction { | |
487 | + sy_point p1; | |
488 | + sy_point p2; | |
489 | +} sy_direction; | |
490 | +#endif | |
491 | + | |
483 | 492 | #ifndef __UNIVERSAL_ADAPTATON__ |
484 | 493 | #define __UNIVERSAL_ADAPTATON__ |
485 | 494 | #define ROI_MAX_POINT 50 |
... | ... | @@ -487,7 +496,7 @@ typedef struct algor_config_param_snapshot { |
487 | 496 | typedef struct universal_algor_adapt_param { |
488 | 497 | sy_point points[ROI_MAX_POINT]; |
489 | 498 | int points_count; //多边形顶点数量(不超过ROI_MAX_POINT) |
490 | - // sy_direction direction[MAX_DIRECTION_LINE]; | |
499 | + sy_direction direction[MAX_DIRECTION_LINE]; | |
491 | 500 | int line_count; //拌线数量(不超过MAX_DIRECTION_LINE) |
492 | 501 | |
493 | 502 | universal_algor_adapt_param() | ... | ... |
src/tsl_aiplatform_jni/AiEngineNativeInterface.cpp
... | ... | @@ -8,6 +8,9 @@ |
8 | 8 | #include <string.h> |
9 | 9 | using namespace std; |
10 | 10 | |
11 | +#define SUCCESS 0 //成功 | |
12 | +#define FAILED -1 //失败 | |
13 | + | |
11 | 14 | /** |
12 | 15 | * */ |
13 | 16 | JavaVM *g_jvm = NULL; |
... | ... | @@ -244,7 +247,7 @@ bool gb28181_request_stream_callback(const char *task_id){ |
244 | 247 | JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_addTask(JNIEnv *env, jobject obj, |
245 | 248 | jlong handle, |
246 | 249 | jobject taskParam) { |
247 | - int code = 0; | |
250 | + int code = SUCCESS; | |
248 | 251 | |
249 | 252 | // getFieldID |
250 | 253 | jclass cls_taskParam = env->GetObjectClass(taskParam); |
... | ... | @@ -258,6 +261,8 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
258 | 261 | jfieldID fid_taskParam_port = env->GetFieldID(cls_taskParam, "port", "I"); |
259 | 262 | jfieldID fid_taskParam_protocal = env->GetFieldID(cls_taskParam, "protocal", "I"); |
260 | 263 | |
264 | + jfieldID fid_taskParam_iDino = env->GetFieldID(cls_taskParam, "iDino", "I"); | |
265 | + | |
261 | 266 | // getObjectField |
262 | 267 | jstring str_taskParam_ipcUrl = (jstring)env->GetObjectField(taskParam, fid_taskParam_ipcUrl); |
263 | 268 | const char *taskParam_ipcUrl = env->GetStringUTFChars(str_taskParam_ipcUrl, JNI_FALSE); |
... | ... | @@ -265,17 +270,20 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
265 | 270 | jstring str_taskParam_taskId = (jstring)env->GetObjectField(taskParam, fid_taskParam_taskId); |
266 | 271 | const char *taskParam_taskId = env->GetStringUTFChars(str_taskParam_taskId, JNI_FALSE); |
267 | 272 | jobject taskParam_algorConfigParams = env->GetObjectField(taskParam, fid_taskParam_algorConfigParams); |
268 | - | |
273 | + | |
269 | 274 | jint taskParam_dec_type = env->GetIntField(taskParam, fid_taskParam_dec_type); |
270 | 275 | jint taskParam_port = env->GetIntField(taskParam, fid_taskParam_port); |
271 | 276 | jint taskParam_protocal = env->GetIntField(taskParam, fid_taskParam_protocal); |
272 | 277 | |
278 | + jint taskParam_iDino = env->GetIntField(taskParam, fid_taskParam_iDino); | |
279 | + | |
273 | 280 | jclass cls_syRectParam = env->FindClass("com/objecteye/pojo/common/SyRectParam"); |
274 | 281 | jfieldID fid_syRectParam_left = env->GetFieldID(cls_syRectParam, "left", "I"); |
275 | 282 | jfieldID fid_syRectParam_top = env->GetFieldID(cls_syRectParam, "top", "I"); |
276 | 283 | jfieldID fid_syRectParam_width = env->GetFieldID(cls_syRectParam, "width", "I"); |
277 | 284 | jfieldID fid_syRectParam_height = env->GetFieldID(cls_syRectParam, "height", "I"); |
278 | 285 | |
286 | + | |
279 | 287 | // java to C++ |
280 | 288 | task_param mTaskParam; |
281 | 289 | mTaskParam.ipc_url = taskParam_ipcUrl; |
... | ... | @@ -291,9 +299,7 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
291 | 299 | map<int, char *> psnapshot_little_AlgorConfigParamResSnapshotFolderMap; |
292 | 300 | map<int, jstring> snapshot_AlgorConfigParamResSnapshotFolderMap; |
293 | 301 | map<int, char *> psnapshot_AlgorConfigParamResSnapshotFolderMap; |
294 | - map<int, jstring> snapshot_AlgorConfigParamResVideoFolderMap; | |
295 | - map<int, char *> psnapshot_AlgorConfigParamResVideoFolderMap; | |
296 | - | |
302 | + | |
297 | 303 | jclass cls_arraylist = env->FindClass("java/util/ArrayList"); |
298 | 304 | // method in class ArrayList |
299 | 305 | jmethodID mid_arraylist_get = env->GetMethodID(cls_arraylist, "get", "(I)Ljava/lang/Object;"); |
... | ... | @@ -312,26 +318,24 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
312 | 318 | |
313 | 319 | jclass cls_AlgorConfigParam = env->GetObjectClass(algorConfigParam_algorInitParam); |
314 | 320 | |
321 | + | |
315 | 322 | /* assign public variables. */ |
316 | - auto algor_basic_param = new algor_basic_config_param_t; | |
317 | 323 | { |
318 | 324 | jfieldID fid_ssAlgorConfigParam_algorRect = |
319 | 325 | env->GetFieldID(cls_AlgorConfigParam, "algor_valid_rect", "Lcom/objecteye/pojo/common/SyRectParam;"); |
320 | 326 | jobject ssAlgorConfigParam_algorRect = |
321 | 327 | env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_algorRect); |
322 | - | |
328 | + | |
323 | 329 | jint ssAlgorConfigParam_algorRect_left = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_left); |
324 | 330 | jint ssAlgorConfigParam_algorRect_top = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_top); |
325 | 331 | jint ssAlgorConfigParam_algorRect_width = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_width); |
326 | 332 | jint ssAlgorConfigParam_algorRect_height = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_height); |
327 | - | |
333 | + | |
328 | 334 | jfieldID fid_ssAlgorConfigParam_snapshotLittleFolder = |
329 | 335 | env->GetFieldID(cls_AlgorConfigParam, "result_folder_little", "Ljava/lang/String;"); |
330 | 336 | jfieldID fid_ssAlgorConfigParam_snapshotFolder = |
331 | 337 | env->GetFieldID(cls_AlgorConfigParam, "result_folder", "Ljava/lang/String;"); |
332 | - jfieldID fid_ssAlgorConfigParam_videoFolder = | |
333 | - env->GetFieldID(cls_AlgorConfigParam, "video_folder", "Ljava/lang/String;"); //视频存储地址 | |
334 | - | |
338 | + | |
335 | 339 | snapshot_little_AlgorConfigParamResSnapshotFolderMap[i] = |
336 | 340 | (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_snapshotLittleFolder); |
337 | 341 | psnapshot_little_AlgorConfigParamResSnapshotFolderMap[i] = |
... | ... | @@ -340,13 +344,24 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
340 | 344 | (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_snapshotFolder); |
341 | 345 | psnapshot_AlgorConfigParamResSnapshotFolderMap[i] = |
342 | 346 | (char *)env->GetStringUTFChars(snapshot_AlgorConfigParamResSnapshotFolderMap[i], JNI_FALSE); |
343 | - snapshot_AlgorConfigParamResVideoFolderMap[i] = | |
344 | - (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_videoFolder); | |
345 | - psnapshot_AlgorConfigParamResVideoFolderMap[i] = | |
346 | - (char *)env->GetStringUTFChars(snapshot_AlgorConfigParamResVideoFolderMap[i], JNI_FALSE); | |
347 | - | |
347 | + | |
348 | + // 共性算法适配部分 | |
349 | + jfieldID fid_poly_points_count = env->GetFieldID(cls_AlgorConfigParam, "poly_points_count", "I"); | |
350 | + jint j_poly_points_count = env->GetIntField(algorConfigParam_algorInitParam, fid_poly_points_count); | |
351 | + | |
352 | + jfieldID fid_poly = env->GetFieldID(cls_AlgorConfigParam, "poly_points", "[I"); | |
353 | + jintArray j_poly_points = (jintArray)env->GetObjectField(algorConfigParam_algorInitParam, fid_poly); | |
354 | + jint *poly_points = (jint *)env->GetIntArrayElements(j_poly_points, 0); | |
355 | + | |
356 | + jfieldID fid_line_count = env->GetFieldID(cls_AlgorConfigParam, "line_count", "I"); | |
357 | + jint j_line_count = env->GetIntField(algorConfigParam_algorInitParam, fid_line_count); | |
358 | + | |
359 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "lines", "[I"); | |
360 | + jintArray j_lines = (jintArray)env->GetObjectField(algorConfigParam_algorInitParam, fid); | |
361 | + jint *lines = (jint *)env->GetIntArrayElements(j_lines, 0); | |
362 | + | |
348 | 363 | auto algor_init_config_param = new algor_init_config_param_t; |
349 | - | |
364 | + auto algor_basic_param = new algor_basic_config_param_t; | |
350 | 365 | |
351 | 366 | algor_basic_param->algor_valid_rect.top_ = ssAlgorConfigParam_algorRect_top; |
352 | 367 | algor_basic_param->algor_valid_rect.left_ = ssAlgorConfigParam_algorRect_left; |
... | ... | @@ -355,7 +370,30 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
355 | 370 | |
356 | 371 | algor_basic_param->result_folder = psnapshot_AlgorConfigParamResSnapshotFolderMap[i]; |
357 | 372 | algor_basic_param->result_folder_little = psnapshot_little_AlgorConfigParamResSnapshotFolderMap[i]; |
358 | - algor_basic_param->video_folder = psnapshot_AlgorConfigParamResVideoFolderMap[i]; | |
373 | + | |
374 | + // 共性算法适配部分 | |
375 | + algor_basic_param->adapt_param = new universal_algor_adapt_param; | |
376 | + auto adapt_param = (universal_algor_adapt_param *)algor_basic_param->adapt_param; | |
377 | + for (size_t i = 0; i < (int)j_poly_points_count; i++) { | |
378 | + adapt_param->points[i].x_ = (int)poly_points[i * 2]; | |
379 | + adapt_param->points[i].y_ = (int)poly_points[i * 2 + 1]; | |
380 | + } | |
381 | + adapt_param->points_count = (int)j_poly_points_count; | |
382 | + | |
383 | + for (size_t i = 0; i < (int)j_line_count; i++) { | |
384 | + adapt_param->direction[i].p1.x_ = (int)lines[i * 4]; | |
385 | + adapt_param->direction[i].p1.y_ = (int)lines[i * 4 + 1]; | |
386 | + adapt_param->direction[i].p2.x_ = (int)lines[i * 4 + 2]; | |
387 | + adapt_param->direction[i].p2.y_ = (int)lines[i * 4 + 3]; | |
388 | + } | |
389 | + adapt_param->line_count = (int)j_line_count; | |
390 | + | |
391 | + printf("[%s:%d] points_count %d line_count %d\n", __FILE__, __LINE__, (int)j_poly_points_count, (int)j_line_count); | |
392 | + for (size_t i = 0; i < (int)j_poly_points_count; i++) | |
393 | + printf(" i %d point (%d %d)\n", i, adapt_param->points[i].x_, adapt_param->points[i].y_); | |
394 | + for (size_t i = 0; i < (int)j_line_count; i++) | |
395 | + printf(" i %d point (%d %d)\n", i, adapt_param->direction[i].p1.x_, adapt_param->direction[i].p1.y_, | |
396 | + adapt_param->direction[i].p2.x_, adapt_param->direction[i].p2.y_); | |
359 | 397 | |
360 | 398 | algor_init_config_param->basic_param = algor_basic_param; |
361 | 399 | mTaskParam.algor_config_params[i].algor_init_config_param = algor_init_config_param; |
... | ... | @@ -364,9 +402,11 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
364 | 402 | |
365 | 403 | switch (static_cast<algorithm_type_t>(algorConfigParam_algorType)) { |
366 | 404 | case algorithm_type_t::FACE_SNAPSHOT: |
367 | - // printf("FACE_SNAPSHOT result_folder: %s result_folder_little: %s \n", algor_basic_param->result_folder, algor_basic_param->result_folder_little); | |
368 | 405 | case algorithm_type_t::HUMAN_SNAPSHOT: |
369 | 406 | case algorithm_type_t::VEHICLE_SNAPSHOT: |
407 | + // case algorithm_type_t::HUMAN_TIMING_SNAPSHOT: | |
408 | + // case algorithm_type_t::VEHICLE_TIMING_SNAPSHOT: | |
409 | + // case algorithm_type_t::NONMOTOR_VEHICLE_TIMING_SNAPSHOT: | |
370 | 410 | case algorithm_type_t::NONMOTOR_VEHICLE_SNAPSHOT: { |
371 | 411 | jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "threshold", "F"); |
372 | 412 | jfieldID fid_snap_frame_interval = env->GetFieldID(cls_AlgorConfigParam, "snap_frame_interval", "I"); |
... | ... | @@ -380,55 +420,9 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
380 | 420 | algor_param->threshold = (float)j_threshold; |
381 | 421 | algor_param->snap_frame_interval = (int)j_snap_frame_interval; |
382 | 422 | } break; |
383 | - | |
384 | - //农村违法分析 | |
385 | - case algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET: | |
386 | - case algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN: | |
387 | - case algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE: | |
388 | - case algorithm_type_t::NONMOTOR_VEHICLE_REFIT: | |
389 | - case algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS: | |
390 | - case algorithm_type_t::NONMOTOR_IN_VEHICLELANE: | |
391 | - case algorithm_type_t::NONMOTOR_CEOSSPARKLINE: | |
392 | - case algorithm_type_t::NONMOTOR_WRONGDIRECTION: | |
393 | - case algorithm_type_t::PERSON_IN_VEHICLELANE: | |
394 | - case algorithm_type_t::PERSON_CROSS: | |
395 | - case algorithm_type_t::PERSON_RUNNING_REDLIGHTS: | |
396 | - case algorithm_type_t::TRICYCLE_MANNED: | |
397 | - case algorithm_type_t::VEHICLE_WRONGDIRECTION: | |
398 | - case algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND: | |
399 | - case algorithm_type_t::VEHICLE_NOTGIVEWAY: | |
400 | - case algorithm_type_t::VEHICLE_NOTDECELERATION: | |
401 | - case algorithm_type_t::TRUCK_MANNED: { | |
402 | - jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "hs_threshold", "I"); | |
403 | - jint j_hs_threshold = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
404 | - fid = env->GetFieldID(cls_AlgorConfigParam, "m_frame", "I"); | |
405 | - jint j_m_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
406 | - fid = env->GetFieldID(cls_AlgorConfigParam, "n_frame", "I"); | |
407 | - jint j_n_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
408 | - fid = env->GetFieldID(cls_AlgorConfigParam, "obj_min_width", "I"); | |
409 | - jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
410 | - fid = env->GetFieldID(cls_AlgorConfigParam, "obj_min_height", "I"); | |
411 | - jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
412 | - fid = env->GetFieldID(cls_AlgorConfigParam, "obj_confidence_threshold", "F"); | |
413 | - jfloat j_confidence_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
414 | - std::printf("%s:%d i is %d mn is [%d %d] threshold is %d\n", __FILE__, __LINE__, i, (int)j_m_frame, | |
415 | - (int)j_n_frame, (int)j_hs_threshold); | |
416 | - | |
417 | - typedef algor_config_param_manned_incident algor_config_param_type; | |
418 | - mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
419 | - auto algor_param = | |
420 | - (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
421 | - | |
422 | - algor_param->m = (int)j_m_frame; | |
423 | - algor_param->n = (int)j_n_frame; | |
424 | - algor_param->hs_count_threshold = (int)j_hs_threshold; | |
425 | - | |
426 | - algor_param->obj_min_width = (int)j_min_width; | |
427 | - algor_param->obj_min_height = (int)j_min_height; | |
428 | - algor_param->obj_confidence_threshold = (float)j_confidence_threshold; | |
429 | - } break; | |
430 | - | |
431 | - | |
423 | + case algorithm_type_t::HUMAN_REGION_GATHER: | |
424 | + case algorithm_type_t::HUMAN_DENSITY: | |
425 | + case algorithm_type_t::VEHICLE_GATHER: | |
432 | 426 | case algorithm_type_t::HUMAN_GATHER: { |
433 | 427 | |
434 | 428 | jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "frame_stride", "I"); |
... | ... | @@ -500,8 +494,8 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
500 | 494 | algor_param->n = (int)j_n_frame; |
501 | 495 | algor_param->threshold = (float)j_threshold; |
502 | 496 | |
503 | - std::printf("%s:%d i is %d mn is [%d %d] threshold is %f\n", __FILE__, __LINE__, i, algor_param->m, | |
504 | - algor_param->n, algor_param->threshold); | |
497 | + // std::printf("%s:%d i is %d mn is [%d %d] threshold is %f\n", __FILE__, __LINE__, i, algor_param->m, | |
498 | + // algor_param->n, algor_param->threshold); | |
505 | 499 | } break; |
506 | 500 | case algorithm_type_t::PEDESTRIAN_FIGHT: { |
507 | 501 | jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "threshold", "F"); |
... | ... | @@ -639,8 +633,8 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
639 | 633 | (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; |
640 | 634 | |
641 | 635 | algor_param->px1 = (int)j_px1; |
642 | - algor_param->px2 = (int)j_px2; | |
643 | 636 | algor_param->py1 = (int)j_py1; |
637 | + algor_param->px2 = (int)j_px2; | |
644 | 638 | algor_param->py2 = (int)j_py2; |
645 | 639 | algor_param->conf_threshold = (float)j_confidence_threshold; |
646 | 640 | algor_param->minmum_width = std::max(0, (int)j_min_width); |
... | ... | @@ -649,6 +643,9 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
649 | 643 | } break; |
650 | 644 | |
651 | 645 | case algorithm_type_t::PEDESTRIAN_TRESPASS: |
646 | + case algorithm_type_t::HUMAN_LEAVE_REGION: | |
647 | + case algorithm_type_t::HUMAN_REGION_DISMISS: | |
648 | + case algorithm_type_t::HUMAN_REGION_FAST_MOVING: | |
652 | 649 | case algorithm_type_t::VEHICLE_TRESPASS: { |
653 | 650 | |
654 | 651 | jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "points_count", "I"); |
... | ... | @@ -673,16 +670,6 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
673 | 670 | jint *points = (jint *)env->GetIntArrayElements(j_points, 0); |
674 | 671 | |
675 | 672 | for (size_t i = 0; i < (int)j_points_count; i++) { |
676 | - /* | |
677 | - jobject obj_pointConfigParam = env->CallObjectMethod(j_points, mid_arraylist_points_get, i); | |
678 | - jclass cls_pointConfigParam = env->GetObjectClass(obj_pointConfigParam); | |
679 | - printf("33333333333"); | |
680 | - jfieldID fid_pointConfigParam_x = env->GetFieldID(cls_pointConfigParam, "x", "I"); | |
681 | - jint point_x = env->GetIntField(obj_pointConfigParam, fid_pointConfigParam_x); | |
682 | - | |
683 | - jfieldID fid_pointConfigParam_y = env->GetFieldID(cls_pointConfigParam, "y", "I"); | |
684 | - jint point_y = env->GetIntField(obj_pointConfigParam, fid_pointConfigParam_y); | |
685 | - */ | |
686 | 673 | algor_param->points[i].x_ = (int)points[i * 2]; |
687 | 674 | algor_param->points[i].y_ = (int)points[i * 2 + 1]; |
688 | 675 | } |
... | ... | @@ -699,6 +686,77 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter |
699 | 686 | printf(" i %d point (%d %d)\n", i, algor_param->points[i].x_, algor_param->points[i].y_); |
700 | 687 | } break; |
701 | 688 | |
689 | + case algorithm_type_t::HUMAN_LINGER: | |
690 | + case algorithm_type_t::VEHICLE_ILLEGAL_PARKING: | |
691 | + { | |
692 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "duration", "I"); | |
693 | + jint j_duration = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
694 | + | |
695 | + fid = env->GetFieldID(cls_AlgorConfigParam, "min_width", "I"); | |
696 | + jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
697 | + | |
698 | + fid = env->GetFieldID(cls_AlgorConfigParam, "min_height", "I"); | |
699 | + jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
700 | + | |
701 | + fid = env->GetFieldID(cls_AlgorConfigParam, "confidence_threshold", "F"); | |
702 | + jfloat j_confidence_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
703 | + | |
704 | + using algor_config_param_type = algor_config_param_behavior; | |
705 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
706 | + auto algor_param = | |
707 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
708 | + | |
709 | + | |
710 | + algor_param->conf_threshold = (float)j_confidence_threshold; | |
711 | + algor_param->minmum_width = std::max(0, (int)j_min_width); | |
712 | + algor_param->minmum_height = std::max(0, (int)j_min_height); | |
713 | + algor_param->duration = std::max(0, (int)j_duration); | |
714 | + | |
715 | + } break; | |
716 | + | |
717 | + case algorithm_type_t::VEHICLE_ILLEGAL_CROSSING_LINE: | |
718 | + case algorithm_type_t::HUMAN_CROSSING_LINE: | |
719 | + case algorithm_type_t::HUMAN_CLIMB: { | |
720 | + | |
721 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "px1", "I"); | |
722 | + jint j_px1 = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
723 | + | |
724 | + fid = env->GetFieldID(cls_AlgorConfigParam, "py1", "I"); | |
725 | + jint j_py1 = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
726 | + | |
727 | + fid = env->GetFieldID(cls_AlgorConfigParam, "px2", "I"); | |
728 | + jint j_px2 = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
729 | + | |
730 | + fid = env->GetFieldID(cls_AlgorConfigParam, "py2", "I"); | |
731 | + jint j_py2 = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
732 | + | |
733 | + fid = env->GetFieldID(cls_AlgorConfigParam, "min_width", "I"); | |
734 | + jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
735 | + | |
736 | + fid = env->GetFieldID(cls_AlgorConfigParam, "min_height", "I"); | |
737 | + jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
738 | + | |
739 | + fid = env->GetFieldID(cls_AlgorConfigParam, "confidence_threshold", "F"); | |
740 | + jfloat j_confidence_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
741 | + | |
742 | + std::printf( | |
743 | + "[%s:%d] point [(%d, %d), (%d, %d)] minimum wh [%d %d] minimum_threshold %.2f\n", | |
744 | + __FILE__, __LINE__, (int)j_px1, (int)j_py1, (int)j_px2, (int)j_py2, (int)j_min_width, (int)j_min_height, (float)j_confidence_threshold); | |
745 | + | |
746 | + using algor_config_param_type = algor_config_param_illegal_crossing_line; | |
747 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
748 | + auto algor_param = | |
749 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
750 | + | |
751 | + algor_param->p1.x_ = (int)j_px1; | |
752 | + algor_param->p1.y_ = (int)j_py1; | |
753 | + algor_param->p2.x_ = (int)j_px2; | |
754 | + algor_param->p2.y_ = (int)j_py2; | |
755 | + algor_param->conf_threshold = (float)j_confidence_threshold; | |
756 | + algor_param->minmum_width = std::max(0, (int)j_min_width); | |
757 | + algor_param->minmum_height = std::max(0, (int)j_min_height); | |
758 | + } break; | |
759 | + | |
702 | 760 | default: { |
703 | 761 | fprintf(stderr, "%s:%d Add Task Failed (Invalid algorithm type). \n", __FILE__, __LINE__); |
704 | 762 | code = -1; | ... | ... |