Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
f98580b2
Commit
f98580b2
authored
Oct 22, 2015
by
Maksim Shabunin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #397 from paroj:aruco_densepose
parents
5e9632bc
ee61cba9
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
23 additions
and
26 deletions
+23
-26
aruco.hpp
modules/aruco/include/opencv2/aruco.hpp
+2
-2
detect_board.cpp
modules/aruco/samples/detect_board.cpp
+1
-1
detect_board_charuco.cpp
modules/aruco/samples/detect_board_charuco.cpp
+1
-1
detect_diamonds.cpp
modules/aruco/samples/detect_diamonds.cpp
+1
-1
detect_markers.cpp
modules/aruco/samples/detect_markers.cpp
+1
-1
aruco.cpp
modules/aruco/src/aruco.cpp
+11
-14
test_charucodetection.cpp
modules/aruco/test/test_charucodetection.cpp
+1
-1
aruco_board_detection.markdown
...ials/aruco_board_detection/aruco_board_detection.markdown
+2
-2
aruco_detection.markdown
.../aruco/tutorials/aruco_detection/aruco_detection.markdown
+1
-1
charuco_detection.markdown
...co/tutorials/charuco_detection/charuco_detection.markdown
+1
-1
charuco_diamond_detection.markdown
...ruco_diamond_detection/charuco_diamond_detection.markdown
+1
-1
No files found.
modules/aruco/include/opencv2/aruco.hpp
View file @
f98580b2
...
@@ -190,9 +190,9 @@ CV_EXPORTS void detectMarkers(InputArray image, Dictionary dictionary, OutputArr
...
@@ -190,9 +190,9 @@ CV_EXPORTS void detectMarkers(InputArray image, Dictionary dictionary, OutputArr
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
* @param distCoeffs vector of distortion coefficients
* @param distCoeffs vector of distortion coefficients
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
* @param rvecs array of output rotation vectors (@sa Rodrigues) (e.g. std::vector<cv::
Mat
>>).
* @param rvecs array of output rotation vectors (@sa Rodrigues) (e.g. std::vector<cv::
Vec3d
>>).
* Each element in rvecs corresponds to the specific marker in imgPoints.
* Each element in rvecs corresponds to the specific marker in imgPoints.
* @param tvecs array of output translation vectors (e.g. std::vector<cv::
Mat
>>).
* @param tvecs array of output translation vectors (e.g. std::vector<cv::
Vec3d
>>).
* Each element in tvecs corresponds to the specific marker in imgPoints.
* Each element in tvecs corresponds to the specific marker in imgPoints.
*
*
* This function receives the detected markers and returns their pose estimation respect to
* This function receives the detected markers and returns their pose estimation respect to
...
...
modules/aruco/samples/detect_board.cpp
View file @
f98580b2
...
@@ -207,7 +207,7 @@ int main(int argc, char *argv[]) {
...
@@ -207,7 +207,7 @@ int main(int argc, char *argv[]) {
vector
<
int
>
ids
;
vector
<
int
>
ids
;
vector
<
vector
<
Point2f
>
>
corners
,
rejected
;
vector
<
vector
<
Point2f
>
>
corners
,
rejected
;
Mat
rvec
,
tvec
;
Vec3d
rvec
,
tvec
;
// detect markers
// detect markers
aruco
::
detectMarkers
(
image
,
dictionary
,
corners
,
ids
,
detectorParams
,
rejected
);
aruco
::
detectMarkers
(
image
,
dictionary
,
corners
,
ids
,
detectorParams
,
rejected
);
...
...
modules/aruco/samples/detect_board_charuco.cpp
View file @
f98580b2
...
@@ -204,7 +204,7 @@ int main(int argc, char *argv[]) {
...
@@ -204,7 +204,7 @@ int main(int argc, char *argv[]) {
vector
<
int
>
markerIds
,
charucoIds
;
vector
<
int
>
markerIds
,
charucoIds
;
vector
<
vector
<
Point2f
>
>
markerCorners
,
rejectedMarkers
;
vector
<
vector
<
Point2f
>
>
markerCorners
,
rejectedMarkers
;
vector
<
Point2f
>
charucoCorners
;
vector
<
Point2f
>
charucoCorners
;
Mat
rvec
,
tvec
;
Vec3d
rvec
,
tvec
;
// detect markers
// detect markers
aruco
::
detectMarkers
(
image
,
dictionary
,
markerCorners
,
markerIds
,
detectorParams
,
aruco
::
detectMarkers
(
image
,
dictionary
,
markerCorners
,
markerIds
,
detectorParams
,
...
...
modules/aruco/samples/detect_diamonds.cpp
View file @
f98580b2
...
@@ -202,7 +202,7 @@ int main(int argc, char *argv[]) {
...
@@ -202,7 +202,7 @@ int main(int argc, char *argv[]) {
vector
<
int
>
markerIds
;
vector
<
int
>
markerIds
;
vector
<
Vec4i
>
diamondIds
;
vector
<
Vec4i
>
diamondIds
;
vector
<
vector
<
Point2f
>
>
markerCorners
,
rejectedMarkers
,
diamondCorners
;
vector
<
vector
<
Point2f
>
>
markerCorners
,
rejectedMarkers
,
diamondCorners
;
vector
<
Mat
>
rvecs
,
tvecs
;
vector
<
Vec3d
>
rvecs
,
tvecs
;
// detect markers
// detect markers
aruco
::
detectMarkers
(
image
,
dictionary
,
markerCorners
,
markerIds
,
detectorParams
,
aruco
::
detectMarkers
(
image
,
dictionary
,
markerCorners
,
markerIds
,
detectorParams
,
...
...
modules/aruco/samples/detect_markers.cpp
View file @
f98580b2
...
@@ -194,7 +194,7 @@ int main(int argc, char *argv[]) {
...
@@ -194,7 +194,7 @@ int main(int argc, char *argv[]) {
vector
<
int
>
ids
;
vector
<
int
>
ids
;
vector
<
vector
<
Point2f
>
>
corners
,
rejected
;
vector
<
vector
<
Point2f
>
>
corners
,
rejected
;
vector
<
Mat
>
rvecs
,
tvecs
;
vector
<
Vec3d
>
rvecs
,
tvecs
;
// detect markers and estimate pose
// detect markers and estimate pose
aruco
::
detectMarkers
(
image
,
dictionary
,
corners
,
ids
,
detectorParams
,
rejected
);
aruco
::
detectMarkers
(
image
,
dictionary
,
corners
,
ids
,
detectorParams
,
rejected
);
...
...
modules/aruco/src/aruco.cpp
View file @
f98580b2
...
@@ -821,9 +821,9 @@ void detectMarkers(InputArray _image, Dictionary dictionary, OutputArrayOfArrays
...
@@ -821,9 +821,9 @@ void detectMarkers(InputArray _image, Dictionary dictionary, OutputArrayOfArrays
*/
*/
class
SinglePoseEstimationParallel
:
public
ParallelLoopBody
{
class
SinglePoseEstimationParallel
:
public
ParallelLoopBody
{
public
:
public
:
SinglePoseEstimationParallel
(
Mat
*
_markerObjPoints
,
InputArrayOfArrays
_corners
,
SinglePoseEstimationParallel
(
Mat
&
_markerObjPoints
,
InputArrayOfArrays
_corners
,
InputArray
_cameraMatrix
,
InputArray
_distCoeffs
,
InputArray
_cameraMatrix
,
InputArray
_distCoeffs
,
OutputArrayOfArrays
_rvecs
,
OutputArrayOfArrays
_tvecs
)
Mat
&
_rvecs
,
Mat
&
_tvecs
)
:
markerObjPoints
(
_markerObjPoints
),
corners
(
_corners
),
cameraMatrix
(
_cameraMatrix
),
:
markerObjPoints
(
_markerObjPoints
),
corners
(
_corners
),
cameraMatrix
(
_cameraMatrix
),
distCoeffs
(
_distCoeffs
),
rvecs
(
_rvecs
),
tvecs
(
_tvecs
)
{}
distCoeffs
(
_distCoeffs
),
rvecs
(
_rvecs
),
tvecs
(
_tvecs
)
{}
...
@@ -832,18 +832,18 @@ class SinglePoseEstimationParallel : public ParallelLoopBody {
...
@@ -832,18 +832,18 @@ class SinglePoseEstimationParallel : public ParallelLoopBody {
const
int
end
=
range
.
end
;
const
int
end
=
range
.
end
;
for
(
int
i
=
begin
;
i
<
end
;
i
++
)
{
for
(
int
i
=
begin
;
i
<
end
;
i
++
)
{
solvePnP
(
*
markerObjPoints
,
corners
.
getMat
(
i
),
cameraMatrix
,
distCoeffs
,
rvecs
.
getMat
(
i
)
,
solvePnP
(
markerObjPoints
,
corners
.
getMat
(
i
),
cameraMatrix
,
distCoeffs
,
tvecs
.
getMat
(
i
));
rvecs
.
at
<
Vec3d
>
(
0
,
i
),
tvecs
.
at
<
Vec3d
>
(
0
,
i
));
}
}
}
}
private
:
private
:
SinglePoseEstimationParallel
&
operator
=
(
const
SinglePoseEstimationParallel
&
);
// to quiet MSVC
SinglePoseEstimationParallel
&
operator
=
(
const
SinglePoseEstimationParallel
&
);
// to quiet MSVC
Mat
*
markerObjPoints
;
Mat
&
markerObjPoints
;
InputArrayOfArrays
corners
;
InputArrayOfArrays
corners
;
InputArray
cameraMatrix
,
distCoeffs
;
InputArray
cameraMatrix
,
distCoeffs
;
OutputArrayOfArrays
rvecs
,
tvecs
;
Mat
&
rvecs
,
tvecs
;
};
};
...
@@ -860,13 +860,10 @@ void estimatePoseSingleMarkers(InputArrayOfArrays _corners, float markerLength,
...
@@ -860,13 +860,10 @@ void estimatePoseSingleMarkers(InputArrayOfArrays _corners, float markerLength,
Mat
markerObjPoints
;
Mat
markerObjPoints
;
_getSingleMarkerObjectPoints
(
markerLength
,
markerObjPoints
);
_getSingleMarkerObjectPoints
(
markerLength
,
markerObjPoints
);
int
nMarkers
=
(
int
)
_corners
.
total
();
int
nMarkers
=
(
int
)
_corners
.
total
();
_rvecs
.
create
(
nMarkers
,
1
,
CV_
32FC1
);
_rvecs
.
create
(
nMarkers
,
1
,
CV_
64FC3
);
_tvecs
.
create
(
nMarkers
,
1
,
CV_
32FC1
);
_tvecs
.
create
(
nMarkers
,
1
,
CV_
64FC3
);
for
(
int
i
=
0
;
i
<
nMarkers
;
i
++
)
{
Mat
rvecs
=
_rvecs
.
getMat
(),
tvecs
=
_tvecs
.
getMat
();
_rvecs
.
create
(
3
,
1
,
CV_64FC1
,
i
,
true
);
_tvecs
.
create
(
3
,
1
,
CV_64FC1
,
i
,
true
);
}
//// for each marker, calculate its pose
//// for each marker, calculate its pose
// for (int i = 0; i < nMarkers; i++) {
// for (int i = 0; i < nMarkers; i++) {
...
@@ -876,8 +873,8 @@ void estimatePoseSingleMarkers(InputArrayOfArrays _corners, float markerLength,
...
@@ -876,8 +873,8 @@ void estimatePoseSingleMarkers(InputArrayOfArrays _corners, float markerLength,
// this is the parallel call for the previous commented loop (result is equivalent)
// this is the parallel call for the previous commented loop (result is equivalent)
parallel_for_
(
Range
(
0
,
nMarkers
),
parallel_for_
(
Range
(
0
,
nMarkers
),
SinglePoseEstimationParallel
(
&
markerObjPoints
,
_corners
,
_cameraMatrix
,
SinglePoseEstimationParallel
(
markerObjPoints
,
_corners
,
_cameraMatrix
,
_distCoeffs
,
_rvecs
,
_
tvecs
));
_distCoeffs
,
rvecs
,
tvecs
));
}
}
...
...
modules/aruco/test/test_charucodetection.cpp
View file @
f98580b2
...
@@ -515,7 +515,7 @@ void CV_CharucoDiamondDetection::run(int) {
...
@@ -515,7 +515,7 @@ void CV_CharucoDiamondDetection::run(int) {
}
}
// estimate diamond pose
// estimate diamond pose
vector
<
Mat
>
estimatedRvec
,
estimatedTvec
;
vector
<
Vec3d
>
estimatedRvec
,
estimatedTvec
;
aruco
::
estimatePoseSingleMarkers
(
diamondCorners
,
squareLength
,
cameraMatrix
,
aruco
::
estimatePoseSingleMarkers
(
diamondCorners
,
squareLength
,
cameraMatrix
,
distCoeffs
,
estimatedRvec
,
estimatedTvec
);
distCoeffs
,
estimatedRvec
,
estimatedTvec
);
...
...
modules/aruco/tutorials/aruco_board_detection/aruco_board_detection.markdown
View file @
f98580b2
...
@@ -64,7 +64,7 @@ The aruco module provides a specific function, ```estimatePoseBoard()```, to per
...
@@ -64,7 +64,7 @@ The aruco module provides a specific function, ```estimatePoseBoard()```, to per
cv
::
aruco
::
detectMarkers
(
inputImage
,
board
.
dictionary
,
markerCorners
,
markerIds
);
cv
::
aruco
::
detectMarkers
(
inputImage
,
board
.
dictionary
,
markerCorners
,
markerIds
);
// if at least one marker detected
// if at least one marker detected
if
(
markerIds
.
size
()
>
0
)
{
if
(
markerIds
.
size
()
>
0
)
{
cv
::
Mat
rvec
,
tvec
;
cv
::
Vec3d
rvec
,
tvec
;
int
valid
=
cv
::
aruco
::
estimatePoseBoard
(
markerCorners
,
markerIds
,
board
,
cameraMatrix
,
distCoeffs
,
rvec
,
tvec
);
int
valid
=
cv
::
aruco
::
estimatePoseBoard
(
markerCorners
,
markerIds
,
board
,
cameraMatrix
,
distCoeffs
,
rvec
,
tvec
);
}
}
```
```
...
@@ -181,7 +181,7 @@ Finally, a full example of board detection:
...
@@ -181,7 +181,7 @@ Finally, a full example of board detection:
if
(
ids
.
size
()
>
0
)
{
if
(
ids
.
size
()
>
0
)
{
cv
::
aruco
::
drawDetectedMarkers
(
imageCopy
,
corners
,
ids
);
cv
::
aruco
::
drawDetectedMarkers
(
imageCopy
,
corners
,
ids
);
cv
::
Mat
rvec
,
tvec
;
cv
::
Vec3d
rvec
,
tvec
;
int
valid
=
estimatePoseBoard
(
corners
,
ids
,
board
,
cameraMatrix
,
distCoeffs
,
rvec
,
tvec
);
int
valid
=
estimatePoseBoard
(
corners
,
ids
,
board
,
cameraMatrix
,
distCoeffs
,
rvec
,
tvec
);
// if at least one board marker detected
// if at least one board marker detected
...
...
modules/aruco/tutorials/aruco_detection/aruco_detection.markdown
View file @
f98580b2
...
@@ -256,7 +256,7 @@ The aruco module provides a function to estimate the poses of all the detected m
...
@@ -256,7 +256,7 @@ The aruco module provides a function to estimate the poses of all the detected m
```
c++
```
c++
Mat
cameraMatrix
,
distCoeffs
;
Mat
cameraMatrix
,
distCoeffs
;
...
...
vector
<
Mat
>
rvecs
,
tvecs
;
vector
<
Vec3d
>
rvecs
,
tvecs
;
cv
::
aruco
::
estimatePoseSingleMarkers
(
corners
,
0.05
,
cameraMatrix
,
distCoeffs
,
rvecs
,
tvecs
);
cv
::
aruco
::
estimatePoseSingleMarkers
(
corners
,
0.05
,
cameraMatrix
,
distCoeffs
,
rvecs
,
tvecs
);
```
```
...
...
modules/aruco/tutorials/charuco_detection/charuco_detection.markdown
View file @
f98580b2
...
@@ -294,7 +294,7 @@ A full example of ChArUco detection with pose estimation:
...
@@ -294,7 +294,7 @@ A full example of ChArUco detection with pose estimation:
// if at least one charuco corner detected
// if at least one charuco corner detected
if(charucoIds.size() > 0) {
if(charucoIds.size() > 0) {
cv::aruco::drawDetectedCornersCharuco(imageCopy, charucoCorners, charucoIds, cv::Scalar(255, 0, 0));
cv::aruco::drawDetectedCornersCharuco(imageCopy, charucoCorners, charucoIds, cv::Scalar(255, 0, 0));
cv::
Mat
rvec, tvec;
cv::
Vec3d
rvec, tvec;
bool valid = cv::aruco::estimatePoseCharucoBoard(charucoCorners, charucoIds, board, cameraMatrix, distCoeffs, rvec, tvec);
bool valid = cv::aruco::estimatePoseCharucoBoard(charucoCorners, charucoIds, board, cameraMatrix, distCoeffs, rvec, tvec);
// if charuco pose is valid
// if charuco pose is valid
if(valid)
if(valid)
...
...
modules/aruco/tutorials/charuco_diamond_detection/charuco_diamond_detection.markdown
View file @
f98580b2
...
@@ -133,7 +133,7 @@ i.e. using the ```estimatePoseSingleMarkers()``` function. For instance:
...
@@ -133,7 +133,7 @@ i.e. using the ```estimatePoseSingleMarkers()``` function. For instance:
cv
::
aruco
::
detectCharucoDiamond
(
inputImage
,
markerCorners
,
markerIds
,
squareLength
/
markerLength
,
diamondCorners
,
diamondIds
);
cv
::
aruco
::
detectCharucoDiamond
(
inputImage
,
markerCorners
,
markerIds
,
squareLength
/
markerLength
,
diamondCorners
,
diamondIds
);
// estimate poses
// estimate poses
std
::
vector
<
cv
::
Mat
>
rvecs
,
tvecs
;
std
::
vector
<
cv
::
Vec3d
>
rvecs
,
tvecs
;
cv
::
aruco
::
estimatePoseSingleMarkers
(
diamondCorners
,
squareLength
,
camMatrix
,
distCoeffs
,
rvecs
,
tvecs
);
cv
::
aruco
::
estimatePoseSingleMarkers
(
diamondCorners
,
squareLength
,
camMatrix
,
distCoeffs
,
rvecs
,
tvecs
);
// draw axis
// draw axis
...
...
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