Пример #1
0
def vis_mark(input_file, output_file, divisions, size=(1024, 1024)):
    """read  srtm file, mark subdivisions and write as jpeg"""
    # read the image
    a = srtm.read(input_file)
    # mark the image with subdivisions
    b = srtm.mark(a, divisions)
    # write it as small image to
    srtm.toimage(b, output_file, size)
Пример #2
0
def vis_stat(input_file):
    """ output statistics about the image data """
    # read the image
    a = srtm.read(input_file)

    # compute mean and standard deviation
    print(input_file +
          " : std: {0:.2f} mean: {1:.2f} meters".format(np.std(a), np.mean(a)))

    pass
Пример #3
0
def vis_subdivide(input_file, output_path, divisions, size=(96, 96)):
    # read the image
    a = srtm.read(input_file)
    # subdivide the image
    s = srtm.subdivide(a, divisions)

    i = 0
    for m in s:
        fname = output_path + "/a" + str(i) + ".jpg"
        srtm.toimage(m, fname, size)
        i += 1

    return s
Пример #4
0
def vis_datagen(input_file, output_path, divisions, size=(96, 96)):
    # read the image
    a = srtm.read(input_file)
    # subdivide the image
    s = srtm.subdivide(a, divisions)
    # pick one image
    m = s[0]
    # get 4 modified images
    r = srtm.datagen(m,
                     4,
                     rotation_range=45,
                     height_shift_range=0.1,
                     width_shift_range=0.1)
    i = 1
    for t in r:
        a = srtm.tensor_to_array(t)
        fname = output_path + "/g" + str(i) + ".jpg"
        srtm.toimage(a, fname, size)
        i += 1
Пример #5
0
        # convert strings to numbers in config object
        jcfg["divisor"] = divisor
        jcfg["augments"] = augments
        jcfg["epochs"] = epochs

    except Exception as ex:
        print("Error in JSON file : " + str(type(ex)))
        print(ex)
        sys.exit(1)

    # add timestamp to config object
    jcfg["timestamp"] = timestamp

    # read the input file
    m = srtm.read(datafile)
    print("input shape      : {0}".format(m.shape))

    # subdivide into NxN images
    s = srtm.subdivide(m, divisor)
    print("subdivided shape : {0}".format(s.shape))

    # normalize to increase contrast per image
    n = [srtm.normalize(x, 255) for x in s]
    n = np.array(n)
    print("normalized shape : {0}".format(n.shape))

    # =========================================
    # save the base images
    # =========================================
    # srtm.save_images(n,"images/model3/base", (75, 75))
Пример #6
0
def vis_load(input_file, output_file, size=(1024, 1024)):
    """read srtm file and write as jpeg"""
    # read the image
    a = srtm.read(input_file)
    # write it
    srtm.toimage(a, output_file, size)