Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/pattern_tools/gen_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ def make_charuco_board(self):
yspacing = (self.height - self.rows * self.square_size) / 2.0

ch_ar_border = (self.square_size - self.aruco_marker_size)/2
if ch_ar_border < side*0.7:
print("Marker border {} is less than 70% of ArUco pin size {}. Please increase --square_size or decrease --marker_size for stable board detection".format(ch_ar_border, int(side)))
marker_id = 0
for y in range(0, self.rows):
for x in range(0, self.cols):
Expand Down Expand Up @@ -283,6 +285,9 @@ def main():
else:
raise ValueError("The marker {},{} is outside the checkerboard".format(x, y))

if p_type == "charuco_board" and aruco_marker_size >= square_size:
raise ValueError("ArUco markers size must be smaller than square size")

pm = PatternMaker(columns, rows, output, units, square_size, radius_rate, page_width, page_height, markers, aruco_marker_size, dict_file)
# dict for easy lookup of pattern type
mp = {"circles": pm.make_circles_pattern, "acircles": pm.make_acircles_pattern,
Expand Down
14 changes: 12 additions & 2 deletions modules/objdetect/src/aruco/aruco_board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// of this distribution and at http://opencv.org/license.html

#include "../precomp.hpp"
#include <opencv2/core/utils/logger.hpp>
#include "opencv2/objdetect/aruco_board.hpp"

#include <opencv2/objdetect/aruco_dictionary.hpp>
Expand Down Expand Up @@ -250,7 +251,11 @@ GridBoard::GridBoard() {}
GridBoard::GridBoard(const Size& size, float markerLength, float markerSeparation,
const Dictionary &dictionary, InputArray ids):
Board(new GridBoardImpl(dictionary, size, markerLength, markerSeparation)) {

float onePin = markerLength / ((float)(dictionary.markerSize+2));
if (markerSeparation < onePin*.7f) {
CV_LOG_WARNING(NULL, "Marker border " << markerSeparation << " is less than 70% of ArUco pin size "
<< onePin << ". Please increase markerSeparation or decrease markerLength for stable board detection");
}
size_t totalMarkers = (size_t) size.width*size.height;
CV_Assert(ids.empty() || totalMarkers == ids.total());
vector<vector<Point3f> > objPoints;
Expand Down Expand Up @@ -541,7 +546,12 @@ CharucoBoard::CharucoBoard(const Size& size, float squareLength, float markerLen
Board(new CharucoBoardImpl(dictionary, size, squareLength, markerLength)) {

CV_Assert(size.width > 1 && size.height > 1 && markerLength > 0 && squareLength > markerLength);

float onePin = markerLength / ((float)(dictionary.markerSize+2));
float markerSeparation = (squareLength - markerLength)/2.f;
if (markerSeparation < onePin*.7f) {
CV_LOG_WARNING(NULL, "Marker border " << markerSeparation << " is less than 70% of ArUco pin size "
<< onePin <<". Please increase markerSeparation or decrease markerLength for stable board detection");
}
ids.copyTo(impl->ids);

static_pointer_cast<CharucoBoardImpl>(impl)->createCharucoBoard();
Expand Down