title: image tiling in loops using Python OpenCV
body: <p>Python noob needs some help guys! Can someone show me how to rewrite my code using loops? Tried some different syntaxes but did not seem to work!</p>
  
  <pre><code>img = cv2.imread("C://Users//user//Desktop//research//images//Underwater_Caustics//set1//set1_color_0001.png")
  
      tile11=img[1:640, 1:360]
      cv2.imwrite('tile11_underwater_caustic_set1_0001.png', tile11)
  
      tile12=img[641:1280, 1:360]
      cv2.imwrite('tile12_underwater_caustic_set1_0001.png', tile12)
  
      tile13=img[1281:1920, 1:360]
      cv2.imwrite('tile13_underwater_caustic_set1_0001.png', tile13)
  
      tile21=img[1:640, 361:720]
      cv2.imwrite('tile21_underwater_caustic_set1_0001.png', tile21)
  
      tile22=img[641:1280, 361:720]
      cv2.imwrite('tile22_underwater_caustic_set1_0001.png', tile22)
  
      tile23=img[1281:1920, 361:720]
      cv2.imwrite('tile23_underwater_caustic_set1_0001.png', tile23)
  
      tile31=img[1:640, 721:1080]
      cv2.imwrite('tile31_underwater_caustic_set1_0001.png', tile31)
  
      tile32=img[641:1280, 721:1080]
      cv2.imwrite('tile32_underwater_caustic_set1_0001.png', tile32)
  
      tile33=img[1281:1920, 721:1080]
      cv2.imwrite('tile33_underwater_caustic_set1_0001.png', tile33)
  </code></pre>
  
  <p>As you can see, the image will be cut into 9 equal-size pieces, how to write it using loops?</p>