title: how to create an interlaced rows images with python and openCv
body: <p>I have two images with the same size. I would like to create a new interlaced image where the odd rows belong to one image and the even rows to the other image.
  Like a 3d image.
  I am trying to do that with python and openCv and numpy!
  Reading the two images and with a loop i try to write the values in the odd and even rows. </p>
  
  <p>I don't know if this is the best way to do that. Do you have some tips?</p>
  
  <p>Here the code:</p>
  
  <pre><code>import numpy as np
  import cv2
  
  def main():
      print 'loading images...'
      imgL= cv2.imread('sx2.jpg')
      imgR= cv2.imread('dx2.jpg')
      h, w = imgL.shape[:2]
      print h, w
      cv2.imshow(interlace(imgL, imgR, h, w))
      cv2.waitKey()
      cv2.destroyAllWindows()
  
  
  def interlace(imgL, imgR, h, w):
      inter= np.empty((h, w, 3),int)
      for z in range (0,3):
          for i in range(h-1):
              for j in range(w-1):
                  if j % 2 == 0:
                      inter[i][j][z]= imgL[i][j][z]
                  else:
                      inter[i][j][z]= imgR[i][j][z]
  
  
      b=np.float32(inter) / 255.0
      return b
  
  
  if __name__ == "__main__":
      main()
  </code></pre>