リモートセンシング映像の切り取り--データセットの作成

803 ワード

import os
from PIL import Image
import cv2
import time

file_dir = '.'
files = os.listdir(file_dir)

na = 0
for file in files:


    if os.path.isfile(file):
        # img = Image.open(file)
        img = cv2.imread(file)
        long = img.shape[0]
        width = img.shape[1]
        upper = 0
        lower = 0
        kj = 0

        while lower + 16 < width:

            left = 0
            upper = (16*kj)
            right = 16
            lower = 16*(kj+1)
            kj +=1
            print(left, upper, right, lower)
            ki = 0

            while right + 16