Exemple #1
0
    def main(self):
        jc = JpegStreamCamera(
            "http://192.168.1.101/videostream.cgi?user=pi&pwd=pi")
        vs = VideoStream("MyVideo2.avi", 25, True)
        for i in range(0, 35):
            print "loop"
            img = jc.getImage()
            print "gotimg"
            imgName = "img/img_%s.jpg" % (i)
            self.makeSaveImg = Process(target=self.saveImgToDisk,
                                       args=(img, imgName))
            self.makeSaveImg.start()
            #self.saveImgToDisk(img,imgName)
            vs.writeFrame(img)
            print i
            print "----------"

        #self.makefilmProcess = Process(target=self.saveFilmToDisk, args=("MyVideo2.avi", "MyoutputFile.mpeg"))
        #self.makefilmProcess.start()

        params = " -i {0} -c:v mpeg4 -b:v 700k -r 24 {1}".format(
            "MyVideo2.avi", "MyoutputFile.avi")

        # run avconv to compress the video since ffmpeg is deprecated (going to be).
        call('avconv' + params, shell=True)
Exemple #2
0
    def recordVideo(self, length=5):
        BUFFER_NAME = 'buffer.avi'
        vs = VideoStream(fps=24, filename=BUFFER_NAME, framefill=True)
        self.disp = Display((self.width, self.height))
        cam = Camera(prop_set={"width":self.width,"height":self.height})

        while self.continueRecord:
            gen = (i for i in range(0, 30 * length) if self.continueRecord)
            for i in gen:
                img = cam.getImage()
                vs.writeFrame(img)
                img.save(self.disp)
            self.continueRecord = False
        print "Broke capture loop"
        self.disp.quit()

        print "Saving video"
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)
Exemple #4
0
The first time you run the script you will need to authorize
googlecl to use your account. 

ffmpeg can be found here http://www.ffmpeg.org/
see the ffmpeg website for installation instructions


"""
fname = 'test.avi'
outname = 'output.mp4'
tags = 'SimpleCV, Computer Vision, Python'
title = "SimpleCV Output"
summary = "See http://simplecv.org for more info."
access = "public"  # Options are "public" "private" "protected"
# create the video stream for saving the video file
vs = VideoStream(fps=20, filename=fname, framefill=False)
# grab the camera
cam = Camera()
# create a display
disp = Display((800, 600))
# while the user does not press 'esc'
while disp.isNotDone():
    # YOUR CODE GOES HERE!
    img = cam.getImage()
    img = img.edges()
    # write the frame
    vs.writeFrame(img)
    # save the image to the display
    img.save(disp)
# construct the encoding arguments
params = " -i {0} {1}".format(fname, outname)