diff --git a/colorization/imgs/AK044_271-271.jpg b/colorization/imgs/AK044_271.jpg similarity index 100% rename from colorization/imgs/AK044_271-271.jpg rename to colorization/imgs/AK044_271.jpg diff --git a/colorization/imgs/AK050_506-506.jpg b/colorization/imgs/AK050_506.jpg similarity index 100% rename from colorization/imgs/AK050_506-506.jpg rename to colorization/imgs/AK050_506.jpg diff --git a/colorization/imgs/AK074_204.jpg b/colorization/imgs/AK074_204.jpg new file mode 100644 index 0000000000000000000000000000000000000000..afd7d7a80693529c816f50b1afd2a759d4da5a1d Binary files /dev/null and b/colorization/imgs/AK074_204.jpg differ diff --git a/colorization/imgs/AK111_139.jpg b/colorization/imgs/AK111_139.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a2a90389b32358d2f0bc7dcbf14c0ea25e7df82f Binary files /dev/null and b/colorization/imgs/AK111_139.jpg differ diff --git a/colorization/imgs_out/AK044_271-271_eccv16.png b/colorization/imgs_out/AK044_271_eccv16.png similarity index 100% rename from colorization/imgs_out/AK044_271-271_eccv16.png rename to colorization/imgs_out/AK044_271_eccv16.png diff --git a/colorization/imgs_out/AK044_271-271_siggraph17.png b/colorization/imgs_out/AK044_271_siggraph17.png similarity index 100% rename from colorization/imgs_out/AK044_271-271_siggraph17.png rename to colorization/imgs_out/AK044_271_siggraph17.png diff --git a/colorization/imgs_out/AK050_506-506_eccv16.png b/colorization/imgs_out/AK050_506_eccv16.png similarity index 100% rename from colorization/imgs_out/AK050_506-506_eccv16.png rename to colorization/imgs_out/AK050_506_eccv16.png diff --git a/colorization/imgs_out/AK050_506-506_siggraph17.png b/colorization/imgs_out/AK050_506_siggraph17.png similarity index 100% rename from colorization/imgs_out/AK050_506-506_siggraph17.png rename to colorization/imgs_out/AK050_506_siggraph17.png diff --git a/colorization/imgs_out/AK074_204_eccv16.png b/colorization/imgs_out/AK074_204_eccv16.png new file mode 100644 index 0000000000000000000000000000000000000000..b77b8df004a1792c4d21178d682e6e8923cad4f4 Binary files /dev/null and b/colorization/imgs_out/AK074_204_eccv16.png differ diff --git a/colorization/imgs_out/AK074_204_siggraph17.png b/colorization/imgs_out/AK074_204_siggraph17.png new file mode 100644 index 0000000000000000000000000000000000000000..590b100c421ff699792ab5bd111a6550dca8fe0c Binary files /dev/null and b/colorization/imgs_out/AK074_204_siggraph17.png differ diff --git a/colorization/imgs_out/AK111_139_eccv16.png b/colorization/imgs_out/AK111_139_eccv16.png new file mode 100644 index 0000000000000000000000000000000000000000..c2fc6041500df000c2e7d89ccc97ae7fe6ad7488 Binary files /dev/null and b/colorization/imgs_out/AK111_139_eccv16.png differ diff --git a/colorization/imgs_out/AK111_139_siggraph17.png b/colorization/imgs_out/AK111_139_siggraph17.png new file mode 100644 index 0000000000000000000000000000000000000000..b9d494167928d9572a15a72c22e22b46b7b11bd1 Binary files /dev/null and b/colorization/imgs_out/AK111_139_siggraph17.png differ diff --git a/stitching/__init__.py b/stitching/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/stitching/imgs/AK074_204_left.jpg b/stitching/imgs/AK074_204_left.jpg new file mode 100644 index 0000000000000000000000000000000000000000..96d145420e06618c46931ada5b1ad2223dd67987 Binary files /dev/null and b/stitching/imgs/AK074_204_left.jpg differ diff --git a/stitching/imgs/AK074_204_right.jpg b/stitching/imgs/AK074_204_right.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6fb2421dd837173bbb83ebbcec4eaae5f641c5b8 Binary files /dev/null and b/stitching/imgs/AK074_204_right.jpg differ diff --git a/stitching/imgs_out/AK074_204_stitched_panorama.jpg b/stitching/imgs_out/AK074_204_stitched_panorama.jpg new file mode 100644 index 0000000000000000000000000000000000000000..80cad885f1eb358e833acacb65befff35c32400c Binary files /dev/null and b/stitching/imgs_out/AK074_204_stitched_panorama.jpg differ diff --git a/stitching/imgs_out/AK074_204_stitched_scan.jpg b/stitching/imgs_out/AK074_204_stitched_scan.jpg new file mode 100644 index 0000000000000000000000000000000000000000..90f21988760cc4086c8446d7a83fa9ec8e9cd6e2 Binary files /dev/null and b/stitching/imgs_out/AK074_204_stitched_scan.jpg differ diff --git a/stitching/stitch_demo.py b/stitching/stitch_demo.py new file mode 100644 index 0000000000000000000000000000000000000000..36a8a03f06a946e692db141c75265da29a4a0c76 --- /dev/null +++ b/stitching/stitch_demo.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +""" +Stitching sample +================ + +Show how to use Stitcher API from python in a simple way to stitch panoramas +or scans. +""" + +# Python 2/3 compatibility +from __future__ import print_function + +import numpy as np +import cv2 as cv + +import argparse +import sys + +modes = (cv.Stitcher_PANORAMA, cv.Stitcher_SCANS) + +parser = argparse.ArgumentParser(prog='stitch_demo.py', description='Stitching sample.') +parser.add_argument('--mode', + type=int, choices=modes, default=cv.Stitcher_PANORAMA, + help='Determines configuration of stitcher. The default is `PANORAMA` (%d), ' + 'mode suitable for creating photo panoramas. Option `SCANS` (%d) is suitable ' + 'for stitching materials under affine transformation, such as scans.' % modes) +parser.add_argument('--output', default='result.jpg', + help='Resulting image. The default is `result.jpg`.') +parser.add_argument('img', nargs='+', help='input images') + +__doc__ += '\n' + parser.format_help() + + +def main(): + args = parser.parse_args() + + # read input images + imgs = [] + for img_name in args.img: + img = cv.imread(cv.samples.findFile(img_name)) + if img is None: + print("can't read image " + img_name) + sys.exit(-1) + imgs.append(img) + + stitcher = cv.Stitcher.create(args.mode) + status, pano = stitcher.stitch(imgs) + + if status != cv.Stitcher_OK: + print("Can't stitch images, error code = %d" % status) + sys.exit(-1) + + cv.imwrite(args.output, pano) + print("stitching completed successfully. %s saved!" % args.output) + + print('Done') + + +if __name__ == '__main__': + print(__doc__) + main() + cv.destroyAllWindows() \ No newline at end of file