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
9b06bb28
Commit
9b06bb28
authored
Jan 14, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #506 from jfolz:aruco-types
parents
b6a97e3e
d58c5e8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
15 deletions
+19
-15
aruco.cpp
modules/aruco/src/aruco.cpp
+18
-14
dictionary.cpp
modules/aruco/src/dictionary.cpp
+1
-1
No files found.
modules/aruco/src/aruco.cpp
View file @
9b06bb28
...
...
@@ -206,7 +206,7 @@ static void _filterTooCloseCandidates(const vector< vector< Point2f > > &candida
int
minimumPerimeter
=
min
((
int
)
contoursIn
[
i
].
size
(),
(
int
)
contoursIn
[
j
].
size
()
);
// fc is the first corner considered on one of the markers, 4 combinatio
s are po
sible
// fc is the first corner considered on one of the markers, 4 combinatio
ns are pos
sible
for
(
int
fc
=
0
;
fc
<
4
;
fc
++
)
{
double
distSq
=
0
;
for
(
int
c
=
0
;
c
<
4
;
c
++
)
{
...
...
@@ -244,7 +244,7 @@ static void _filterTooCloseCandidates(const vector< vector< Point2f > > &candida
// remove extra candidates
candidatesOut
.
clear
();
int
totalRemaining
=
0
;
unsigned
long
totalRemaining
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
toRemove
.
size
();
i
++
)
if
(
!
toRemove
[
i
])
totalRemaining
++
;
candidatesOut
.
resize
(
totalRemaining
);
...
...
@@ -315,8 +315,8 @@ static void _detectInitialCandidates(const Mat &grey, vector< vector< Point2f >
int
nScales
=
(
params
.
adaptiveThreshWinSizeMax
-
params
.
adaptiveThreshWinSizeMin
)
/
params
.
adaptiveThreshWinSizeStep
+
1
;
vector
<
vector
<
vector
<
Point2f
>
>
>
candidatesArrays
(
nScales
);
vector
<
vector
<
vector
<
Point
>
>
>
contoursArrays
(
nScales
);
vector
<
vector
<
vector
<
Point2f
>
>
>
candidatesArrays
(
(
size_t
)
nScales
);
vector
<
vector
<
vector
<
Point
>
>
>
contoursArrays
(
(
size_t
)
nScales
);
////for each value in the interval of thresholding window sizes
// for(int i = 0; i < nScales; i++) {
...
...
@@ -450,7 +450,7 @@ static Mat _extractBits(InputArray _image, InputArray _corners, int markerSize,
Mat
square
=
resultImg
(
Rect
(
Xstart
,
Ystart
,
cellSize
-
2
*
cellMarginPixels
,
cellSize
-
2
*
cellMarginPixels
));
// count white pixels on each cell to assign its value
unsigned
int
nZ
=
countNonZero
(
square
);
size_t
nZ
=
(
size_t
)
countNonZero
(
square
);
if
(
nZ
>
square
.
total
()
/
2
)
bits
.
at
<
unsigned
char
>
(
y
,
x
)
=
1
;
}
}
...
...
@@ -890,7 +890,7 @@ static void _getBoardObjectAndImagePoints(const Board &board, InputArray _detect
CV_Assert
(
board
.
ids
.
size
()
==
board
.
objPoints
.
size
());
CV_Assert
(
_detectedIds
.
total
()
==
_detectedCorners
.
total
());
int
nDetectedMarkers
=
(
int
)
_detectedIds
.
total
();
size_t
nDetectedMarkers
=
_detectedIds
.
total
();
vector
<
Point3f
>
objPnts
;
objPnts
.
reserve
(
nDetectedMarkers
);
...
...
@@ -899,7 +899,7 @@ static void _getBoardObjectAndImagePoints(const Board &board, InputArray _detect
imgPnts
.
reserve
(
nDetectedMarkers
);
// look for detected markers that belong to the board and get their information
for
(
int
i
=
0
;
i
<
nDetectedMarkers
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
nDetectedMarkers
;
i
++
)
{
int
currentId
=
_detectedIds
.
getMat
().
ptr
<
int
>
(
0
)[
i
];
for
(
unsigned
int
j
=
0
;
j
<
board
.
ids
.
size
();
j
++
)
{
if
(
currentId
==
board
.
ids
[
j
])
{
...
...
@@ -1299,13 +1299,14 @@ GridBoard GridBoard::create(int markersX, int markersY, float markerLength, floa
res
.
_markerSeparation
=
markerSeparation
;
res
.
dictionary
=
_dictionary
;
int
totalMarkers
=
markersX
*
markersY
;
size_t
totalMarkers
=
(
size_t
)
markersX
*
markersY
;
res
.
ids
.
resize
(
totalMarkers
);
res
.
objPoints
.
reserve
(
totalMarkers
);
// fill ids with first identifiers
for
(
int
i
=
0
;
i
<
totalMarkers
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
totalMarkers
;
i
++
)
{
res
.
ids
[
i
]
=
i
;
}
// calculate Board objPoints
float
maxY
=
(
float
)
markersY
*
markerLength
+
(
markersY
-
1
)
*
markerSeparation
;
...
...
@@ -1515,14 +1516,17 @@ double calibrateCameraAruco(InputArrayOfArrays _corners, InputArray _ids, InputA
// for each frame, get properly processed imagePoints and objectPoints for the calibrateCamera
// function
vector
<
Mat
>
processedObjectPoints
,
processedImagePoints
;
int
nFrames
=
(
int
)
_counter
.
total
();
size_t
nFrames
=
_counter
.
total
();
int
markerCounter
=
0
;
for
(
in
t
frame
=
0
;
frame
<
nFrames
;
frame
++
)
{
int
nMarkersInThisFrame
=
_counter
.
getMat
().
ptr
<
int
>
()[
frame
];
for
(
size_
t
frame
=
0
;
frame
<
nFrames
;
frame
++
)
{
int
nMarkersInThisFrame
=
_counter
.
getMat
().
ptr
<
int
>
()[
frame
];
vector
<
Mat
>
thisFrameCorners
;
vector
<
int
>
thisFrameIds
;
thisFrameCorners
.
reserve
(
nMarkersInThisFrame
);
thisFrameIds
.
reserve
(
nMarkersInThisFrame
);
CV_Assert
(
nMarkersInThisFrame
>
0
);
thisFrameCorners
.
reserve
((
size_t
)
nMarkersInThisFrame
);
thisFrameIds
.
reserve
((
size_t
)
nMarkersInThisFrame
);
for
(
int
j
=
markerCounter
;
j
<
markerCounter
+
nMarkersInThisFrame
;
j
++
)
{
thisFrameCorners
.
push_back
(
_corners
.
getMat
(
j
));
thisFrameIds
.
push_back
(
_ids
.
getMat
().
ptr
<
int
>
()[
j
]);
...
...
modules/aruco/src/dictionary.cpp
View file @
9b06bb28
...
...
@@ -313,7 +313,7 @@ static Mat _generateRandomMarker(int markerSize) {
Mat
marker
(
markerSize
,
markerSize
,
CV_8UC1
,
Scalar
::
all
(
0
));
for
(
int
i
=
0
;
i
<
markerSize
;
i
++
)
{
for
(
int
j
=
0
;
j
<
markerSize
;
j
++
)
{
unsigned
char
bit
=
rand
()
%
2
;
unsigned
char
bit
=
(
unsigned
char
)
(
rand
()
%
2
)
;
marker
.
at
<
unsigned
char
>
(
i
,
j
)
=
bit
;
}
}
...
...
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