#!/usr/bin/env python

import scipy
import pickle
import sys
from subprocess import call

input = 'out.yuv'
output = 'out.dat'

#generate yuv file from .h264 file
call(['avconv','-i','raspicam' + str(sys.argv[1]) + '.h264',
      '-vcodec','rawvideo',
      '-pix_fmt','yuvj420p',
      input]) 

#open tree and find frame rate and acquisition time (hardcoded to start)
res = (640,480)
time = 3
framerate = 90
points = res[0]*res[1]


#extract luma values for storage in tree
file = open(input,'rb')
pfile = open(output,'wb')

for i in xrange(time*framerate): #do analysis in chunks
    pfile.write(file.read(points))
    file.read(points/2)
pfile.close()
#delete unnecessary data

#the raspi memory is too small to efficiently handle the data.
#its going to have to pass it off on another machine.
print('brightness extraction complete')
call(['rm','out.yuv'])

82b3a9d014d0fa627700333119da11c0cbc677c2
<mask token>

<mask token>
call(['avconv', '-i', 'raspicam' + str(sys.argv[1]) + '.h264', '-vcodec',
    'rawvideo', '-pix_fmt', 'yuvj420p', input])
<mask token>
for i in xrange(time * framerate):
    pfile.write(file.read(points))
    file.read(points / 2)
pfile.close()
print('brightness extraction complete')
call(['rm', 'out.yuv'])

<mask token>
input = 'out.yuv'
output = 'out.dat'
call(['avconv', '-i', 'raspicam' + str(sys.argv[1]) + '.h264', '-vcodec',
    'rawvideo', '-pix_fmt', 'yuvj420p', input])
res = 640, 480
time = 3
framerate = 90
points = res[0] * res[1]
file = open(input, 'rb')
pfile = open(output, 'wb')
for i in xrange(time * framerate):
    pfile.write(file.read(points))
    file.read(points / 2)
pfile.close()
print('brightness extraction complete')
call(['rm', 'out.yuv'])

import scipy
import pickle
import sys
from subprocess import call
input = 'out.yuv'
output = 'out.dat'
call(['avconv', '-i', 'raspicam' + str(sys.argv[1]) + '.h264', '-vcodec',
    'rawvideo', '-pix_fmt', 'yuvj420p', input])
res = 640, 480
time = 3
framerate = 90
points = res[0] * res[1]
file = open(input, 'rb')
pfile = open(output, 'wb')
for i in xrange(time * framerate):
    pfile.write(file.read(points))
    file.read(points / 2)
pfile.close()
print('brightness extraction complete')
call(['rm', 'out.yuv'])

#!/usr/bin/env python

import scipy
import pickle
import sys
from subprocess import call

input = 'out.yuv'
output = 'out.dat'

#generate yuv file from .h264 file
call(['avconv','-i','raspicam' + str(sys.argv[1]) + '.h264',
      '-vcodec','rawvideo',
      '-pix_fmt','yuvj420p',
      input]) 

#open tree and find frame rate and acquisition time (hardcoded to start)
res = (640,480)
time = 3
framerate = 90
points = res[0]*res[1]


#extract luma values for storage in tree
file = open(input,'rb')
pfile = open(output,'wb')

for i in xrange(time*framerate): #do analysis in chunks
    pfile.write(file.read(points))
    file.read(points/2)
pfile.close()
#delete unnecessary data

#the raspi memory is too small to efficiently handle the data.
#its going to have to pass it off on another machine.
print('brightness extraction complete')
call(['rm','out.yuv'])
