Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
a56bd1fb
Commit
a56bd1fb
authored
Mar 22, 2017
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make aruco dependency optional for interactive calibration app
parent
8abd1634
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
14 deletions
+33
-14
CMakeLists.txt
apps/interactive-calibration/CMakeLists.txt
+4
-1
frameProcessor.cpp
apps/interactive-calibration/frameProcessor.cpp
+9
-3
frameProcessor.hpp
apps/interactive-calibration/frameProcessor.hpp
+5
-1
main.cpp
apps/interactive-calibration/main.cpp
+15
-9
No files found.
apps/interactive-calibration/CMakeLists.txt
View file @
a56bd1fb
set
(
OPENCV_INTERACTIVECALIBRATION_DEPS opencv_core opencv_imgproc opencv_features2d opencv_aruco opencv_highgui opencv_calib3d opencv_videoio
)
set
(
OPENCV_INTERACTIVECALIBRATION_DEPS opencv_core opencv_imgproc opencv_features2d opencv_highgui opencv_calib3d opencv_videoio
)
if
(
${
BUILD_opencv_aruco
}
)
list
(
APPEND OPENCV_INTERACTIVECALIBRATION_DEPS opencv_aruco
)
endif
()
ocv_check_dependencies
(
${
OPENCV_INTERACTIVECALIBRATION_DEPS
}
)
if
(
NOT OCV_DEPENDENCIES_FOUND
)
...
...
apps/interactive-calibration/frameProcessor.cpp
View file @
a56bd1fb
...
...
@@ -7,7 +7,6 @@
#include <opencv2/calib3d.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/aruco/charuco.hpp>
#include <opencv2/highgui.hpp>
#include <vector>
...
...
@@ -75,6 +74,7 @@ bool CalibProcessor::detectAndParseChessboard(const cv::Mat &frame)
bool
CalibProcessor
::
detectAndParseChAruco
(
const
cv
::
Mat
&
frame
)
{
#ifdef HAVE_OPENCV_ARUCO
cv
::
Ptr
<
cv
::
aruco
::
Board
>
board
=
mCharucoBoard
.
staticCast
<
cv
::
aruco
::
Board
>
();
std
::
vector
<
std
::
vector
<
cv
::
Point2f
>
>
corners
,
rejected
;
...
...
@@ -95,14 +95,16 @@ bool CalibProcessor::detectAndParseChAruco(const cv::Mat &frame)
}
centerX
/=
currentCharucoCorners
.
size
[
0
];
centerY
/=
currentCharucoCorners
.
size
[
0
];
//cv::circle(frame, cv::Point2f(centerX, centerY), 10, cv::Scalar(0, 255, 0), 10);
mTemplateLocations
.
insert
(
mTemplateLocations
.
begin
(),
cv
::
Point2f
(
centerX
,
centerY
));
cv
::
aruco
::
drawDetectedCornersCharuco
(
frame
,
currentCharucoCorners
,
currentCharucoIds
);
mCurrentCharucoCorners
=
currentCharucoCorners
;
mCurrentCharucoIds
=
currentCharucoIds
;
return
true
;
}
#else
(
void
)
frame
;
#endif
return
false
;
}
...
...
@@ -231,6 +233,7 @@ bool CalibProcessor::checkLastFrame()
}
}
else
{
#ifdef HAVE_OPENCV_ARUCO
cv
::
Mat
r
,
t
,
angles
;
std
::
vector
<
cv
::
Point3f
>
allObjPoints
;
allObjPoints
.
reserve
(
mCurrentCharucoIds
.
total
());
...
...
@@ -248,6 +251,7 @@ bool CalibProcessor::checkLastFrame()
mCalibData
->
allCharucoCorners
.
pop_back
();
mCalibData
->
allCharucoIds
.
pop_back
();
}
#endif
}
return
isFrameBad
;
}
...
...
@@ -266,10 +270,12 @@ CalibProcessor::CalibProcessor(cv::Ptr<calibrationData> data, captureParameters
switch
(
mBoardType
)
{
case
chAruco
:
#ifdef HAVE_OPENCV_ARUCO
mArucoDictionary
=
cv
::
aruco
::
getPredefinedDictionary
(
cv
::
aruco
::
PREDEFINED_DICTIONARY_NAME
(
capParams
.
charucoDictName
));
mCharucoBoard
=
cv
::
aruco
::
CharucoBoard
::
create
(
mBoardSize
.
width
,
mBoardSize
.
height
,
capParams
.
charucoSquareLenght
,
capParams
.
charucoMarkerSize
,
mArucoDictionary
);
#endif
break
;
case
AcirclesGrid
:
mBlobDetectorPtr
=
cv
::
SimpleBlobDetector
::
create
();
...
...
apps/interactive-calibration/frameProcessor.hpp
View file @
a56bd1fb
...
...
@@ -6,8 +6,10 @@
#define FRAME_PROCESSOR_HPP
#include <opencv2/core.hpp>
#include <opencv2/aruco/charuco.hpp>
#include <opencv2/calib3d.hpp>
#ifdef HAVE_OPENCV_ARUCO
#include <opencv2/aruco/charuco.hpp>
#endif
#include "calibCommon.hpp"
#include "calibController.hpp"
...
...
@@ -37,8 +39,10 @@ protected:
cv
::
Mat
mCurrentCharucoIds
;
cv
::
Ptr
<
cv
::
SimpleBlobDetector
>
mBlobDetectorPtr
;
#ifdef HAVE_OPENCV_ARUCO
cv
::
Ptr
<
cv
::
aruco
::
Dictionary
>
mArucoDictionary
;
cv
::
Ptr
<
cv
::
aruco
::
CharucoBoard
>
mCharucoBoard
;
#endif
int
mNeededFramesNum
;
unsigned
mDelayBetweenCaptures
;
...
...
apps/interactive-calibration/main.cpp
View file @
a56bd1fb
...
...
@@ -4,10 +4,13 @@
#include <opencv2/core.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/aruco/charuco.hpp>
#include <opencv2/cvconfig.h>
#include <opencv2/highgui.hpp>
#ifdef HAVE_OPENCV_ARUCO
#include <opencv2/aruco/charuco.hpp>
#endif
#include <string>
#include <vector>
#include <stdexcept>
...
...
@@ -50,31 +53,27 @@ bool calib::showOverlayMessage(const std::string& message)
#endif
}
static
void
deleteButton
(
int
state
,
void
*
data
)
static
void
deleteButton
(
int
,
void
*
data
)
{
state
++
;
//to avoid gcc warnings
(
static_cast
<
cv
::
Ptr
<
calibDataController
>*>
(
data
))
->
get
()
->
deleteLastFrame
();
calib
::
showOverlayMessage
(
"Last frame deleted"
);
}
static
void
deleteAllButton
(
int
state
,
void
*
data
)
static
void
deleteAllButton
(
int
,
void
*
data
)
{
state
++
;
(
static_cast
<
cv
::
Ptr
<
calibDataController
>*>
(
data
))
->
get
()
->
deleteAllData
();
calib
::
showOverlayMessage
(
"All frames deleted"
);
}
static
void
saveCurrentParamsButton
(
int
state
,
void
*
data
)
static
void
saveCurrentParamsButton
(
int
,
void
*
data
)
{
state
++
;
if
((
static_cast
<
cv
::
Ptr
<
calibDataController
>*>
(
data
))
->
get
()
->
saveCurrentCameraParameters
())
calib
::
showOverlayMessage
(
"Calibration parameters saved"
);
}
#ifdef HAVE_QT
static
void
switchVisualizationModeButton
(
int
state
,
void
*
data
)
static
void
switchVisualizationModeButton
(
int
,
void
*
data
)
{
state
++
;
ShowProcessor
*
processor
=
static_cast
<
ShowProcessor
*>
(((
cv
::
Ptr
<
FrameProcessor
>*
)
data
)
->
get
());
processor
->
switchVisualizationMode
();
}
...
...
@@ -103,6 +102,11 @@ int main(int argc, char** argv)
captureParameters
capParams
=
paramsController
.
getCaptureParameters
();
internalParameters
intParams
=
paramsController
.
getInternalParameters
();
#ifndef HAVE_OPENCV_ARUCO
if
(
capParams
.
board
==
chAruco
)
CV_Error
(
cv
::
Error
::
StsNotImplemented
,
"Aruco module is disabled in current build configuration."
" Consider usage of another calibration pattern
\n
"
);
#endif
cv
::
TermCriteria
solverTermCrit
=
cv
::
TermCriteria
(
cv
::
TermCriteria
::
COUNT
+
cv
::
TermCriteria
::
EPS
,
intParams
.
solverMaxIters
,
intParams
.
solverEps
);
...
...
@@ -172,6 +176,7 @@ int main(int argc, char** argv)
calibrationFlags
,
solverTermCrit
);
}
else
{
#ifdef HAVE_OPENCV_ARUCO
cv
::
Ptr
<
cv
::
aruco
::
Dictionary
>
dictionary
=
cv
::
aruco
::
getPredefinedDictionary
(
cv
::
aruco
::
PREDEFINED_DICTIONARY_NAME
(
capParams
.
charucoDictName
));
cv
::
Ptr
<
cv
::
aruco
::
CharucoBoard
>
charucoboard
=
...
...
@@ -183,6 +188,7 @@ int main(int argc, char** argv)
globalData
->
cameraMatrix
,
globalData
->
distCoeffs
,
cv
::
noArray
(),
cv
::
noArray
(),
globalData
->
stdDeviations
,
cv
::
noArray
(),
globalData
->
perViewErrors
,
calibrationFlags
,
solverTermCrit
);
#endif
}
dataController
->
updateUndistortMap
();
dataController
->
printParametersToConsole
(
std
::
cout
);
...
...
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