Commit e235cc1a by 熊付

【标定设置】

1 parent b9780963
......@@ -113,7 +113,15 @@ def edit_task_inf(task_index):
cal = calibration['calibration']
if cal is not None and cal != '':
editXml.writeXml ( os.path.join(mtask_path,'calibration.xml'), cal )
'''
==================更改标定 start====================
'''
if scen.has_key ( 'calibrationAlgo' ):
calibration = scen['calibrationAlgo']
if calibration.has_key ( 'calibration' ):
cal = calibration['calibration']
if cal is not None and cal != '':
editXml.writeXml ( os.path.join ( mtask_path, 'calibrationAlgo.xml' ), cal )
'''
==================更改参数 start====================
......@@ -196,7 +204,7 @@ def make_task_info(task_index):
else:
task.setdefault ( 'is_active', True )
task.setdefault('mtasks',make_mtasks(os.path.join(mtask_path,'calibration.xml'),os.path.join(mtask_path,'roi_1.xml'),tasks[3],os.path.join(mtask_path,'config.xml'), rtsp,algo_type))
task.setdefault('mtasks',make_mtasks(os.path.join(mtask_path,'calibration.xml'),os.path.join(mtask_path,'calibrationAlgo.xml'),os.path.join(mtask_path,'roi_1.xml'),tasks[3],os.path.join(mtask_path,'config.xml'), rtsp,algo_type))
return task
def read_task_name(xmlPath):
......@@ -244,7 +252,7 @@ def read_rtsp(xmlPath):
return scen_play_url,algo_type
return '',0
def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp,algo_type):
def make_mtasks(cal_path,cal_algo_path,roi_path,basconpath,conpath,rtsp,algo_type):
mtasks = []
scenes = []
cal = editXml.openXml( cal_path )
......@@ -252,6 +260,11 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp,algo_type):
calibration = {}
calibration.setdefault('calibration',cal)
cal_algo = editXml.openXml ( cal_algo_path )
cal_algo = cal_algo.replace ( '\n', '' )
calibration_algo = {}
calibration_algo.setdefault ( 'calibration', cal_algo )
con = editXml.openXml( conpath )
con = con.replace ( '\n', '' )
config = {}
......@@ -272,6 +285,7 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp,algo_type):
sce = {}
sce.setdefault('calibration',calibration)
sce.setdefault( 'calibrationalgo', calibration_algo )
sce.setdefault('rois',rois)
sce.setdefault ( 'config', config )
sce.setdefault ( 'basicConfig', basConfig )
......
......@@ -19,8 +19,12 @@ from xml.dom import minidom
#读取xml文件
def openXml(filePath):
try:
# 打开xml文档
return io.open(filePath, 'r', encoding='GBK').read ().encode ( 'utf-8' )
return io.open ( filePath, 'r', encoding='GBK' ).read ().encode ( 'utf-8' )
except :
return io.open ( filePath, 'w', encoding='GBK' )
#写入xml文件
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!