title: Why aren't my sets containing more than one element?- python 2.7
body: <p>Ok, so I wrote some code and I want to compare two sets. However, the length will only return either 0 or 1, depending on whether I'm using two images or the same image. This is because my sets are being formed as only 1 element sets instead of mixing the numbers apart. For example, the sets read as [(a, b, c)] instead of [('a', 'b', 'c')].</p>
  
  <p>Here's my code</p>
  
  <pre><code>import cv2
  import numpy as np
  import time
  N=0
  colour=[]
  colourfile=open('Green from RGB.txt', 'r')
  for line in colourfile.readlines():
      colour.append([line])
  colour_set=sorted(set(map(tuple, colour)))
  
  
  
  def OneNumber(im): #Converts the pixels rgb to a single number.
      temp_im=im.astype('int32')
      r,g,b = temp_im[:,:,0], temp_im[:,:,1], temp_im[:,:,2]
      combo=r*1000000+g*1000+b
      return combo
  
  
  
  while True:
      cam = cv2.VideoCapture(0)
      start=time.time()
      while(cam.isOpened()):                  #Opens camera
          ret, im = cam.read()                #Takes screenshot
          #im=cv2.imread('filename.type')
          im=cv2.resize(im,(325,240))         #Resize to make it faster
          im= im.reshape(1,-1,3)
          im=OneNumber(im)               #Converts the pixels rgb to a singe number
          im_list=im.tolist()                 #Makes it into a list
          im_set=set(im_list[0])              #Makes set
          ColourCount= set(colour_set) &amp; set(colour_set) #or set(im_set) for using/ comparing camera
          print len(ColourCount)
  </code></pre>
  
  <p>Also the text file I'm opening is written as:</p>
  
  <pre><code>126255104, 8192000, 249255254, 131078, 84181000, 213254156,
  </code></pre>
  
  <p>In a single, great big line.</p>
  
  <p>So basically, how do I divide the numbers into different elements in the sets, im_set and colour_set?</p>
  
  <p>Thanks</p>