Extending the hand tracker with snakes and optimizations [w/ code, OpenCV]

I wish to report of a number of tweaks and additions to the hand silhouette tracker I posted a while back. First is the ability for it to "snap" to the object using a simple Active Snake method, another is a more advanced resampling technique (the older tracker always resampled after every frame), and of a number of optimizations to increase the speed (tracker now runs at real-time on a single core).
Continue reading "Extending the hand tracker with snakes and optimizations [w/ code, OpenCV]"

Share

FFMPEG video writer - now with animated GIF support [w/ code]

rect3825So animated gifs are awesome if you're writing a software blog. It saves all this time working with YouTube embeddings and stuff, and your "videos" are stored locally. The simplified FFMPEG writer was before unable to output animated GIFs, but I've tweaked it and now it does. It's also a nice piece of code to learn how to FFMPEG in C.
Continue reading "FFMPEG video writer - now with animated GIF support [w/ code]"

Share

Tailing the output of multiple files in Linux

This is a quick post to show a trick to tail multiple files, while showing the filename in the beginning of the line

What I needed was a way to grep multiple logs for an exception. But doing "tail -f *.log | grep exception" only let me see the exception, but I didn't know which log file to look in

I have found this guide, and altered the script and added

  1. Printing the file name in the beginning of each line
  2. Padding spaces after the file name (you can alter the minimal length in the ALIGN variable

Anyway - here's the script. Hope you find it useful

#!/bin/bash
 
# When this exits, exit all back ground process also.
trap 'kill $(jobs -p)' EXIT
 
ALIGN=31
 
# iterate through the each given file names,
for file in "$@"
do
        LENGTH=<code>echo ${file} | wc -c</code>
        PADDING=<code>expr ${ALIGN} - ${LENGTH}</code>
        PAD=<code>perl -e &quot;print ' ' x $PADDING;&quot;</code>
 
        # show tails of each in background.
        tail -f $file | sed &quot;s/^/${file}${PAD}:/g&quot;  &amp;
done
 
# wait .. until CTRL+C
wait
Share