360º Images

Mike Tango Bravo · Updated 2022-05-22

From the platform in the middle of Costaflores Organic Vineyard, 360-degree images are taken automatically every 60 seconds.

These images are stored on IPFS.

The hashes of these image stores on IPFS are registered on the blockchain.

Everyday, the days images are stitched together to create a daily time-lapse.

Every month a monthly time-lapse is created.

Every year a yearly time-lapse is created.

360 camera hardware

Theta SC camera

Physical support and environmental protection

Connection to openvinopi

USB connection

Theta USB API

gphoto2

gphoto2 is the software used to connect to the Theta SC camera from openvinopi, via USB, and take pictures. The gphoto2 software collection is a phenomenal source of tools that enable command-line access to PTP cameras connected by USB.

gPhoto2 is a free, redistributable, ready to use set of digital camera software applications for Unix-like systems, written by a whole team of dedicated volunteers around the world. It supports more than 2700 cameras and media players

gPhoto2 runs on a large range of UNIX-like operating system, including Linux, FreeBSD, NetBSD, MacOS X, etc. gPhoto is provided by major Linux distributions like Debian GNU/Linux, Ubuntu, Gentoo, Fedora, openSUSE, Mandriva, etc.

libgphoto2 is freely available and distributed under the terms of the GNU LGPL.; the other gphoto programs are freely available and distributed under the terms of the GNU GPL.

Newer libgphoto2 versions also support Media Transfer Protocol (MTP) based media players since their communications protocol is based on the Picture Transfer Protocol (PTP).

Installation

While gphoto2 CAN be installed using the apt-get utility, currently this provides an older version that may not support all of the features useful for the Theta SC. The following installation instructions are an excerpt from https://pimylifeup.com/raspberry-pi-dslr-camera-control/

mbarrow@openvinopi:~ $ gphoto2 --version

mbarrow@openvinopi:~ $ gphoto2 --version
gphoto2 2.5.11

Copyright (c) 2000-2016 Lutz Mueller and others

gphoto2 comes with NO WARRANTY, to the extent permitted by law. You may
redistribute copies of gphoto2 under the terms of the GNU General Public
License. For more information about these matters, see the files named COPYING.

This version of gphoto2 is using the following software versions and options:
gphoto2         2.5.11         gcc, popt(m), exif, cdk, aa, jpeg, readline
libgphoto2      2.5.12         all camlibs, gcc, ltdl, EXIF
libgphoto2_port 0.12.0         gcc, ltdl, USB, serial without locking

To install the latest version of gphoto2 and the libgphoto2 libraries, these are the instructions:

  1. Update the raspberry pi operating system and files
sudo apt-get update 
sudo apt-get upgrade

\2. Install necessary packages:

sudo apt-get install git make autoconf libltdl-dev libusb-dev libexif-dev libpopt-dev libxml2-dev libjpeg-dev libgd-dev gettext autopoint

(some of these packages may have already been installed)

\3. Download libgphoto2 libraries:

git clone https://github.com/gphoto/libgphoto2.git

\4. Compile libgphoto2 libraries:

cd ~/libgphoto2
autoreconf --install --symlink
./configure
make
sudo make install

\5. Download gphoto2

cd ~
git clone https://github.com/gphoto/gphoto2.git

\6. Compile the gphoto2

cd ~/gphoto2
autoreconf --install --symlink
./configure
make
sudo make install

\7. Edit libc.conf to to insure that the configuration file referencing the “/usr/local/lib” folder exists:

sudo vi /etc/ld.so.conf.d/libc.conf

Add these lines, if they are not already present:

# libc default configuration 
/usr/local/lib

\8. Refresh the config cache so that /usr/local/lib will be searched by the operating system when linking libraries.

sudo ldconfig

Not necessary if libc.conf already referenced

\9. Generate the udev rules for the camera. Generate the required udev list by running the following command and pipe the command directly into a rules file that the udev service will automatically read.

/usr/local/lib/libgphoto2/print-camera-list udev-rules version 201 group plugdev mode 0660 | sudo tee /etc/udev/rules.d/90-libgphoto2.rules

\10. Generate the hardware database file for udev

/usr/local/lib/libgphoto2/print-camera-list hwdb | sudo tee /etc/udev/hwdb.d/20-gphoto.hwdb

\11. Test that gphoto2 is setup correctly:

gphoto2 --version

gphoto2 2.5.28.1

Copyright (c) 2000-2021 Marcus Meissner and others

gphoto2 comes with NO WARRANTY, to the extent permitted by law. You may
redistribute copies of gphoto2 under the terms of the GNU General Public
License. For more information about these matters, see the files named COPYING.

