dynamic config

This commit is contained in:
2020-06-10 13:54:51 +07:00
parent 9b11d59407
commit d3bf129a2a
6 changed files with 287 additions and 859 deletions

View File

@@ -57,134 +57,21 @@ function saveStep1(e) {
});
}
function saveStep2(e) {
var config_json = {
"camera": {
"auto_check": parseInt($("#text-c11").html()),
"num_cam": parseInt($("#text-c12").html()),
"rgb": {
"url": $("#text-c131").html(),
"type": $("#text-c132").html(),
"rotate": parseInt($("#text-c133").html()),
"config": {
"enable": parseInt($("#text-c1341").html()),
"brightness": parseInt($("#text-c1342").html()),
"gain": parseInt($("#text-c1343").html()),
"saturation": parseInt($("#text-c1344").html()),
"sharpness": parseInt($("#text-c1345").html())
}
},
"ir": {
"url": $("#text-c141").html(),
"type": $("#text-c142").html(),
"rotate": parseInt($("#text-c143").html()),
"translate_x": parseInt($("#text-c144").html()),
"translate_y": parseInt($("#text-c145").html()),
"ir_scale": parseFloat($("#text-c146").html()),
"config": {
"enable": parseInt($("#text-c1471").html())
}
},
"max_queue_size": parseInt($("#text-c15").html()),
"count_frame_to_skip": parseInt($("#text-c16").html()),
"fps": parseInt($("#text-c17").html()),
"merge_queue_pause": parseInt($("#text-c18").html()),
"raw_resolution": {
"width": parseInt($("#text-c191").html()),
"height": parseInt($("#text-c192").html())
},
"video_resize": {
"width": parseInt($("#text-c1101").html()),
"height": parseInt($("#text-c1102").html())
},
"crop_frame": {
"x": parseInt($("#text-c1111").html()),
"y": parseInt($("#text-c1112").html()),
"width": parseInt($("#text-c1113").html()),
"height": parseInt($("#text-c1114").html())
}
},
"face_verify": {
"show_fake_label": parseInt($("#text-c21").html()),
"debug": parseInt($("#text-c22").html()),
"max_fake_time": parseInt($("#text-c23").html()),
"min_real_time": parseInt($("#text-c24").html()),
"saturation": {
"enable": parseInt($("#text-c251").html()),
"min_std_thresh": parseInt($("#text-c252").html()),
"min_mean_thresh": parseInt($("#text-c253").html())
},
"mtcnn": {
"enable": parseInt($("#text-c261").html()),
"size": parseInt($("#text-c262").html()),
"num_thread": parseInt($("#text-c263").html())
},
"ir_face_verify": {
"enable": parseInt($("#text-c271").html()),
"ir_scale": parseFloat($("#text-c272").html()),
"ir_neighbor": parseInt($("#text-c273").html())
}
},
"ultraface": {
"enable": parseInt($("#text-c_101").html()),
"translate_x": parseInt($("#text-c_102").html()),
"translate_y": parseInt($("#text-c_103").html()),
"width": parseInt($("#text-c_104").html()),
"height": parseInt($("#text-c_105").html()),
"threshold": parseFloat($("#text-c_106").html()),
"min_size": parseInt($("#text-c_107").html()),
"thread_use": parseInt($("#text-c_108").html()),
"max_ratio": parseFloat($("#text-c_109").html())
},
"haarcascade": {
"enable": parseInt($("#text-c31").html()),
"show_time_detect": parseInt($("#text-c32").html()),
"min_size": parseInt($("#text-c33").html()),
"max_size": parseInt($("#text-c34").html()),
"scale": parseFloat($("#text-c35").html()),
"neighbor": parseInt($("#text-c36").html())
},
"engine": {
"max_fps": parseInt($("#text-c41").html()),
"cam_id": parseInt($("#text-c42").html()),
"server_authen": $("#text-c43").html()
},
"recognition": {
"enable": parseInt($("#text-c51").html()),
"accuracy": parseFloat($("#text-c52").html()),
"server_recog": $("#text-c53").html(),
"request_timeout": parseInt($("#text-c54").html()),
"num_face_recog": parseInt($("#text-c55").html()),
"first_time_recog": parseInt($("#text-c56").html()),
"next_time_recog": parseInt($("#text-c57").html())
},
"screen": {
"show_video": parseInt($("#text-c61").html()),
"full_screen": parseInt($("#text-c62").html()),
"width": parseInt($("#text-c63").html()),
"height": parseInt($("#text-c64").html()),
"banner": $("#text-c65").html(),
"bb_color_rgb": {
"detect": [parseInt($("#text-c6611").html()), parseInt($("#text-c6612").html()), parseInt($("#text-c6613").html())],
"recog": [parseInt($("#text-c6621").html()), parseInt($("#text-c6622").html()), parseInt($("#text-c6623").html())]
}
},
"id_city": parseInt($("#text-c7").html()),
"open_door": {
"enable": parseInt($("#text-c81").html()),
"port_name": $("#text-c82").html()
},
"log": {
"path": $("#text-c91").html(),
"limit": parseInt($("#text-c92").html()),
"clear_line": parseInt($("#text-c93").html())
}
};
var cfgLists = $(".editform");
var cfg = [];
for (var i = 0; i < cfgLists.length; i++) {
cfg.push({
parent: $(cfgLists[i]).data("parent"),
key: $(cfgLists[i]).data("key"),
data: $(cfgLists[i]).html()
});
}
common.modalBlock(true);
$.ajax({
url: $(e).attr("data-href"),
type: 'POST',
data: {
config: JSON.stringify(config_json)
config: cfg
},
success: function (data) {
if (data) {