Hi,
I explain my problem, I have an image of MxN and I want ti create regions of lower dimensions. for example I want to divide the image into 4x2, so 8 regions I have the next code:
# Numbers of rows
nRows = 4
# Number of columns
mCols = 2
# Reading image
img = cv2.imread('XXXX')
print img
# Dimensions of the image
sizeX = img.shape[0]
sizeY = img.shape[1]
print sizeX,sizeY
# Tam of Y region
regionY=sizeY/nRows
# Tam of X region
regionX = sizeX/mCols
# Total of regions
totalRegions = nRows* mCols
name = str(totalRegions)
for v in range (0,totalRegions):
for i in range(0,mCols):
for j in range(0, nRows):
name = str(totalRegions)
globals()[name]=img[0+mCols*v:mCols+(mCols*v)-1,
0+nRows*(v/nRows):nRows+(nRows*(v/nRows))-1]
totalRegions += -1