Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Thiago Santini
EyeRecToo
Commits
e1518c6b
Commit
e1518c6b
authored
Oct 19, 2017
by
Thiago Santini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improves camera calibration interface
parent
58c23648
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
6 deletions
+35
-6
EyeRecToo/src/CameraCalibration.cpp
EyeRecToo/src/CameraCalibration.cpp
+7
-2
EyeRecToo/src/CameraCalibration.h
EyeRecToo/src/CameraCalibration.h
+28
-4
No files found.
EyeRecToo/src/CameraCalibration.cpp
View file @
e1518c6b
...
...
@@ -35,8 +35,11 @@ void CameraCalibration::startCalibration()
sampleCount
=
0
;
sampleCountQL
->
setText
(
QString
::
number
(
sampleCount
));
covered
=
Rect
();
if
(
dbgCB
->
isChecked
())
if
(
dbgCB
->
isChecked
())
{
namedWindow
(
DBG_WINDOW_NAME
);
this
->
activateWindow
();
this
->
setFocus
();
}
}
void
CameraCalibration
::
finishCalibration
()
...
...
@@ -125,6 +128,8 @@ void CameraCalibration::undistortSample(const Mat &frame)
else
cv
::
undistort
(
frame
,
tmp
,
newCameraMatrix
,
distCoeffs
);
imshow
(
"Undistorted Image"
,
tmp
);
this
->
activateWindow
();
this
->
setFocus
();
undistortPB
->
setEnabled
(
true
);
}
...
...
@@ -221,7 +226,7 @@ void CameraCalibration::calibrate()
fisheye
::
estimateNewCameraMatrixForUndistortRectify
(
cameraMatrix
,
distCoeffs
,
imageSize
,
Matx33d
::
eye
(),
newCameraMatrix
,
1
);
}
else
{
rms
=
calibrateCamera
(
objectPoints
,
imagePoints
,
imageSize
,
cameraMatrix
,
distCoeffs
,
rv
,
tv
);
newCameraMatrix
=
getOptimalNewCameraMatrix
(
cameraMatrix
,
distCoeffs
,
imageSize
,
0
,
imageSize
);
newCameraMatrix
=
getOptimalNewCameraMatrix
(
cameraMatrix
,
distCoeffs
,
imageSize
,
1
,
imageSize
);
}
calibrationSuccessful
=
true
;
}
...
...
EyeRecToo/src/CameraCalibration.h
View file @
e1518c6b
...
...
@@ -18,6 +18,7 @@
#include <QFileInfo>
#include <QtConcurrent/QtConcurrent>
#include <QFutureWatcher>
#include <QKeyEvent>
#include "opencv2/imgproc.hpp"
#include "opencv2/calib3d.hpp"
...
...
@@ -69,10 +70,10 @@ public:
fishEyeCB
->
setEnabled
(
false
);
formLayout
->
addRow
(
new
QLabel
(
"Fish Eye"
),
fishEyeCB
);
dbgCB
=
new
QCheckBox
();
dbgCB
->
setChecked
(
fals
e
);
dbgCB
->
setChecked
(
tru
e
);
dbgCB
->
setWhatsThis
(
"Display results from the pattern detection."
);
dbgCB
->
setToolTip
(
dbgCB
->
whatsThis
());
formLayout
->
addRow
(
new
QLabel
(
"Show De
bug
"
),
dbgCB
);
formLayout
->
addRow
(
new
QLabel
(
"Show De
tection
"
),
dbgCB
);
patternCB
=
new
QComboBox
();
patternCB
->
addItem
(
"Assymetric Circles"
,
ASYMMETRIC_CIRCLES_GRID
);
patternCB
->
addItem
(
"Chessboard"
,
CHESSBOARD
);
...
...
@@ -185,9 +186,11 @@ private:
}
void
setRms
()
{
setLabelText
(
rmsQL
,
"N/A"
,
"black"
);
}
void
setRms
(
double
val
)
{
if
(
val
<
1
)
if
(
val
<
=
0.75
)
{
setLabelText
(
rmsQL
,
QString
::
number
(
val
),
"green"
);
else
{
}
else
if
(
val
<=
1
)
{
setLabelText
(
rmsQL
,
QString
::
number
(
val
),
"orange"
);
}
else
{
setLabelText
(
rmsQL
,
QString
::
number
(
val
),
"red"
);
qInfo
()
<<
"RMS Error is above the expected value. It's recommended to recalibrate."
;
}
...
...
@@ -210,6 +213,27 @@ private slots:
void
startCalibration
();
void
finishCalibration
();
void
onCalibrated
();
void
keyReleaseEvent
(
QKeyEvent
*
event
)
{
// TODO: Document these
if
(
event
->
isAutoRepeat
())
return
;
switch
(
event
->
key
())
{
case
Qt
::
Key_S
:
calibrationTogglePB
->
click
();
break
;
case
Qt
::
Key_C
:
collectPB
->
click
();
break
;
case
Qt
::
Key_U
:
undistortPB
->
click
();
break
;
case
Qt
::
Key_Escape
:
this
->
close
();
break
;
default:
break
;
}
}
};
#endif // CAMERACALIBRATION_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment