summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-01-15 19:47:43 +0100
committerJules Laplace <julescarbon@gmail.com>2019-01-15 19:47:43 +0100
commit580f27bcc5a176fb6a836b83c53475c8a630c659 (patch)
treec6e5a2156aecef2e74654633fe60236b5c0ff907
parent8e06e61f3fd4cfab3f16f66e186abeee7a4cabf1 (diff)
fix
-rw-r--r--crop_frames.py4
-rw-r--r--merge_frames.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/crop_frames.py b/crop_frames.py
index 7f42d47..e3641df 100644
--- a/crop_frames.py
+++ b/crop_frames.py
@@ -29,7 +29,7 @@ def crop_dir():
yy = max(0, y - overlap)
w = min(side, width - xx)
h = min(side, height - yy)
- crop_dir = "{}/crop_{}_{}_{}_{}".format(args.out_dir, xx, yy, w, h)
+ crop_dir = "{}/crop_{}_{}_{}_{}".format(args.out_dir, x, y, w, h)
if os.path.exists(crop_dir):
rmtree(crop_dir)
os.makedirs(crop_dir)
@@ -51,7 +51,7 @@ def crop_image(raw_fn, width, height, step, side, overlap):
yy = max(0, y - overlap)
w = min(side, width - xx)
h = min(side, height - yy)
- crop_dir = "{}/crop_{}_{}_{}_{}".format(args.out_dir, xx, yy, w, h)
+ crop_dir = "{}/crop_{}_{}_{}_{}".format(args.out_dir, x, y, w, h)
# print("{}x{} {}x{}".format(x, y, w, h))
crop = img.crop((xx, yy, xx + w, yy + h))
crop.save("{}/{}".format(crop_dir, fn))
diff --git a/merge_frames.py b/merge_frames.py
index ed7b9ff..c413b97 100644
--- a/merge_frames.py
+++ b/merge_frames.py
@@ -25,7 +25,7 @@ def merge_files(file, crop_dir_list, ww, hh, overlap, merge_dir):
crop_dir = "crop_{}_{}_{}_{}".format(x, y, w, h)
image = Image.open("{}/{}/{}".format(args.dir, crop_dir, fn))
crop = image.crop((overlap, overlap, image.size[0] - overlap * 2, image.size[1] - overlap * 2))
- canvas.paste(image, (x * args.scale, y * args.scale,))
+ canvas.paste(crop, (x * args.scale, y * args.scale,))
canvas.save("{}/{}".format(merge_dir, fn))
def merge_dir():
@@ -48,11 +48,11 @@ def merge_dir():
crop_dir_list.append((x, y, w, h,))
crop_dir_list = sorted(crop_dir_list, key=operator.itemgetter(0, 1))
- print("{}x{}".format(ww, hh))
-
ww *= args.scale
hh *= args.scale
+ print("{}x{}".format(ww, hh))
+
files = sorted(glob.glob("{}/*.png".format(crop_dirs[0])))
dataset = []
for file in files: