In [1]:
import pandas as pd
import numpy as np
import cv2
import tifffile as tif
import matplotlib.pyplot as plt

import os, gc, glob
import json 

from shapely import wkt

import utils
import global_vars

In [2]:
im_names = sorted(glob.glob(os.path.join(global_vars.DATA_DIR, 'sixteen_band','*M.tif')))

In [3]:
grids = [x.split('/')[-1].split('_')[0] for x in im_names] 
grids = sorted(list(set((grids))))

In [4]:
def load_grid(paths):
    for j in range(5):
        for i in range(5):
            if i == 0:
                im = tif.imread(paths[j*5+i]).transpose((1,2,0))[:,:,[4,2,1]]
            else:
                tmp_im = tif.imread(paths[j*5+i]).transpose((1,2,0))[:,:,[4,2,1]]
                im = np.concatenate((im, tmp_im), axis=1)
        if j == 0:
            final_im = im
        else:
            final_im = np.concatenate((final_im, im))
            
    return cv2.resize(final_im,(500,500), interpolation=2)

In [5]:
for j in range(6):
    for i in range(3):
        grid = grids[j*3+i]
        tmp = list(filter(lambda x: x.find(grid) != -1, im_names))
        if i == 0:
            big_im = utils.scl_prc(load_grid(tmp))
        else:
            tmp_grid = utils.scl_prc(load_grid(tmp))
            big_im = np.concatenate((big_im, tmp_grid), axis= 1)
    utils.shw(big_im, 7, 17)