Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
platform
/
tx1_box_serv
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e235cc1a
authored
Apr 11, 2019
by
熊付
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
【标定设置】
1 parent
b9780963
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
5 deletions
code/tx1_box_serv/apps/api/task.py
code/tx1_box_serv/apps/commons/editXml.py
code/tx1_box_serv/apps/api/task.py
View file @
e235cc1
...
@@ -113,7 +113,15 @@ def edit_task_inf(task_index):
...
@@ -113,7 +113,15 @@ def edit_task_inf(task_index):
cal
=
calibration
[
'calibration'
]
cal
=
calibration
[
'calibration'
]
if
cal
is
not
None
and
cal
!=
''
:
if
cal
is
not
None
and
cal
!=
''
:
editXml
.
writeXml
(
os
.
path
.
join
(
mtask_path
,
'calibration.xml'
),
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====================
==================更改参数 start====================
...
@@ -196,7 +204,7 @@ def make_task_info(task_index):
...
@@ -196,7 +204,7 @@ def make_task_info(task_index):
else
:
else
:
task
.
setdefault
(
'is_active'
,
True
)
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
return
task
def
read_task_name
(
xmlPath
):
def
read_task_name
(
xmlPath
):
...
@@ -244,7 +252,7 @@ def read_rtsp(xmlPath):
...
@@ -244,7 +252,7 @@ def read_rtsp(xmlPath):
return
scen_play_url
,
algo_type
return
scen_play_url
,
algo_type
return
''
,
0
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
=
[]
mtasks
=
[]
scenes
=
[]
scenes
=
[]
cal
=
editXml
.
openXml
(
cal_path
)
cal
=
editXml
.
openXml
(
cal_path
)
...
@@ -252,6 +260,11 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp,algo_type):
...
@@ -252,6 +260,11 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp,algo_type):
calibration
=
{}
calibration
=
{}
calibration
.
setdefault
(
'calibration'
,
cal
)
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
=
editXml
.
openXml
(
conpath
)
con
=
con
.
replace
(
'
\n
'
,
''
)
con
=
con
.
replace
(
'
\n
'
,
''
)
config
=
{}
config
=
{}
...
@@ -272,6 +285,7 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp,algo_type):
...
@@ -272,6 +285,7 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp,algo_type):
sce
=
{}
sce
=
{}
sce
.
setdefault
(
'calibration'
,
calibration
)
sce
.
setdefault
(
'calibration'
,
calibration
)
sce
.
setdefault
(
'calibrationalgo'
,
calibration_algo
)
sce
.
setdefault
(
'rois'
,
rois
)
sce
.
setdefault
(
'rois'
,
rois
)
sce
.
setdefault
(
'config'
,
config
)
sce
.
setdefault
(
'config'
,
config
)
sce
.
setdefault
(
'basicConfig'
,
basConfig
)
sce
.
setdefault
(
'basicConfig'
,
basConfig
)
...
...
code/tx1_box_serv/apps/commons/editXml.py
View file @
e235cc1
...
@@ -19,8 +19,12 @@ from xml.dom import minidom
...
@@ -19,8 +19,12 @@ from xml.dom import minidom
#读取xml文件
#读取xml文件
def
openXml
(
filePath
):
def
openXml
(
filePath
):
# 打开xml文档
try
:
return
io
.
open
(
filePath
,
'r'
,
encoding
=
'GBK'
)
.
read
()
.
encode
(
'utf-8'
)
# 打开xml文档
return
io
.
open
(
filePath
,
'r'
,
encoding
=
'GBK'
)
.
read
()
.
encode
(
'utf-8'
)
except
:
return
io
.
open
(
filePath
,
'w'
,
encoding
=
'GBK'
)
#写入xml文件
#写入xml文件
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment