Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PeTrack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pedestrian Dynamics Empiricism
PeTrack
Commits
f12b0398
Commit
f12b0398
authored
2 years ago
by
d.kilic
Browse files
Options
Downloads
Plain Diff
Merge branch '366-add-regression-tests-for-intrinsic-calibration' into 'master'
Add regression test for intrinsic calibration Closes
#366
See merge request
!245
parents
c8cc9431
452fe8f1
No related branches found
No related tags found
1 merge request
!245
Add regression test for intrinsic calibration
Pipeline
#87658
passed
2 years ago
Stage: build_environment
Stage: pre-build-checks
Stage: build
Stage: test
Changes
2
Pipelines
7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
container/ubuntu/Dockerfile
+1
-1
1 addition, 1 deletion
container/ubuntu/Dockerfile
tests/regression_test/tests/test_calib.py
+116
-0
116 additions, 0 deletions
tests/regression_test/tests/test_calib.py
with
117 additions
and
1 deletion
container/ubuntu/Dockerfile
+
1
−
1
View file @
f12b0398
...
@@ -45,7 +45,7 @@ RUN apt-get update && apt-get install -y \
...
@@ -45,7 +45,7 @@ RUN apt-get update && apt-get install -y \
python3-dev
\
python3-dev
\
&&
apt-get clean
&&
apt-get clean
RUN
pip
install
pytest aqtinstall
RUN
pip
install
pytest
numpy
aqtinstall
# Install Qt 5.15
# Install Qt 5.15
RUN
aqt install-qt linux desktop 5.15.2
RUN
aqt install-qt linux desktop 5.15.2
...
...
This diff is collapsed.
Click to expand it.
tests/regression_test/tests/test_calib.py
0 → 100644
+
116
−
0
View file @
f12b0398
#
# PeTrack - Software for tracking pedestrians movement in videos
# Copyright (C) 2022 Forschungszentrum Jülich GmbH, IAS-7
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
from
pytest
import
approx
import
subprocess
import
xml.etree.ElementTree
as
ET
import
numpy
as
np
# NOTE: Does not test all options; ie. QuadAspectRatio, Fix Center, Ext. Model, ...
def
read_intrinsics
(
tree
:
ET
.
ElementTree
)
->
np
.
ndarray
:
node
=
tree
.
find
(
"
./CONTROL/CALIBRATION/INTRINSIC_PARAMETERS
"
)
if
node
is
None
:
raise
RuntimeError
(
"
Invalid pet-File! No Calibration node
"
)
cx
=
float
(
node
.
get
(
"
CX
"
,
"
nan
"
))
cy
=
float
(
node
.
get
(
"
CY
"
,
"
nan
"
))
fx
=
float
(
node
.
get
(
"
FX
"
,
"
nan
"
))
fy
=
float
(
node
.
get
(
"
FY
"
,
"
nan
"
))
k4
=
float
(
node
.
get
(
"
K4
"
,
"
nan
"
))
k5
=
float
(
node
.
get
(
"
K5
"
,
"
nan
"
))
k6
=
float
(
node
.
get
(
"
K6
"
,
"
nan
"
))
r2
=
float
(
node
.
get
(
"
R2
"
,
"
nan
"
))
r4
=
float
(
node
.
get
(
"
R4
"
,
"
nan
"
))
r6
=
float
(
node
.
get
(
"
R6
"
,
"
nan
"
))
s1
=
float
(
node
.
get
(
"
S1
"
,
"
nan
"
))
s2
=
float
(
node
.
get
(
"
S2
"
,
"
nan
"
))
s3
=
float
(
node
.
get
(
"
S3
"
,
"
nan
"
))
s4
=
float
(
node
.
get
(
"
S4
"
,
"
nan
"
))
tang_dist
=
float
(
node
.
get
(
"
TANG_DIST
"
,
"
nan
"
))
taux
=
float
(
node
.
get
(
"
TAUX
"
,
"
nan
"
))
tauy
=
float
(
node
.
get
(
"
TAUY
"
,
"
nan
"
))
tx
=
float
(
node
.
get
(
"
TX
"
,
"
nan
"
))
ty
=
float
(
node
.
get
(
"
TY
"
,
"
nan
"
))
# currently not used
# error leads to nan-value (Issue #364) being saved in demo
reprojection_error
=
float
(
node
.
get
(
"
ReprError
"
,
"
nan
"
))
return
np
.
array
(
[
cx
,
cy
,
fx
,
fy
,
k4
,
k5
,
k6
,
r2
,
r4
,
r6
,
s1
,
s2
,
s3
,
s4
,
tang_dist
,
taux
,
tauy
,
tx
,
ty
,
#reprojection_error,
]
)
def
compare_intrinsic_calib
(
test_pet
:
ET
.
ElementTree
,
truth_pet
:
ET
.
ElementTree
):
test_calib_params
=
read_intrinsics
(
test_pet
)
truth_calib_params
=
read_intrinsics
(
truth_pet
)
# high margin, but calibration itself should be tested by OpenCV itself
# this is just to see that we did calibrate
assert
test_calib_params
==
approx
(
truth_calib_params
,
abs
=
0.1
)
def
test_autoCalib
(
pytestconfig
):
petrack_path
=
pytestconfig
.
getoption
(
"
path
"
)
project
=
"
../../../demo/00_files/00_empty.pet
"
real_intrinsic
=
"
../../../demo/01_calibration/01_intrinsic.pet
"
intrinsic_dir
=
"
../../../demo/00_files/calibration/intrinsic
"
output
=
"
../data/calibTest.pet
"
# run autocalib on demo project
subprocess
.
run
(
[
petrack_path
,
"
-project
"
,
project
,
"
-autoIntrinsic
"
,
intrinsic_dir
,
"
-autosave
"
,
output
,
"
-platform
"
,
"
offscreen
"
,
],
check
=
True
,
)
test_pet
=
ET
.
parse
(
output
)
truth_pet
=
ET
.
parse
(
real_intrinsic
)
compare_intrinsic_calib
(
test_pet
,
truth_pet
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment