0 Replies Latest reply on May 24, 2015 1:23 AM by rgb

    Time Lapse Photography on AlexT's Yocto on Galileo 1

    rgb

      Hi All

      I have been playing around a bit more with using a webcam and have set up a Galileo to take pictures and stitch them together into a video

      I am using a Galileo Gen 1, running AlexT's version of Yocto and have a cheap UVC webcam

      Steps

      Connect webcam

      Install fswebcam program

      Install memcoder or other program to convert images to video (either on Galileo or your laptop)

      Capture the images

      Run a program to convert the images to a video


      Install Webcam

      Any UVC should do. Just connect it to the USB Host (for Galileo 1 need a micro to standard USB cable)

      Run modprobe uvcvideo

      Check /dev for video0 devices.

       

      Install fswebcam

      opkg update

      opkg install fswebcam


      Install memcoder on Galileo (or laptop) or install similar to other OS machines (memcoder is part of mplayer program)

      Download from:

      http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.1.1.tar.xz

      Uncompress and copy directory to:

      /media/realroot/GalileoPrograms

      (note: when I tried to use git, I got a security error, and when tired to uncompress, got bad magic number, so just downloaded and uncompressed on laptop)

      Compile with

      ./configure --yasm=''”

      make   (this takes several hours)

      make install


        Create program to capture images (I created a directory /media/realroot/timelapse to store images so don't fill up virtual disk space)

      """ TimeLapse

      Vietnamese-German University

      Takes a picture every 10 seconds and saves to a file with a timestamp in the name

      based on a Python script by @AlexCorvis84

      https://geekytheory.com/timelapse-24-horas-con-raspberry-pi-webcam-usb/

      Connections: UVC webcam to usb host

      """

      import os

      import time

      import sys

      os.popen("modprobe uvcvideo")

      start = 0

      end = 8640 # 60 sec * 60 minutes * 24 hours/10 sec

      print "Starting the Script with duration of 24 hours"

      while start < end:

        print "Capture image"

      # Note the skip 2 is because I have a low quality webcam that initially makes corrupted images

      os.popen("fswebcam -d /dev/video0 -r 640x400 -f 4 --no-banner --skip 2 /media/realroot/timelapse/test_%d%m%y_%H%M%S.jpg")

        start = start+1

        time.sleep(10)

       

      print "TIMELAPSE Process is finished. Now turn the pictures into a video"

      sys.exit()


       

      Create a shell script to make a video (could be included in above)

      nano MakeVideo.sh

      ls *.jpg >stills.txt

      mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o timelapse.avi -mf type=jpeg:fps=24 mf://@stills.txt

      chmod +x MakeVideo.sh

      Run TimeLapse.py and when finished, run MakeVideo.sh

      Enjoy

      rgb     AlexT_Intel