Ejemplo n.º 1
0
def readThread(threadName,read_Flag):
	global flag,handle
	count = 0
	time0 = time.time()
	time1 = time.time()
	data = {}
	cv2.namedWindow("AR0134",1)
	cv2.setMouseCallback("AR0134",mouse_callback)
	while flag:
		if ArducamSDK.Py_ArduCam_availiable(handle) > 0:
			
			res,data = ArducamSDK.Py_ArduCam_read(handle,Width * Height)
			if res == 0:
				count += 1
				time1 = time.time()
				ArducamSDK.Py_ArduCam_del(handle)
			else:
				print "read data fail!"
			
		else:
			print "is not availiable"
		if len(data) >= Width * Height:
			if time1 - time0 >= 1:
				print "%s %d %s\n"%("fps:",count,"/s")
				count = 0
				time0 = time1
			show(data)
		else:
			print "data length is not enough!"
		if flag == False:		
			break
def readThread(threadName, read_Flag):
    global flag, handle
    data = {}
    cv2.namedWindow("MT9F002", 1)
    while flag:
        if ArducamSDK.Py_ArduCam_availiable(handle) > 0:

            res, data = ArducamSDK.Py_ArduCam_read(handle, Width * Height)
            if res == 0:
                ArducamSDK.Py_ArduCam_del(handle)
            else:
                print "read data fail!"

        else:
            print "is not availiable"
        if len(data) >= Width * Height:
            show(data)
            flag = False
        else:
            print "data length is not enough!"
        if flag == False:
            break