from PIL import Image
from matplotlib import cm
from baseoption import BaseOptions
from m_util import sdmkdir, convertMbandstoRGB, sdsaveim

opt = BaseOptions().parse()
opt.padding = 1000
opt.root = '/gpfs/projects/LynchGroup/'
opt.raw_fold = opt.root + 'Train_all/raw/'
opt.tif_fold = opt.root + 'Orthoed/'
opt.training_fold = opt.root + 'Train_all/CROPPED/p1000/'
opt.A = opt.training_fold + 'A/'
opt.B = opt.training_fold + 'B/'

opt.visdir = opt.root + 'Train_all/CROPPED/p1000/vis/'
sdmkdir(opt.training_fold)
sdmkdir(opt.A)
sdmkdir(opt.B)
sdmkdir(opt.visdir)


def full_frame(width=None, height=None):
    matplotlib.rcParams['savefig.pad_inches'] = 0
    figsize = None if width is None else (width, height)
    fig = plt.figure(figsize=figsize)
    ax = plt.axes([0, 0, 1, 1], frameon=False)
    ax.get_xaxis().set_visible(False)
    ax.get_yaxis().set_visible(False)
    plt.autoscale(tight=True)
    return fig
from PIL import Image
from m_util import sdmkdir, convertMbandstoRGB, sdsaveim
import pandas as pd
from shutil import copyfile

parser = argparse.ArgumentParser(
    formatter_class=argparse.ArgumentDefaultsHelpFormatter)
opt = parser.parse_args()
padding = 300
opt.root = '/gpfs/projects/LynchGroup/'
opt.resdir = '/gpfs/projects/LynchGroup/Penguin_workstation/data/Penguins' + '/TEST_PTS_MASK_PADDING_' + str(
    padding) + '/'
opt.A = opt.resdir + 'A/'
opt.B = opt.resdir + 'B/'
opt.tif_fold = opt.root + 'Orthoed/'
sdmkdir(opt.resdir)
sdmkdir(opt.A)
sdmkdir(opt.B)
opt.shape_dir = opt.root + '/Annotated_shapefiles_PTS/'
files = []
for root, _, fnames in sorted(os.walk(opt.shape_dir)):
    for fname in fnames:
        if fname.endswith('tif'):
            files.append(fname)
for file1 in files:
    indx = file1.find('__')
    file2 = file1[indx + 2:]
    print(file2)
    match = re.search(r'\d{2}\D{3}\d{8}', file2).group(0)

    date = '20' + match[0:2] + "%02d" % (time.strptime(
Пример #3
0
shape_dir = '/gpfs/projects/LynchGroup/Annotated_shapefiles/'
opt.tif_fold = '/gpfs/projects/LynchGroup/Orthoed/'
files = ['PAUL_IDs_Test.xlsx','CROZ_IDs_Test.xlsx',
            'CatalogIDs_training_shapefiles.xlsx']
folds = ['Test/PAUL/','Test/CROZ/','Train_all/']
for id in range(0,3):
    file = opt.root+files[id]
    opt.fold =  folds[id]

    opt.training_fold = opt.root + opt.fold+ '/padding_'+str(opt.padding)+'/'
    opt.A = opt.training_fold + 'A/'
    opt.B = opt.training_fold + 'B/'

    opt.ctifdir = opt.root + opt.fold+ '/padding_' +str(opt.padding)+ '/tif/'

    sdmkdir(opt.training_fold)
    sdmkdir(opt.A)
    sdmkdir(opt.B)
    sdmkdir(opt.ctifdir)

    #shape_dir= '/gpfs/projects/LynchGroup/Colony\ shapefiles\ from\ imagery/'

    anno = pd.read_excel(file,sheet_name=0)
    tif = anno['Filename']
    shape =  anno['Shapefile of guano']
    for i in range(0,len(tif)):
        name= tif[i].encode('ascii','ignore')
        name = name.decode()
        if "-M" in name:
            gta= shape[i].encode('ascii','ignore')
            gta = gta.decode()