YodaVonBeck
Posts: 38
Joined: Wed Mar 16, 2016 10:03 am

rapsistill vs picam?

Mon Oct 03, 2016 8:02 am

Whats the pros and cons to using these to methods for capturing pictures?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26431
Joined: Sat Jul 30, 2011 7:41 pm

Re: rapsistill vs picam?

Mon Oct 03, 2016 8:34 am

raspistill was always intended as a proof on principle/demo code, although it is used extensively all over the place. It's written in C, and uses the MMAL API to communicate with the GPU/ISP. Picam, which I am not so familiar with, is a Python library and application, I believe it also uses MMAL. The Python one is likely easier to modify/use, unless you are happy with C.

I'd try both, to see which fits your use case the best.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

YodaVonBeck
Posts: 38
Joined: Wed Mar 16, 2016 10:03 am

Re: rapsistill vs picam?

Mon Oct 03, 2016 8:36 am

Thanks for your quick reply. Im new to the PiCam and have already used a script to build a timelapse code

Code: Select all

import os
import time
import RPi.GPIO as GPIO
from datetime import datetime
 
# Grab the current datetime which will be used to generate dynamic folder names
d = datetime.now()
initYear = "%04d" % (d.year)
print (initYear)
initMonth = "%02d" % (d.month)
print (initMonth)
initDate = "%02d" % (d.day)
print (initDate)
initHour = "%02d" % (d.hour)
print (initHour)
initMins = "%02d" % (d.minute)
print (initMins)
 
# Define the location where you wish to save files. Set to HOME as default. 
# If you run a local web server on Apache you could set this to /var/www/ to make them 
# accessible via web browser.
folderToSave = "timelapse_" + str(initYear) + str(initMonth) + str(initDate) + str(initHour) + str(initMins)
os.mkdir(folderToSave)
 
# Set the initial serial for saved images to 1
fileSerial = 1
 
# Run a WHILE Loop of infinitely
while True:
  
   d = datetime.now()
   # Loop to only take pictures within timeframe
   if (d.hour>6 and d.hour<19):
 
   hour = "%02d" % (d.hour)
   print ('The hour is: '+ hour + ' taking a picture...')
   # Set FileSerialNumber to 000X using four digits
   fileSerialNumber = "%04d" % (fileSerial)
  
   # Capture the CURRENT time (not start time as set above) to insert into each capture image filename
   hour = "%02d" % (d.hour)
   mins = "%02d" % (d.minute)
  
   # Define the size of the image you wish to capture. 
   imgWidth = 1920 # Max = 2592 
   imgHeight = 1080 # Max = 1944
   #print " ====================================== Saving file at " + hour + ":" + mins
  
   # Capture the image using raspistill. Set to capture with added sharpening, auto white balance and average metering mode
   # Change these settings where you see fit and to suit the conditions you are using the camera in
   os.system("raspistill -w " + str(imgWidth) + " -h " + str(imgHeight) + " -o " + str(folderToSave) + "/" + str(fileSerialNumber) +".jpg -sh 40 -awb auto -mm average -v")
 
   # Increment the fileSerial
   fileSerial += 1
  
   # Wait 60 seconds (1 minute) before next capture
   time.sleep(60)
  
 else:
  
   # Just trapping out the WHILE Statement
   print ("Doing nothing at this time - wait 10min and check the time again")
   time.sleep(600)
This works, so are you saying there is little point in changing this to the picam library?

cecco
Posts: 1
Joined: Mon Oct 03, 2016 4:32 pm

Re: rapsistill vs picam?

Mon Oct 03, 2016 4:37 pm

Hi guys!

I have a quest. Could you describe the method to stream video from RASBERRYPIcamera to my own device (Raspberry). Or could you give me the command to do it :) I ll be very gratefull :)

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26431
Joined: Sat Jul 30, 2011 7:41 pm

Re: rapsistill vs picam?

Tue Oct 04, 2016 10:44 am

YodaVonBeck wrote:Thanks for your quick reply. Im new to the PiCam and have already used a script to build a timelapse code

Code: Select all

import os
import time
import RPi.GPIO as GPIO
from datetime import datetime
 
# Grab the current datetime which will be used to generate dynamic folder names
d = datetime.now()
initYear = "%04d" % (d.year)
print (initYear)
initMonth = "%02d" % (d.month)
print (initMonth)
initDate = "%02d" % (d.day)
print (initDate)
initHour = "%02d" % (d.hour)
print (initHour)
initMins = "%02d" % (d.minute)
print (initMins)
 
# Define the location where you wish to save files. Set to HOME as default. 
# If you run a local web server on Apache you could set this to /var/www/ to make them 
# accessible via web browser.
folderToSave = "timelapse_" + str(initYear) + str(initMonth) + str(initDate) + str(initHour) + str(initMins)
os.mkdir(folderToSave)
 
# Set the initial serial for saved images to 1
fileSerial = 1
 
# Run a WHILE Loop of infinitely
while True:
  
   d = datetime.now()
   # Loop to only take pictures within timeframe
   if (d.hour>6 and d.hour<19):
 
   hour = "%02d" % (d.hour)
   print ('The hour is: '+ hour + ' taking a picture...')
   # Set FileSerialNumber to 000X using four digits
   fileSerialNumber = "%04d" % (fileSerial)
  
   # Capture the CURRENT time (not start time as set above) to insert into each capture image filename
   hour = "%02d" % (d.hour)
   mins = "%02d" % (d.minute)
  
   # Define the size of the image you wish to capture. 
   imgWidth = 1920 # Max = 2592 
   imgHeight = 1080 # Max = 1944
   #print " ====================================== Saving file at " + hour + ":" + mins
  
   # Capture the image using raspistill. Set to capture with added sharpening, auto white balance and average metering mode
   # Change these settings where you see fit and to suit the conditions you are using the camera in
   os.system("raspistill -w " + str(imgWidth) + " -h " + str(imgHeight) + " -o " + str(folderToSave) + "/" + str(fileSerialNumber) +".jpg -sh 40 -awb auto -mm average -v")
 
   # Increment the fileSerial
   fileSerial += 1
  
   # Wait 60 seconds (1 minute) before next capture
   time.sleep(60)
  
 else:
  
   # Just trapping out the WHILE Statement
   print ("Doing nothing at this time - wait 10min and check the time again")
   time.sleep(600)
This works, so are you saying there is little point in changing this to the picam library?
Well, there is a timelapse mode build in to Raspistill, you could try that.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26431
Joined: Sat Jul 30, 2011 7:41 pm

Re: rapsistill vs picam?

Tue Oct 04, 2016 10:44 am

cecco wrote:Hi guys!

I have a quest. Could you describe the method to stream video from RASBERRYPIcamera to my own device (Raspberry). Or could you give me the command to do it :) I ll be very gratefull :)
Please start a new thread with a descriptive title.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

Return to “Beginners”