Wednesday 1 March 2017

Sleep tracker for baby

Aim: Track baby's sleep using images from baby monitor.

Camera: D-Link DCS-825L
   Example image 17.5 kb, 640x352 pixels, 96x96dpi, 24bit.




Method, use the change in image filesize as a proxy for baby movement:
  • Capture image using wget from local network 192.168.1.2/image/jpeg.cgi
  • Crop the image using mogrify (imagemagick) to remove date and time from image.
  • An artefact of the above makes night-vision jpeg images in greyscale (and keeps lighted images in colour); we'll see later that this is useful metadata.
  • Repeat as often as possible (e.g. every second); although maybe it is possible to overload the camera.
  • Write to file with columns: Year, Month, Day, Hour, Minute, Seconds, FileSize, Greyscale

Analysis
  • The jpeg filesize varies from 0 to about 130 bytes from second to second, even with no movement.
  • Baby movements gives up to 400 bytes of variation.
  • Adult movement gives many hundreds or thousands of bytes of filesize changes.
  • We can cut off the awake-time evening and morning data when the night-vision was off (this is presumably when an adult was in the room putting the baby to sleep and collecting the baby in the morning).
  • Each morning plot (using octave) the night's movements:
    • Sleep was from 9pm until 7am, with help from parents around 04:30 to 05:00 (plus baby's own movements around 10pm, midnight, 2am, 4am):




Useful link:
  • D-Link forum: http://forums.dlink.com/index.php?board=427.0