Exemplo n.º 1
0
    if args.square:
        if max_size == default_size:
            max_size = default_square_size
        else:
            if max_size > 100:
                print("Square mode, and size is {0}".format(max_size))
                print("Error : Square size is too big.")
                sys.exit(1)

    head, tail = os.path.split(input_path)
    dir_path = os.path.join(head, tail + "_dataset")

    ds = DSUtils()
    ds.files_copy(input_path, dir_path)
    ds.files_change_ext(dir_path, ".jpeg", ".jpg")
    ds.img_convert_ext(dir_path, ".jpg")
    ds.files_lower_ext(dir_path)
    ds.files_remove_notjpg(dir_path)

    if not args.keepsize and args.square:
        ds.img_square(dir_path, max_size)
    elif not args.keepsize:
        ds.img_resize(dir_path, max_size)

    if not args.nodup:
        rdd.images_remove_duplicated(dir_path, "")

    ds.files_numbering(dir_path, name_header)


Exemplo n.º 2
0
import os
import sys

# add module path
script_path = os.path.dirname(os.path.realpath(__file__))
module_path = os.path.join(script_path, "myutils")
sys.path.append(module_path)

# mymodules
import remove_dataset_duplicated as rdd


# main function
if __name__ == '__main__':
    argv = sys.argv
    argc = len(argv)

    if argc < 2:
        print("Error: The number of arguments must be one.")
        print("arg 1: The source directory contains images.")
        print("arg 2: The directory for comparison images. (option)")
        sys.exit(1)

    dir_path = os.path.normpath(argv[1])
    cmp_path = []
    if argc > 2:
        cmp_path = [os.path.normpath(x) for x in argv[2:]]

    rdd.images_remove_duplicated(dir_path, cmp_path)