# Revision history [back]

### Divide an image into lower regions

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

print img
# Dimensions of the image
sizeX = img.shape
sizeY = img.shape

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 2 retagged

### Divide an image into lower regions

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

print img
# Dimensions of the image
sizeX = img.shape
sizeY = img.shape

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