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
3644a1d9
Commit
3644a1d9
authored
Jun 07, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2141 from paroj:lambda
parents
250bcd9f
b2f08277
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
61 deletions
+19
-61
aruco.cpp
modules/aruco/src/aruco.cpp
+0
-0
charuco.cpp
modules/aruco/src/charuco.cpp
+19
-61
No files found.
modules/aruco/src/aruco.cpp
View file @
3644a1d9
This diff is collapsed.
Click to expand it.
modules/aruco/src/charuco.cpp
View file @
3644a1d9
...
...
@@ -270,50 +270,6 @@ static int _filterCornersWithoutMinMarkers(const Ptr<CharucoBoard> &_board,
return
(
int
)
_filteredCharucoIds
.
total
();
}
/**
* ParallelLoopBody class for the parallelization of the charuco corners subpixel refinement
* Called from function _selectAndRefineChessboardCorners()
*/
class
CharucoSubpixelParallel
:
public
ParallelLoopBody
{
public
:
CharucoSubpixelParallel
(
const
Mat
*
_grey
,
vector
<
Point2f
>
*
_filteredChessboardImgPoints
,
vector
<
Size
>
*
_filteredWinSizes
,
const
Ptr
<
DetectorParameters
>
&
_params
)
:
grey
(
_grey
),
filteredChessboardImgPoints
(
_filteredChessboardImgPoints
),
filteredWinSizes
(
_filteredWinSizes
),
params
(
_params
)
{}
void
operator
()(
const
Range
&
range
)
const
CV_OVERRIDE
{
const
int
begin
=
range
.
start
;
const
int
end
=
range
.
end
;
for
(
int
i
=
begin
;
i
<
end
;
i
++
)
{
vector
<
Point2f
>
in
;
in
.
push_back
((
*
filteredChessboardImgPoints
)[
i
]);
Size
winSize
=
(
*
filteredWinSizes
)[
i
];
if
(
winSize
.
height
==
-
1
||
winSize
.
width
==
-
1
)
winSize
=
Size
(
params
->
cornerRefinementWinSize
,
params
->
cornerRefinementWinSize
);
cornerSubPix
(
*
grey
,
in
,
winSize
,
Size
(),
TermCriteria
(
TermCriteria
::
MAX_ITER
|
TermCriteria
::
EPS
,
params
->
cornerRefinementMaxIterations
,
params
->
cornerRefinementMinAccuracy
));
(
*
filteredChessboardImgPoints
)[
i
]
=
in
[
0
];
}
}
private
:
CharucoSubpixelParallel
&
operator
=
(
const
CharucoSubpixelParallel
&
);
// to quiet MSVC
const
Mat
*
grey
;
vector
<
Point2f
>
*
filteredChessboardImgPoints
;
vector
<
Size
>
*
filteredWinSizes
;
const
Ptr
<
DetectorParameters
>
&
params
;
};
/**
* @brief From all projected chessboard corners, select those inside the image and apply subpixel
* refinement. Returns number of valid corners.
...
...
@@ -353,23 +309,25 @@ static int _selectAndRefineChessboardCorners(InputArray _allCorners, InputArray
const
Ptr
<
DetectorParameters
>
params
=
DetectorParameters
::
create
();
// use default params for corner refinement
//// For each of the charuco corners, apply subpixel refinement using its correspondind winSize
// for(unsigned int i=0; i<filteredChessboardImgPoints.size(); i++) {
// vector<Point2f> in;
// in.push_back(filteredChessboardImgPoints[i]);
// Size winSize = filteredWinSizes[i];
// if(winSize.height == -1 || winSize.width == -1)
// winSize = Size(params.cornerRefinementWinSize, params.cornerRefinementWinSize);
// cornerSubPix(grey, in, winSize, Size(),
// TermCriteria(TermCriteria::MAX_ITER | TermCriteria::EPS,
// params->cornerRefinementMaxIterations,
// params->cornerRefinementMinAccuracy));
// filteredChessboardImgPoints[i] = in[0];
//}
// this is the parallel call for the previous commented loop (result is equivalent)
parallel_for_
(
Range
(
0
,
(
int
)
filteredChessboardImgPoints
.
size
()),
CharucoSubpixelParallel
(
&
grey
,
&
filteredChessboardImgPoints
,
&
filteredWinSizes
,
params
));
parallel_for_
(
Range
(
0
,
(
int
)
filteredChessboardImgPoints
.
size
()),
[
&
](
const
Range
&
range
)
{
const
int
begin
=
range
.
start
;
const
int
end
=
range
.
end
;
for
(
int
i
=
begin
;
i
<
end
;
i
++
)
{
vector
<
Point2f
>
in
;
in
.
push_back
(
filteredChessboardImgPoints
[
i
]);
Size
winSize
=
filteredWinSizes
[
i
];
if
(
winSize
.
height
==
-
1
||
winSize
.
width
==
-
1
)
winSize
=
Size
(
params
->
cornerRefinementWinSize
,
params
->
cornerRefinementWinSize
);
cornerSubPix
(
grey
,
in
,
winSize
,
Size
(),
TermCriteria
(
TermCriteria
::
MAX_ITER
|
TermCriteria
::
EPS
,
params
->
cornerRefinementMaxIterations
,
params
->
cornerRefinementMinAccuracy
));
filteredChessboardImgPoints
[
i
]
=
in
[
0
];
}
});
// parse output
Mat
(
filteredChessboardImgPoints
).
copyTo
(
_selectedCorners
);
...
...
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