This version of gphoto2 is using the following software versions and options:
gphoto2         2.5.28.1       gcc, popt(m), exif, no cdk, no aa, jpeg, no readline
libgphoto2      2.5.12         all camlibs, gcc, ltdl, EXIF
libgphoto2_port 0.12.0         gcc, ltdl, USB, serial without locking

TIP

Success! we have upgraded from 2.5.11 to 2.5.28.1 in this example

Light metering

Capture images every 60 seconds

threesixty.sh

Publishing images on IPFS

NFS mount between foxtrot and openvinopi

IPFS node on foxtrot

First create an ipfs user to run the ipfs daemon

[mbarrow@foxtrot threesixty]$ sudo useradd --no-create-home --shell /bin/bash ipfs
[mbarrow@foxtrot threesixty]$ sudo chown ipfs:ipfs /ov_data/threesixty

[mbarrow@foxtrot threesixty]$ sudo su ipfs

set the IPFS directory:

bash-4.2$ export IPFS_PATH=/ov_data/threesixty/

bash-4.2$ /usr/local/bin/ipfs init
generating ED25519 keypair...done
peer identity: 12D3KooWKKjWys4HZtD5seG9Xcam1Jr64Q5Bg6RpR8wBkXPVEDMe
initializing IPFS node at /ov_data/threesixty/
to get started, enter:

 ipfs cat /ipfs/QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/readme

bash-4.2$ /usr/local/bin/ipfs cat /ipfs/QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/readme
Hello and Welcome to IPFS!

██╗██████╗ ███████╗███████╗
██║██╔══██╗██╔════╝██╔════╝
██║██████╔╝█████╗  ███████╗
██║██╔═══╝ ██╔══╝  ╚════██║
██║██║     ██║     ███████║
╚═╝╚═╝     ╚═╝     ╚══════╝

If you're seeing this, you have successfully installed
IPFS and are now interfacing with the ipfs merkledag!

 -------------------------------------------------------
| Warning:                                              |
|   This is alpha software. Use at your own discretion! |
|   Much is missing or lacking polish. There are bugs.  |
|   Not yet secure. Read the security notes for more.   |
 -------------------------------------------------------

Check out some of the other files in this directory:

  ./about
  ./help
  ./quick-start     <-- usage examples
  ./readme          <-- this file
  ./security-notes

Setup IPFS to start automatically

[mbarrow@foxtrot threesixty]$ sudo vi /etc/systemd/system/ipfs.service


[Unit]
Description=IPFS Daemon

[Service]
Environment="IPFS_PATH=/ov_data/threesixty"
ExecStart=/usr/local/bin/ipfs daemon
User=ipfs
Restart=always
LimitNOFILE=10240

[Install]
WantedBy=multi-user.target

[mbarrow@foxtrot threesixty]$ sudo systemctl daemon-reload
[mbarrow@foxtrot threesixty]$ sudo systemctl enable ipfs

[mbarrow@foxtrot threesixty]$ sudo systemctl start ipfs

[mbarrow@foxtrot threesixty]$ journalctl -f -u ipfs
-- Logs begin at Tue 2020-12-01 11:49:50 -03. --
Dec 05 16:23:04 foxtrot ipfs[28485]: Swarm announcing /ip4/127.0.0.1/udp/4001/quic
Dec 05 16:23:04 foxtrot ipfs[28485]: Swarm announcing /ip4/168.227.96.5/udp/4001/quic
Dec 05 16:23:04 foxtrot ipfs[28485]: Swarm announcing /ip4/192.168.0.67/tcp/4001
Dec 05 16:23:04 foxtrot ipfs[28485]: Swarm announcing /ip4/192.168.0.67/udp/4001/quic
Dec 05 16:23:04 foxtrot ipfs[28485]: Swarm announcing /ip6/::1/tcp/4001
Dec 05 16:23:04 foxtrot ipfs[28485]: Swarm announcing /ip6/::1/udp/4001/quic
Dec 05 16:23:04 foxtrot ipfs[28485]: API server listening on /ip4/127.0.0.1/tcp/5001
Dec 05 16:23:04 foxtrot ipfs[28485]: WebUI: http://127.0.0.1:5001/webui
Dec 05 16:23:04 foxtrot ipfs[28485]: Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Dec 05 16:23:04 foxtrot ipfs[28485]: Daemon is ready

Pinning image files on IPFS

Storing IPFS hash on the blockchain

enchainté

Stitching images into time-lapses

ffmpeg

Install ffmpeg:

[mbarrow@foxtrot ~]$ sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro

[mbarrow@foxtrot ~]$ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

[mbarrow@foxtrot ~]$ sudo yum install ffmpeg ffmpeg-devel -y

verify the installation:

[mbarrow@foxtrot ~]$ ffmpeg --version
ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100