Posts

Take multiple pictures on demand using Raspberry Pi python code

The python code below takes as many pictures you want as long as you keep pressing enter and saves images in a specified folder (in this case "images") with image names "image1.jpg" , "image2.jpg", etc., from picamera import PiCamera from time import sleep camera = PiCamera() camera.rotation = 270 i = 0 while not raw_input("Press enter for a photo"):    i = i + 1    camera.start_preview(alpha=200)    sleep(1)    image_path = "./images/image"+str(i)+".jpg"    camera.capture(image_path)    camera.stop_preview()    print("image successfully saved in the path: "+image_path) Important things to remember You could also use input() instead of raw_input() function based on the python version. make sure the folder exists already. This code might not create a new folder. Do while in python doesn't exist.

Raspberry - Record a video for x minutes / x hours using command line option

raspivid record video using CLI The default option records for 5 minutes. We could override the default options using -t option on the raspivid command line interface. -t option defines the recording time in milliseconds 1 second = 1000 milliseconds 5 seconds = 5000 milliseconds 1 minute = 60 seconds = 60000 milliseconds 1 hour = 60 minutes = 60 x 60 seconds = 3600 = 3600000 milliseconds example: raspivid -o ./vid1.h264 -h 600 -w 600 -rot 180 -sa 50 -t 10000

Raspberry camera [raspistill] image options

Respberry camera options: All options of raspistill command displayed below. pi@raspberrypi1:~/Desktop $ raspistill --help "raspistill" Camera App (commit ) Runs camera for specific time, and take JPG capture at end if requested usage: raspistill [options] Image parameter commands -q, --quality : Set jpeg quality <0 to 100> -r, --raw : Add raw bayer data to jpeg metadata -l, --latest : Link latest complete image to filename <filename> -t, --timeout : Time (in ms) before takes picture and shuts down (if not specified, set to 5s) -th, --thumb : Set thumbnail parameters (x:y:quality) or none -d, --demo : Run a demo mode (cycle through range of camera options, no capture) -e, --encoding : Encoding to use for output file (jpg, bmp, gif, png) -x, --exif : EXIF tag to apply to captures (format as 'key=value') or none -tl, --timelapse : Timelapse mode. Takes a picture every <t>ms. %d == frame number (Try: -o img_%04d.jpg) -f...

Raspberry Pi - Creating a camera preview for 1 minute

Creating a camera preview for 1 minute using python code. from picamera import PiCamera from time import sleep camera = PiCamera() camera.rotation = 270 #Your required orientation camera.start_preview(alpha=200) #transparency - ranging from 0 - 255 sleep(60) #change the time here (in seconds) camera.stop_preview()