title: Changing pixel color in for-loop
body: <pre><code>import cv
  import cv2
  import matplotlib.pyplot as plt
  import matplotlib.image as mpimg
  import numpy as np
  import Image
  cam = cv2.VideoCapture(0)
  s,img1 = cam.read()
  height, width, depth = img1.shape
  print height, width
  for i in range(0,height):
     for j in range(0,width):
        if (img1[i, j] &lt;= [25,25,25]).all():
          img1[i, j] = [255, 0, 128]
        elif ((img1[i, j] &gt; [25,25,25]).all() and (img1[i, j] &lt;= [50,50,50]).all()):
            img1[i,j] = [255, 255, 128]
        elif ((img1[i, j] &gt; [50,50,50]).all() and (img1[i, j] &lt;= [75,75,75]).all()):
            img1[i,j] = [255, 128, 0]
        elif ((img1[i, j] &gt; [75,75,75]).all() and (img1[i, j] &lt;= [100,100,100]).all()):
            img1[i,j] = [0, 255, 0]
        elif ((img1[i, j] &gt; [100,100,100]).all() and (img1[i, j] &lt;= [125,125,125]).all()):
            img1[i,j] = [68, 128, 251]      
        elif ((img1[i, j] &gt; [125,125,125]).all() and (img1[i, j] &lt;= [150,150,150]).all()):
            img1[i,j] = [0, 255, 255]
        elif ((img1[i, j] &gt; [150,150,150]).all() and (img1[i, j] &lt;= [175,175,175]).all()):
            img1[i,j] = [0, 0, 255]
        elif ((img1[i, j] &gt; [175,175,175]).all() and (img1[i, j] &lt;= [200,200,200]).all()):
            img1[i,j] = [128, 128, 128]
        elif ((img1[i, j] &gt; [200,200,200]).all() and (img1[i, j] &lt;= [225,225,225]).all()):
            img1[i,j] = [0, 0, 0]
        elif ((img1[i, j] &gt; [225,225,225]).all() and (img1[i, j] &lt;= [255,255,255]).all()):
            img1[i,j] = [255, 255, 255]
        else:
           img1[i,j] = [0, 60, 0]
        j=j+1
     i=i-1
  m=1
  while m&lt;2:
    cv2.imshow('pseudocolor',img1)
    cv2.waitKey(10)
  </code></pre>
  
  <p>while running this else statement works more 
  i.e. what should i do to give different color to pixel values such as [10, 50, 2],[23,3,167] etc
  there is some problem relating the assignment of pixel values.....
  not able to fetch some pixels,that is why the else statement works more number of times</p>