コード例 #1
0
def get_image(source_image_path, sub_cdim, source_cdim):
    sys.path.append('../../DeepMoon/')
    import input_data_gen as igen
    # Read source image and crater catalogs.
    assert os.path.exists(source_image_path)
    img = Image.open(source_image_path).convert("L")

    # Sample subset of image.  Co-opt igen.ResampleCraters to remove all
    # craters beyond cdim (either sub or source).
    if sub_cdim != source_cdim:
        img = igen.InitialImageCut(img, source_cdim, sub_cdim)
    return img
コード例 #2
0
        comm = MPI.COMM_WORLD
        rank = comm.Get_rank()
        size = comm.Get_size()
        print("Thread {0} of {1}".format(rank, size))
        istart = rank * amt
    else:
        istart = 0

    # Read source image and crater catalogs.
    img = Image.open(source_image_path).convert("L")
    craters = igen.ReadLROCHeadCombinedCraterCSV(filehead=head_csv_path)

    # Sample subset of image.  Co-opt igen.ResampleCraters to remove all
    # craters beyond cdim (either sub or source).
    if sub_cdim != source_cdim:
        img = igen.InitialImageCut(img, source_cdim, sub_cdim)
    # This always works, since sub_cdim < source_cdim.
    craters = igen.ResampleCraters(craters, sub_cdim, None, arad=R_km)

    # Generate input images.
    igen.GenDataset(img,
                    craters,
                    outhead,
                    rawlen_range=rawlen_range,
                    rawlen_dist=rawlen_dist,
                    ilen=ilen,
                    cdim=sub_cdim,
                    arad=R_km,
                    minpix=minpix,
                    tglen=tglen,
                    binary=True,
コード例 #3
0
 def test_initialimagecrop(self, newcdim, newpixdim):
     cropped_img = igen.InitialImageCut(self.img, self.cdim, newcdim)
     assert cropped_img.size == newpixdim