Skip to content

Instantly share code, notes, and snippets.

@edwardrf
Created August 20, 2016 09:16
Show Gist options
  • Save edwardrf/8d2250ea538825d50f9c918a62d12c40 to your computer and use it in GitHub Desktop.
Save edwardrf/8d2250ea538825d50f9c918a62d12c40 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Start capture
N=40
SKIPF=15
SKIPE=15
echo $N $(($N-$SKIPF))
mplayer tv:// -tv driver=v4l2:device=/dev/video1:width=1920:height=1080 -frames $N -vo jpeg:outdir=1 &
mplayer tv:// -tv driver=v4l2:device=/dev/video2:width=1920:height=1080 -frames $N -vo jpeg:outdir=2 &
wait
# Remove the beginning and end files, then rename all the files
cd 1
for i in $(seq -w 00000001 $SKIPF); do rm "$i.jpg"; done
for i in $(seq -w $(($N-$SKIPE+1)) 000000$N); do rm "$i.jpg"; done
for f in *.jpg; do mv "$f" "${f:0:8}l.jpg"; done
cd ../2
for i in $(seq -w 00000001 $SKIPF); do rm "$i.jpg"; done
for i in $(seq -w $(($N-$SKIPE+1)) 000000$N); do rm "$i.jpg"; done
for f in *.jpg; do mv "$f" "${f:0:8}r.jpg"; done
cd ..
# Rotate images
mkdir output
mogrify -path output/ -rotate 90 1/*.jpg 2/*.jpg
rm 1 2 -rf
# Upload using post
#cd output
forms=''
for i in output/*.jpg; do forms="${forms} -F \"name=${i:7:8}\" -F \"filename=@${i}\""; done
echo curl -F "userid=A0001" $forms http://www.rogerdev.cn/api/uploadimages.aspx
#curl -F "userid=A0001" $forms http://www.rogerdev.cn/api/uploadimages.aspx
#curl -F "userid=A0001" ${forms} http://localhost:9080/
#echo curl -F "userid=a0001" $forms http://localhost:9080/
#curl -F "userid=a0001" $forms http://www.rogerdev.cn/api/uploadimages.aspx
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment