import cv2
import os
import numpy as np
img = cv2.imread('E:\Temp\H51G004017_1.tif_1.tif', flags=-1)
def sliding(image, step_size, windows_size):
for y in range(0,image.shape[0],step_size):
for x in range(0,image.shape[1],step_size):
yield(x,y,image[y:y+windows_size,x:x+windows_size])
img1 = sliding(img, 128,128)
im = next(img1)
im2 = im[2]
print(im2.shape)
来源:CSDN
作者:sddpltwanqiu
链接:https://blog.csdn.net/sddpltwanqiu/article/details/103742708