Offline tracking from an ethoscope

It is possible to use the ethoscope to track a recorded video rather than the real-time stream coming from the pi camera. This is the easiest option but also the slowest because it can go as fast as an ethoscope can go.

To do so:

  1. Flag the ethoscope as "experimental". You can do that from the settings menu of the node.

Untitled

  1. Record the video as you would normally do using your ethoscope.
  2. Once your video is fully recorded, you will have to convert it. If your ethoscope was correctly flagged as experimental a new option will appear under the video options button.

Untitled

  1. Converting the video may take a few minutes but will not give you feedback on whether is finished or not. Keep in mind that video conversion will take extra space on your SD card!
  2. After the conversion, you can start the offline tracking. Start a tracking as usual and select the option MovieVirtualCamera. This will open a choice of videos found on the device. Pick the one you want to track. If you cannot find it there yet it is probably because the conversion has not finished yet.

Untitled

  1. That's it. The ethoscope will now track the movie instead of the camera stream and data will be saved as usual.

Offline tracking from a virtual ethoscope

A virtual ethoscope (or virtuascope) is an ethoscope that runs on a computer that is not a PI. It is possible to run an ethoscope on the node, for instance, and this will appear in the list along with the other ethoscopes. It can be conveniently used to track offline videos. This is how to do it.

On the node:

# install some necessary dependencies
# this step is not needed if you are using a version of the node disc newer than Dec '21
sudo pacman -Sy python-scipy python-opencv fmt
# prepare the system for the virtuascope. In alternative to doing all this you may want
# to simply install the package from AUR:
# yay -S ethoscope-virtuascope

sudo su
echo "Set up mysql database"
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
systemctl start mysqld.service && sleep 2
mysql -u root -e "CREATE USER 'ethoscope'@'localhost' IDENTIFIED BY 'ethoscope'"
mysql -u root -e "CREATE USER 'ethoscope'@'%' IDENTIFIED BY 'ethoscope'"
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'ethoscope'@'localhost' WITH GRANT OPTION";
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'ethoscope'@'%' WITH GRANT OPTION";
chown -R mysql:mysql /var/lib/mysql

echo "setup mariadb configuration"
echo '[server]' > /etc/my.cnf.d/server.cnf
echo 'log-bin=mysql-bin' >> /etc/my.cnf.d/server.cnf
echo 'binlog_format=mixed' >> /etc/my.cnf.d/server.cnf
echo 'expire_logs_days = 10' >> /etc/my.cnf.d/server.cnf
echo 'max_binlog_size  = 100M' >> /etc/my.cnf.d/server.cnf

#create the python package for the ethoscope
cd /opt/ethoscope-node/src/
python setup.py develop

echo "enable the virtuascope and mysqldb services"
cp /opt/ethoscope-node/scripts/virtuascope.service /usr/lib/systemd/system/
systemctl enable virtuascope
systemctl enable mysqld
systemctl start virtuascope

The virtuascope should appear on your node.

Untitled

You will be able to turn it off and on directly from the node.