Beispiel #1
0
def track(frame, avg_frame):

    gray = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
    gray_copy = gray.copy()
    img_threshold, x, y = ta.diffaccWeight(gray_copy, gray, avg_frame)
    return img_threshold, x, y
Beispiel #2
0
		
		got_frame0, frame0 = myCamera0.getFrame()
		image0 = cv2.resize(frame0,None,fx=0.25, fy=0.25, interpolation = cv2.INTER_LINEAR)
		t0 = cv2.cvtColor(image0, cv2.COLOR_RGB2GRAY)
		
		got_frame1, frame1 = myCamera1.getFrame()
		image1 = cv2.resize(frame1,None,fx=0.25, fy=0.25, interpolation = cv2.INTER_LINEAR)
		t1 = cv2.cvtColor(image1, cv2.COLOR_RGB2GRAY)
		
		# t0 = cv2.cvtColor(frame0, cv2.COLOR_RGB2GRAY)
		# t1 = cv2.cvtColor(frame1, cv2.COLOR_RGB2GRAY)

		f0 = t0.copy()
		f1 = t1.copy()

		masked_img0, x0, y0 = ta.diffaccWeight(f0,t0, avg_daw0)
		masked_img1, x1, y1 = ta.diffaccWeight(f1,t1, avg_daw1)


		if((x0 != -1) | (y0 != -1)):
			measured0 = (x0,y0)
			prev_x0 = x0
			prev_y0 = y0
		else:
			measured0 = (prev_x0,prev_y0)

		if((x1 != -1) | (y1 != -1)):
			measured1 = (x1,y1)
			prev_x1 = x1
			prev_y1 = y1
		else:
Beispiel #3
0
myCamera0 = Camera.Camera(0, "cam0.avi")

got_frame, frame = myCamera0.getFrame()
t0 = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
avg_daw0 = np.float32(t0)


i = 0
start_time = time.time()
while True:
	
	got_frame, frame = myCamera0.getFrame()
	t0 = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
	f0 = t0.copy()
	masked_img0, x0, y0 = ta.diffaccWeight(f0,t0, avg_daw0)
	#if((x0 != -1) | (y0 != -1)):
	drawCross(masked_img0, (x0, y0), 0,   0,   255)
	cv2.imwrite('frame' + str(i) + ".jpg", masked_img0)

	cv2.imshow( "frame", masked_img0 )

	i+=1
	if (i == 30): 
		#finish_time = time.time()
		break
	key = cv2.waitKey(1)
	if key == 27:
		cv2.destroyWindow("0")
		myCamera0.off()
		break
Beispiel #4
0
def track(frame, avg_frame):
	
	gray = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
	gray_copy = gray.copy()
	img_threshold, x, y = ta.diffaccWeight(gray_copy,gray, avg_frame)
	return img_threshold, x, y