max(yo - 1, 0):max(yo + 2, 0),
max(xo - 21, 0):max(xo + 22, 0)
] = 0.
- gamma.write_image(f'diag_{xc:d}_{yc:d}_corr.jpg', temp)
+ gamma.write_image(f'diag_{xc:d}_{yc:d}_corr.png', temp)
if (
max_corr < EPSILON or
xo < CUTOFF1 or
max(y - 1, 0):max(y + 2, 0),
max(x - 21, 0):max(x + 22, 0)
] = 0.
- gamma.write_image(f'diag_{xc:d}_{yc:d}_match.jpg', temp)
+ gamma.write_image(f'diag_{xc:d}_{yc:d}_match.png', temp)
diag0 = block0 + .5
diag0[
max(x - 21, 0):max(x + 22, 0),
:
] = 0.
- gamma.write_image(f'diag_{xc:d}_{yc:d}_block0.jpg', diag0)
+ gamma.write_image(f'diag_{xc:d}_{yc:d}_block0.png', diag0)
diag1 = block10 + .5
diag1[
max(x - 21, 0):max(x + 22, 0),
:
] = 0.
- gamma.write_image(f'diag_{xc:d}_{yc:d}_block10.jpg', diag1)
+ gamma.write_image(f'diag_{xc:d}_{yc:d}_block10.png', diag1)
x += xo
y += yo
max(x - 21, 0):max(x + 22, 0),
:
] = 0.
- gamma.write_image(f'diag_{xc:d}_{yc:d}_block11.jpg', diag1)
+ gamma.write_image(f'diag_{xc:d}_{yc:d}_block11.png', diag1)
# return offset and feature relative to block centre
return xo - XS, yo - YS, xf - XM // 2, yf - YM // 2
]
# first file is special as no transformation needs to be done
-in_jpg, out_jpg = files[0]
+in_png, out_png = files[0]
-print(f'read {in_jpg:s}')
-image0 = gamma.read_image(in_jpg)
+print(f'read {in_png:s}')
+image0 = gamma.read_image(in_png)
shape = image0.shape
-sys.stderr.write(f'write {out_jpg:s}\n')
-gamma.write_image(out_jpg, image0)
+sys.stderr.write(f'write {out_png:s}\n')
+gamma.write_image(out_png, image0)
ys, xs, cs = shape
xb = (xs - XM - 2 * XS) // XP // 2
print('normalize')
normalized0 = normalize(image0)
if diag:
- gamma.write_image('normalized0.jpg', normalized0 + .5)
+ gamma.write_image('normalized0.png', normalized0 + .5)
# loop through remaining files comparing each to the previous
cumulative_A = numpy.identity(3, numpy.double)
for file in range(1, len(files)):
- in_jpg, out_jpg = files[file]
+ in_png, out_png = files[file]
- print(f'read {in_jpg:s}')
- image1 = gamma.read_image(in_jpg)
+ print(f'read {in_png:s}')
+ image1 = gamma.read_image(in_png)
assert image1.shape == shape
print('normalize')
normalized1 = normalize(image1)
if diag:
- gamma.write_image(f'normalized{file:d}.jpg', normalized1 + .5)
+ gamma.write_image(f'normalized{file:d}.png', normalized1 + .5)
print('find corner candidates')
p_all = []
max(xf1 - 21, 0):max(xf1 + 22, 0),
:
] = 0.
- gamma.write_image(f'diag_file{file:d}_0.jpg', diag0)
- gamma.write_image(f'diag_file{file:d}_1.jpg', diag1)
+ gamma.write_image(f'diag_file{file:d}_0.png', diag0)
+ gamma.write_image(f'diag_file{file:d}_1.png', diag1)
print('remap')
out_image1 = perspective.remap_image(cumulative_A, image1)
- sys.stderr.write(f'write {out_jpg:s}\n')
- gamma.write_image(out_jpg, out_image1)
+ sys.stderr.write(f'write {out_png:s}\n')
+ gamma.write_image(out_png, out_image1)
image0 = image1
normalized0 = normalized1