so in my current code I'm using
im_set=set(map(tuple, im_list[0]))
to convert a list into a set. However it's very slow. Is there a faster/ none map method to speed things up? This is my current code
while True:
cam = cv2.VideoCapture(0)
start=time.time()
while(cam.isOpened()): #Opens camera
ret, im = cam.read() #Takes screenshot
#im=cv2.imread('RGB.png')
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()
im_set=set(map(tuple, im_list[0]))
ColourCount= set(im_set) & set(om_set)
print len(ColourCount)
print N
end=time.time()-start
print end
Note that om_set is from a different program.
Anyway, basically I have to convert an np.array to a set, and compare that set to see what overlaps with them. But, its very slow. Is there a method I can use to speed up this conversion?