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
87eec22e
Commit
87eec22e
authored
2 years ago
by
d.kilic
Browse files
Options
Downloads
Plain Diff
Merge branch '315-crash-when-using-5-calibration-points-for-extrinsic-calibration' into 'master'
Error on number of points for PnP depending on coplanarity Closes
#315
See merge request
!211
parents
4ecb17d4
8a3b1d19
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!211
Error on number of points for PnP depending on coplanarity
Pipeline
#74194
passed
2 years ago
Stage: build_environment
Stage: pre-build-checks
Stage: build
Stage: test
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/extrCalibration.cpp
+44
-2
44 additions, 2 deletions
src/extrCalibration.cpp
with
44 additions
and
2 deletions
src/extrCalibration.cpp
+
44
−
2
View file @
87eec22e
...
...
@@ -101,6 +101,36 @@ bool ExtrCalibration::openExtrCalibFile()
return
false
;
}
// following function copied from OpenCV
static
bool
isPlanarObjectPoints
(
cv
::
InputArray
_objectPoints
,
double
threshold
=
1e-3
)
{
CV_CheckType
(
_objectPoints
.
type
(),
_objectPoints
.
type
()
==
CV_32FC3
||
_objectPoints
.
type
()
==
CV_64FC3
,
"Type of _objectPoints must be CV_32FC3 or CV_64FC3"
);
cv
::
Mat
objectPoints
;
if
(
_objectPoints
.
type
()
==
CV_32FC3
)
{
_objectPoints
.
getMat
().
convertTo
(
objectPoints
,
CV_64F
);
}
else
{
objectPoints
=
_objectPoints
.
getMat
();
}
cv
::
Scalar
meanValues
=
mean
(
objectPoints
);
int
nbPts
=
objectPoints
.
checkVector
(
3
,
CV_64F
);
cv
::
Mat
objectPointsCentred
=
objectPoints
-
meanValues
;
objectPointsCentred
=
objectPointsCentred
.
reshape
(
1
,
nbPts
);
cv
::
Mat
w
,
u
,
vt
;
cv
::
Mat
MM
=
objectPointsCentred
.
t
()
*
objectPointsCentred
;
SVDecomp
(
MM
,
w
,
u
,
vt
);
return
(
w
.
at
<
double
>
(
2
)
<
w
.
at
<
double
>
(
1
)
*
threshold
);
}
/**
* @brief Loads the extrinsic calibration from mExtrCalibFile
*
...
...
@@ -237,12 +267,24 @@ bool ExtrCalibration::loadExtrCalibFile()
PCritical
(
mMainWindow
,
QObject
::
tr
(
"PeTrack"
),
QObject
::
tr
(
"Error: Not enough points given: %1 (minimum 4 needed!). Please check your extrinsic "
QObject
::
tr
(
"Error: Not enough points given: %1 (minimum 4 (coplanar) or 6 (not coplanar) "
"needed!). Please check your extrinsic "
"calibration file!"
)
.
arg
(
points3D_tmp
.
size
()));
all_ok
=
false
;
}
else
if
(
!
isPlanarObjectPoints
(
points3D_tmp
)
&&
points3D_tmp
.
size
()
<
6
)
{
// Non-planar points use DLT - we need at least 6 points; not only 4
PCritical
(
mMainWindow
,
QObject
::
tr
(
"PeTrack"
),
QObject
::
tr
(
"Error: Not enough points given: %1 (minimum 4 (coplanar) or 6 (not coplanar) "
"needed!). Please check your extrinsic "
"calibration file!"
)
.
arg
(
points3D_tmp
.
size
()));
all_ok
=
false
;
}
// Check if 2D points delivered and if the number of 2D and 3D points agree
else
if
(
points2D_tmp
.
size
()
>
0
&&
points2D_tmp
.
size
()
!=
points3D_tmp
.
size
())
{
...
...
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