Amikoo
  • Introduction
  • Norman
    • Architecture
    • Hardware
      • Embedded Platforms
        • Edison
          • SetUp
          • Git Repositories
        • UpBoard
          • SetUp
          • Git Repositories
          • Voice
      • Robot Wiring
    • Software
      • Programming Languajes
      • Broker
      • Google Account setup
      • Applications
        • Upboard
          • Camera
          • Vision
          • Translate
          • Tradition
          • IA Assistant
            • Alexa Linux
            • Google Assistant Linux
          • Node
    • StartupService
      • Edison
      • Upboard
  • VisitOpinions
    • SetUp
      • Linux Web Server Set Up
    • Application
      • Drawing
      • Survey
Powered by GitBook
On this page

Was this helpful?

  1. Norman
  2. Software
  3. Applications
  4. Upboard

Camera

This application allows the robot to use his camera and take a photo and save it to a specific directory. This app is the base for the next application that allow that google api, tell us what is it.

  • First we need to import the libraries that we are going to use.

import os
import datetime
import shutil
import time
  • Explaining the code.

    • First we kill every instants of eog, this allow us to don't have any demon running.

    • Then we extract the date, so we could make a unique id for each photo.

    • We use os.system("") to give it instruction as we do on terminal.

    • We take the photo using the command fswebcam, and we define some parameters.

    • We move the photo to a specific directory.

    • We show the photo taken for 3 second and we kill it.

def main():
  os.system("killall -9 eog")
  now = datetime.datetime.now()
  name = str(now.year)+"-"+str(now.month)+"-"+str(now.day)+"-"+str(now.hour)+"-"+str(now.minute)+"-"+str(now.second)
  name = str(name)+".jpg"
  os.system("fswebcam -r 800x480 --jpeg 80 --no-banner --save " + name)
  os.system("mv "+name+" /home/lupe/Desktop/photos/"+name)
  os.system("eog -f /home/lupe/Desktop/photos/"+name+" &")
  time.sleep(3)
  os.system("killall -9 eog")
  return 0  

if __name__ == '__main__':
 main()
PreviousUpboardNextVision

Last updated 5 years ago

Was this helpful?