def read(self):
		# return the frame most recently read
		return self.frame

	def stop(self):
		# indicate that the thread should be stopped
		self.stopped = True

vs = WebcamVideoStream(src=0).start()

start = time.clock()
while (True) & (l <= 500):
	frame = vs.read()
	#frame1 = frame.copy()
	output = squarelut8(output,480,640,10,frame[output[4]:output[5],:,:])
	#if output[0] <= output[1]:
		#cv2.rectangle(frame1,(output[0],output[2]),(output[1],output[3]),(255,0,0),2)
		#a = np.asarray(output,dtype=np.int32)[0:4]
		#print len(a.dumps())
		


		#if cv2.waitKey(1) & 0xFF == ord('c'):
			#xcropmin = int(output[2] - (0.2*(output[2] - 0)))
			#xcropmax = int(output[3] + (0.2*(480 - output[3])))
			#ycropmin = int(output[0] - (0.2*(output[0] - 0)))
			#ycropmax = int(output[1] + (0.2*(640 - output[1])))
			#stringvaln = '/home/pi/ip/report/LED/notdetLED' + str(capture) + '.png'
			#stringvald = '/home/pi/ip/report/LED/detLED' + str(capture) + '.png' 
			#cv2.imwrite(stringvaln, frame[xcropmin:xcropmax,ycropmin:ycropmax,:])
import numpy as np
import cv2
import time
from LUTptralltest import squarelut8
from LUTptralltest import cleanupf
iterations = 1

img = cv2.imread('/home/pi/ip/report/readimg1.bmp')
output = np.array([0,640,0,480,0,480])

start = time.clock()
while iterations <= 300:
	output = squarelut8(output,480,640,10,img[output[4]:output[5],:,:])
	iterations += 1
timetaken = time.clock() - start

print '*' * 80
print 'Number of frames: 300'
print 'Time taken: %.4f seconds'%(timetaken)
print 'Number of frames processed per second: %.2f frames'%(300/timetaken)
print '*' * 80
cleanupf()