from SimpleCV import ColorSegmentation, Image, Camera, VirtualCamera, Display, Color # Open reference video cam = VirtualCamera( '../../Recording/Videos/kiteFlying from Zenith Wind Power-jn9RrUCiWKM.mp4', 'video') # Select reference image img = cam.getFrame(50) modelImage = img.crop(255, 180, 70, 20) modelImage = Image('../kite_detail.jpg') ts = [] disp = Display() for i in range(0, 50): img = cam.getImage() while (disp.isNotDone()): img = cam.getImage() bb = (255, 180, 70, 20) ts = img.track("camshift", ts, modelImage, bb, num_frames=1) modelImage = Image('../kite_detail.jpg') # now here in first loop iteration since ts is empty, # img0 and bb will be considered. # New tracking object will be created and added in ts (TrackSet) # After first iteration, ts is not empty and hence the previous # image frames and bounding box will be taken from ts and img0 # and bb will be ignored. ts.draw() ts.drawBB() ts.showCoordinates() img.show()
from SimpleCV import JpegStreamer, Display, VirtualCamera, VideoStream import time import numpy as np cam = VirtualCamera( '../Recording/Videos/Flying kite images (for kite steering unit development)-YTMgX1bvrTo.flv', 'video') port = 8000 + np.random.randint(100) print port js = JpegStreamer(hostandport=port, st=0.1) vs = VideoStream("out.avi", fps=15) endReached = False t0 = time.time() FPS = 25 while not (endReached): t = time.time() - t0 toDisplay = cam.getFrame(np.ceil(t * FPS)) if toDisplay.size() != (0, 0): toDisplay.save(js) else: endReached = True time.sleep(0.05)
from SimpleCV import ColorSegmentation, Image, Camera, VirtualCamera, Display, Color # Open reference video cam=VirtualCamera('/media/bat/DATA/Baptiste/Nautilab/kite_project/zenith-wind-power-read-only/KiteControl-Qt/videos/kiteFlying.avi','video') # Select reference image img=cam.getFrame(50) modelImage = img.crop(255, 180, 70, 20) modelImage = Image('kite_detail.jpg') ts = [] disp=Display() for i in range(0,50): img = cam.getImage() while (disp.isNotDone()): img = cam.getImage() bb = (255, 180, 70, 20) ts = img.track("camshift",ts,modelImage,bb, num_frames = 1) modelImage = Image('kite_detail.jpg') # now here in first loop iteration since ts is empty, # img0 and bb will be considered. # New tracking object will be created and added in ts (TrackSet) # After first iteration, ts is not empty and hence the previous # image frames and bounding box will be taken from ts and img0 # and bb will be ignored. ts.draw() ts.drawBB() ts.showCoordinates() img.show()
from SimpleCV import JpegStreamer, Display, VirtualCamera, VideoStream import time import numpy as np cam = VirtualCamera('../Recording/Videos/Flying kite images (for kite steering unit development)-YTMgX1bvrTo.flv','video') port = 8000+np.random.randint(100) print port js = JpegStreamer(hostandport=port , st=0.1) vs = VideoStream("out.avi", fps=15) endReached = False t0 = time.time() FPS = 25 while not(endReached): t = time.time()-t0 toDisplay = cam.getFrame(np.ceil(t*FPS)) if toDisplay.size()!=(0,0): toDisplay.save(js) else: endReached = True time.sleep(0.05)