Commit 71fc875a authored by Matt Clarkson's avatar Matt Clarkson

Issue #18: Allow to configure scaling and faction in grid generator.

parent d9a5c74d
Pipeline #3965 failed with stages
in 2 minutes and 12 seconds
......@@ -32,12 +32,24 @@ def main(args=None):
type=int,
help="Radius of dots in pixels.")
parser.add_argument("-s", "--spacing",
parser.add_argument("-sp", "--spacing",
required=False,
default=100,
type=int,
help="Spacing of dots in pixels.")
parser.add_argument("-sc", "--scaling",
required=False,
default=2,
type=int,
help="Scale factor for larger dots.")
parser.add_argument("-f", "--fraction",
required=False,
default=0.375,
type=int,
help="Fraction of image to left/top of first big dot.")
parser.add_argument("-xd", "--x_dots",
required=False,
default=25,
......@@ -70,6 +82,8 @@ def main(args=None):
args.y_size,
args.radius,
args.spacing,
args.scaling,
args.fraction,
args.x_dots,
args.y_dots,
args.output_file
......
......@@ -10,6 +10,8 @@ def make_calibration_dots(width,
height,
radius,
spacing,
scaling,
fraction,
x_dots,
y_dots,
output_file
......@@ -33,10 +35,10 @@ def make_calibration_dots(width,
image = 255 * np.ones(shape=[height, width], dtype=np.uint8)
one_third_x = (x_dots // 3) - 1
one_third_y = (y_dots // 3) - 1
two_third_x = (x_dots - 1) - one_third_x
two_third_y = (y_dots - 1) - one_third_y
fraction_x = int(x_dots * fraction) - 1
fraction_y = int(y_dots * fraction) - 1
opposite_fraction_x = (x_dots - 1) - fraction_x
opposite_fraction_y = (y_dots - 1) - fraction_y
for y_index in range(y_dots):
for x_index in range(x_dots):
......@@ -44,15 +46,19 @@ def make_calibration_dots(width,
dot_y = int(centre_y + (y_index * spacing) - half_height)
rad = radius
big = 2 * rad
big = scaling * rad
if x_index == one_third_x and y_index == one_third_y:
if x_index == fraction_x \
and y_index == fraction_y:
rad = big
if x_index == one_third_x and y_index == two_third_y:
if x_index == fraction_x \
and y_index == opposite_fraction_y:
rad = big
if x_index == two_third_x and y_index == two_third_y:
if x_index == opposite_fraction_x \
and y_index == opposite_fraction_y:
rad = big
if x_index == two_third_x and y_index == one_third_y:
if x_index == opposite_fraction_x \
and y_index == fraction_y:
rad = big
cv2.circle(image, (dot_x, dot_y), rad, (0, 0, 0), thickness=-1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment