title: My erode() function doesn't produce same output as openCV's erode function
body: <p>So i've used a border for the pixels that are 'outside' the image so the kernel can use the border's pixels to get a minimum. 
  I've no idea why my function would produce a different output to that of the inbuilt function - I've inspected both outputs carefully (writing to an image and zooming in) and looking very carefully I can't notice a difference in pixels! </p>
  
  <p>import cv2
      import numpy as np</p>
  
  <pre><code>img = cv2.imread('lena.png',cv2.IMREAD_GRAYSCALE)
  
  reflect = cv2.copyMakeBorder(img,3,3,3,3,cv2.BORDER_REFLECT)
  
  cv2.imshow('img', reflect)
  cv2.waitKey(0)
  
  imgEroded = np.zeros((512+6,512+6,3), np.uint8)
  
  for i in range(0,reflect.shape[0]):
      for j in range(0,reflect.shape[1]):
          n = np.matrix(reflect[i-3:i+2, j-3:j+2])
          if n.size &gt; 0:  
              imgEroded[i][j] = n.min()
  
  imgEroded = imgEroded[3:512+3, 3:512+3]
  
  kernel = np.ones((5,5),np.uint8)
  erode = cv2.erode(img,kernel)
  # print  erode.shape[:2]
  cv2.imshow('erosionCorrect',erode)
  cv2.imshow('erosion',imgEroded)
  
  cv2.imwrite('myOutput.png',imgEroded)
  cv2.imwrite('correct.png',erode)
  
  
  print(np.array_equal(erode, imgEroded))
  
  # cv2.imshow('real',erode)
  cv2.waitKey(0)
  </code></pre>