Monday, 12 December 2016

Blue tit argument...

The bird box has been recently used as an overnight roost for a blue tit.  On a couple of occasions we've had two in there.  Today was a little different since tit 1 didn't appreciate tit 2 in the same space, as can be seen in the following clip:

It's interesting that in addition to feet and beaks being used as offensive weapons, there are a couple of hooks using a wing...

Right hook

The posturing at the beginning is also interesting:


Reminded me a bit of this

Sunday, 8 May 2016

Sunset timelapse: Raspistill vs PiCamera

There two ways (that I know of)  that the Raspberry pi camera can be triggered to take a still image, using Raspistill, or PiCamera.  PiCamera is a python interface for the Raspbery Pi camera. Raspistill can be called from the command line [or... within a python script using os.system("raspistill commend etc").

My preliminary attempts at sunrise timelapses using PiCamera have lead to over exposed skies, with all the details blown out.  This side by side comparison compares:  PiCamera (LEFT) to Raspistill (RIGHT).  

These timelapses are made from a consecutive series of alternate jpgs (PiCamera then RaspiStill) on default settings, as follows (I've left out any referenced variables to stop it getting too unwieldy):
def imagePiCamera():

 with picamera.PiCamera() as camera:

  camera.led = False
  camera.resolution = (2592, 1944)
  camera.framerate = (1, 1)
  camera.vflip = False
  camera.hflip = False
  camera.quality = 100
  camera.exposure_mode = 'auto'
  camera.awb_mode = 'auto'
  camera.image_effect = 'none'
  camera.color_effects = None
  camera.annotate_bg = True
  camera.annotate_text ='%Y-%m-%d %H:%M:%S')
  camera.capture(folderToSave + "/" + s_fileSerialNumber + "_PiCamera.jpg")

def imageRaspiStill():    
 os.system("raspistill -w " + str(imgWidth) + " -h " + str(imgHeight) + " -o " + str(folderToSave) + "/" + s_fileSerialNumber + "_imageRaspiStill.jpg --nopreview -awb auto") 

My take on this is that I get a better sky / sun using RaspiStill, which is a bit of a disappointment since I like being able to annotate with text (as you can see in the PiCamera version (LEFT)... which is no use in a timelapse, I just forgot to switch it off...)

For interest, the 'grouped per-method' images are make into a video as follows:
#rename files
aa=0;for i in `ls`; do sudo mv $i `printf "%04d" $aa`.jpg; aa=$(($aa+1));done
#make timelapse
avconv -r 24 -i %04d.jpg -r 24 -vcodec libx264 -crf 20 -g 15 output.mp4

I got fed up waiting for this to run on my Raspberry pi, so run it on a linux virtual machine through virtualBox on a windows PC = much faster.  The RaspPi3 will compile a 800 image timelapse in approx 30 min using this approach.  Takes me approx 1 min using the other approach.

For the comparison... A side-by-side stitch of the two sunset timelapses as follows:
ffmpeg -i timlapse_PiCamera.mp4 -i timlapse_RaspiStill.mp4 -filter_complex \
'[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid]' \
-map [vid] -c:v libx264 -crf 23 -preset sideBySide.mp4

Saturday, 13 February 2016

More squirrel nest building

Our squirrels are getting a bit carried away with adding shrubbery to their nest.  This one can't make its mind up what to do with them....

...that's if you can see through the cobwebs....

Sunday, 17 January 2016

Self-cleaning bird boxes

I recently acquired a new oven that is described as 'Self-cleaning'.  Looks like my bird box is too (sort of).  I've seen a lot of flies in the nest box recently.  Looks like someone else has noticed that too.....

Pay attention to the fly at the top right corner of the box....

Sunday, 10 January 2016

Why webcam autofocus in birdboxes is sometimes bad

The 2014 bird box has a Raspberry Pi + Microsoft lifecam cinema usb webcam in it that has been faultlessly streaming video since being setup. I had to switch all cameras off over the Summer & Autumn for building work, and on reactivating them... I have discovered a design flaw.

My design has a glass partition between camera / electronics and area for the birds.  Over the Summer this has got filthy - I blame my builders!  The dirt means that the camera now 'sees' the window and focuses on it rather than any in-box activity.  An example from last week (Jan 6 2016),  shows the problem:

While I don't resent the odd insect, I don't want this sort of thing:

There is an obvious solution - CLEAN THE GLASS!
...which would be great if I could locate the keys for my securely locked ladder :(
Plan B is to turn the auto focus OFF and fix the focus to a specific focal distance

Introducing uvcdynctrl
This is a handy application that gives control over your webcam's settings.  Apparently the one I'm using (Microsoft Lifecam cinema) is notorious for a skittish auto focus.

Since I'm running this on a Raspberry pi, to install do:
sudo apt-get install uvcdynctrl

To list the controls available to you do:
uvcdynctrl -c

I get the following (output depends on webcam model):
xx@xx ~ $ uvcdynctrl -c
Listing available controls for device video0:
  White Balance Temperature, Auto
  Power Line Frequency
  White Balance Temperature
  Backlight Compensation
  Exposure, Auto
  Exposure (Absolute)
  Pan (Absolute)
  Tilt (Absolute)
  Focus (absolute)
  Focus, Auto
  Zoom, Absolute

Now, obviously I cant control all of these, there's no pan and tilt controls available to me, however I can change the autofocus behaviour.
To turn OFF that pesky autofocus:
uvcdynctrl -v -d video0 --set='Focus, Auto' 0

Auto focus is OFF... just need to manually set the auto focus until it's in the correct place:
uvcdynctrl -v -d video0 --set='Focus (absolute)' 10
The number at the end is the focal distance - just needs playing with to hit the correct focal point

You can 'get' i.e., query what the focus setting is at  as follows:
uvcdynctrl -d video4 -g "Focus (absolute)"

So auto focus is off for now... just need to find my keys /access ladder, clean/remove the separating glass  and I can sort it properly, then switch auto focus back on with:
uvcdynctrl -v -d video0 --set='Focus, Auto' 1

Saturday, 13 June 2015

Ground-level wildlife webcam camera hack

Over the last week or so I've been attempting to photograph my local badgers using conventional means (DSLR + telephoto lens) - the main problem being: 1) badgers are active at dusk / night, so light levels are low, 2) they are very timid so don't let you get close.

This is the closest I managed to get 'in person':
Badger - can you spot her?
Wanting to get better pictures, I cobbled together an improvised ground level webcam to see if I could get a more 'up-close and personal' perspective:

Cobbled together 'Garden-cam'
This is an unused robin nesting box, with a TP-link POE adapter and a Raspberry Pi model B with Microsoft Lifecam Studio webcam.  All sourced cheaply from ebay. Connected via oudoor cat5 ethernet cable to a PC running iCatcher Console.  The video stream is setup as described  in this post.
I part set this up one evening last week, and left wires and components scattered about having popped in to eat - I left it on in the hope that something would wander past, and got this footage of one of my local badgers:

You can see her being a bit wary of the attached gear, but not to the point that she wont come and investigate.  Later that night I stuffed all the components into the robin box to tidy things up.  Since then,  we have got nice views of the local wildlife as the following screen grabs show:

Passing fox: 4:30 am
Red deer fawn
Jay with mohican
In most of my bird boxes I've used the Microsoft LifeCam.  I only recently acquired a LifeCam Studio ebay bargain - its much better in low light levels due to a bigger sensor size.  It cant see in the dark, but is good for low light levels

Wednesday, 11 February 2015

Spring 2015 nest boxes - early interest

We've seen daily interest in our side-view bird box, but this has been limited to a 'once daily' blue tit.
Today up'd the ante with a pair of Great Tits in addition to the usual mid morning Blue Tit.

Both these clips are from the same day (Feb 9th 2015).  You can see I may need to do a bit of a Spring clean too...

Blue tit

Pair of great tits

Of note is that its the first time I've seen any bird inspect the window at the top of the nest box.  As you can see, the window does not overlook the nest site directly, evident in the ramp up which the Great tit is attempting to climb.  Oddly, both birds attempt the same thing for the first time on the same day.  Front view of this box as shown (although its mounted on the side of the house).

'pre in-situ' picture last Spring.
See the following posts of more detail: Inception, activity counter,

Squirrel box update

Over the  Autumn and Winter, the squirrel box continues to be used as an occasional refuge from rain and windy weather.  They've been only intermittent visitors recently, but lots of activity approx 1 month ago.  Periodic addition of nesting material continues as show in this series:

...or with the squirrel:

Next job is to get this year's bird nesting box completed and up in time for Spring...