1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2025-09-26 09:24:38 +03:00
91 changed files with 5339 additions and 1508 deletions
+9
View File
@@ -1616,3 +1616,12 @@
volume = {8},
url = {https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=1fbd43f3827fffeb76641a9c5ab5b625eb5a75ba}
}
@article{Aggarwal1985,
author = {Aggarwal, A. and Chang, J. and Yap, Chee K.},
title = {Minimum area circumscribing Polygons},
year = {1985},
pages = {112--117},
journal = {The Visual Computer},
volume = {7},
url = {https://doi.org/10.1007/BF01898354}
}
+8 -3
View File
@@ -16,6 +16,7 @@ python gen_pattern.py -o out.svg -r 11 -c 8 -T circles -s 20.0 -R 5.0 -u mm -w 2
-m, --markers - list of cells with markers for the radon checkerboard
-p, --aruco_marker_size - aruco markers size for ChAruco pattern (default 10.0)
-f, --dict_file - file name of custom aruco dictionary for ChAruco pattern
-do, --dict_offset - index of the first ArUco index used
-H, --help - show help
"""
@@ -27,7 +28,7 @@ from svgfig import *
class PatternMaker:
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height, markers, aruco_marker_size, dict_file):
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height, markers, aruco_marker_size, dict_file, dict_offset):
self.cols = cols
self.rows = rows
self.output = output
@@ -39,6 +40,7 @@ class PatternMaker:
self.markers = markers
self.aruco_marker_size = aruco_marker_size #for charuco boards only
self.dict_file = dict_file
self.dict_offset = dict_offset
self.g = SVG("g") # the svg group container
@@ -188,7 +190,7 @@ class PatternMaker:
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
marker_id = self.dict_offset
for y in range(0, self.rows):
for x in range(0, self.cols):
@@ -248,6 +250,8 @@ def main():
action="store", dest="aruco_marker_size", type=float)
parser.add_argument("-f", "--dict_file", help="file name of custom aruco dictionary for ChAruco pattern", default="DICT_ARUCO_ORIGINAL.json",
action="store", dest="dict_file", type=str)
parser.add_argument("-do", "--dict_offset", help="index of the first ArUco index used", default=0,
action="store", dest="dict_offset", type=int)
args = parser.parse_args()
show_help = args.show_help
@@ -263,6 +267,7 @@ def main():
radius_rate = args.radius_rate
aruco_marker_size = args.aruco_marker_size
dict_file = args.dict_file
dict_offset = args.dict_offset
if 'page_width' and 'page_height' in args:
page_width = args.page_width
@@ -288,7 +293,7 @@ def main():
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)
pm = PatternMaker(columns, rows, output, units, square_size, radius_rate, page_width, page_height, markers, aruco_marker_size, dict_file, dict_offset)
# dict for easy lookup of pattern type
mp = {"circles": pm.make_circles_pattern, "acircles": pm.make_acircles_pattern,
"checkerboard": pm.make_checkerboard_pattern, "radon_checkerboard": pm.make_radon_checkerboard_pattern,
+2 -2
View File
@@ -44,7 +44,7 @@ class aruco_objdetect_test(NewOpenCVTests):
basedir = os.path.abspath(os.path.dirname(__file__))
pm = gen_pattern.PatternMaker(cols, rows, filesvg, "px", square_size, 0, board_width,
board_height, "charuco_checkboard", marker_size,
os.path.join(basedir, aruco_type_str[aruco_type_i]+'.json.gz'))
os.path.join(basedir, aruco_type_str[aruco_type_i]+'.json.gz'), 0)
pm.make_charuco_board()
pm.save()
drawing = svg2rlg(filesvg)
@@ -101,7 +101,7 @@ class aruco_objdetect_test(NewOpenCVTests):
try:
basedir = os.path.abspath(os.path.dirname(__file__))
pm = gen_pattern.PatternMaker(cols, rows, filesvg, "px", square_size, 0, board_width,
board_height, "charuco_checkboard", marker_size, os.path.join(basedir, aruco_type_str+'.json.gz'))
board_height, "charuco_checkboard", marker_size, os.path.join(basedir, aruco_type_str+'.json.gz'), 0)
pm.make_charuco_board()
pm.save()
drawing = svg2rlg(filesvg)