Skip to content

Instantly share code, notes, and snippets.

@netbrain
Last active January 27, 2020 06:09
Show Gist options
  • Save netbrain/eca4bb501a0a4764833c705d6ebf0014 to your computer and use it in GitHub Desktop.
Save netbrain/eca4bb501a0a4764833c705d6ebf0014 to your computer and use it in GitHub Desktop.
various image oprations
//dump jpeg
curl "http://10.41.3.120/cgi-bin/faststream.jpg?stream=MxPEG&fps=0.1" | mxgconv_linux format=jpeg,of=img
//split images
find ./ | grep jpg |xargs -I@ convert -quality 100 -crop 640x480 @ @_cropped_%d.jpg
//preserve original filename in images
ls | xargs -I@ echo exiftool -Comment=@ @
//rename file to md5sum name
ls | grep jpg$ | xargs -I@ sh -c "mv @ \$(sh -c \"md5sum @ | cut -f 1 -d ' '\").jpg"
//create empty labels
ls | cut -f 1 -d . | xargs -I @ echo @.txt | xargs touch
//create labels for images using yolo
find /path/to/images | grep jpg | ./darknet detector test darknet.data darknet-yolov3.cfg yolov3_best.weights -dont_show -save_labels
//extract frames from video files
find ./ -maxdepth 1 | xargs -I@ ffmpeg -i @ "@-%05d.png"
//combine frames into video filer
ffmpeg -i "10.0.29.108.mjpg-%05d.jpg" -c:v libx264 -vf "fps=15" 10.0.29.108.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment