title: Iterations through pixels in an image are terribly slow with python (OpenCV)
body: <p>I am aware of iterating through pixels and accessing their values using OpenCV with C++. Now, <strong>i am trying to learn python</strong> myself and i tried to do the same thing in python. But when i am running the following code, it takes a lot of time (~7-10 seconds)  to display the image. And the script keeps running on for few more seconds even after displaying the image.</p>
  
  <p>I found a similar question <a href="https://stackoverflow.com/questions/3542968/opencv-python-binds-incredibly-slow-iterations-through-image-data"><strong>here at SO</strong></a> but i am not able to understand how do i use numpy in my case (because i am a beginner in python) and whether or not it is really required?</p>
  
  <p><strong>Code Explanation:</strong> I am just trying to put the black pixels on the left and right side of the image.</p>
  
  <pre><code>import numpy as np
  import cv2 as cv
  
  #reading an image
  img = cv.imread('image.jpg')
  height, width, depth = img.shape
  
  for i in range(0, height):
      for j in range(0, (width/4)):
          img[i,j] = [0,0,0]  
  
  for i in range(0, height):
      for j in range(3*(width/4), width):
          img[i,j] = [0,0,0]        
  
  cv.imshow('image',img)
  
  cv.waitKey(0)
  </code></pre>