Table of Contents

AR SandBox

SARndbox
sarndbox-foto_by_alef.jpg
founder: harvie
depends on:
interested: stick
niekt0
pasky
nephirus
Gygal\\sachy
software license: -
hardware license: -

~~META: status = in restart process &relation firstimage = :project:sarndbox-foto_by_alef.jpg ~~

Augmented Reality SandBox is quite nice concept where you play with sand and a projector mounted on top of the sandbox projects constantly updating height-map on it. We've prepared a few installations.

Basic Instructions

Just start piskoviste.brm PC and everything should start by itself.

Autostart

Add following shell script to your Window Manager autostart scripts (i.e. Settings→Session and startup in XFCE4)

~/Desktop/SARndbox
/bin/nice -n -10 /home/brmlab/PISKOVISTE/SARndbox-1.5-001/bin/SARndbox -rs 0 -wo 9999 -loadView /home/brmlab/Desktop/SavedViewpoint0001.view &

The script above increases niceness of an SARndbox process. Increasing niceness to negative values is not allowed for non-privileged user by default in common Linux distros. We can allow user brmlab to do so by adding following lines to /etc/security/limits.conf (Fedora)

/etc/security/limits.conf
brmlab   hard nice     -15
brmlab   soft nice     -11

Fullscreen mode by default

open Vrui.cfg, find in Window section and change windowFullscreen value from false (default) to true

~/Vrui-3.1/etc/Vrui.cfg
section Window
  windowPos (0, 0), (1024, 768)
  windowFullscreen true

Power Management

Piskoviste.brm PC

in xfce4-panel go to “Applications menu→Settings→Power manager” and monitor and PC to go to sleep after some amount of time.

Projector

Set “auto power off” to ON and “timeout” to i.e 15min. Having no input from graphic card projector will turn off automatically after amout of time set.

Software

SARndbox

Software created by Oliver Kreylos for W.M. Keck Center for Active Visualization in the Earth Sciences, UC Davis Tahoe Environmental Research Center, Lawrence Hall of Science, and ECHO Lake Aquarium and Science Center. See http://idav.ucdavis.edu/~okreylos/ResDev/SARndbox/ for more info.

Calibration

It may be quite hard to find out how to calibrate for the first time, so i will document it here a bit

Kinect (Height calibration)

Tou have to manually edit files in PISKOVISTE/SARndbox-1.5-001/etc/SARndbox-1.5/ :

BoxLayout.txt:

(-0.0076185, 0.0271708, 0.999602), -115.0000
(  -48.6846899089,   -36.4482382583,   -111.8705084084)
(   48.3653058763,   -34.3990483954,   -106.3884158982)
(   -50.674914634,    35.8072086558,   -114.4082571497)
(   48.7936140481,    36.4780970044,     -108.74159795)

The important is the last number in each line - in the first line is z-offset of sea level, the four lines are corner calibration points (must be always higher value than the sea level offset). To move sea level up, increase the value on all lines by the same amount.

HeightColorMap.cpt:

-15.0    0   0  80
 -7.0    0  30 100
 -6.0    0  50 102
 -3.5   19 108 160
 -0.75  24 140 205
 -0.25 135 206 250
 -0.05 176 226 255
  0.0    0  97  71
  0.25  16 122  47
  2.5  232 215 125
  5.5  161  67   0
  8.0  130  30  30
 13.0  161 161 161
 19.0  206 206 206
 24.0  255 255 255

Mapping from height to colors. Adjust the appropriate z-offsets (first column) to compress/spread colors across heights.

Projector (plane mapping)

IAMap SandBox

WORK IN PROGRESS

CUstom reimplementation of AR Sandbox that is capable of running on less-advanced hardware than SARndbox (which requires quite decent graphics card), designed with ARM platform in mind (like Raspberry Pi or BeagleBoard).

https://github.com/prusnak/iamap

Installations

FreezeFest 2012

This installation was created for DIY festival FreezeFest 2012. It used ad-hoc on-site construction, around 60kg of sand and SARndbox software (see below).

img_8864.jpg

OjuHr8QgUP0

05I3E7Hf1P0

3fyW9XfEtms

JDI 2012

This installation was created for One Day with Informatics event held at Charles University Prague. It used IKEA1 construction, 50 kg of sand and SARndbox software (see below).

armap2.jpg

Construction

IKEA1

This portable construction was used for JDI 2012 installation (see photos above) and will be stationed at brmlab. It uses the following components from IKEA (hence the name):

IKEA2OBI

This portable construction is built from IKEA components and custom parts from OBI.

AR SandBox^2

The new software is based on Python + OpenCV + libfreenect to abadon that crappy software from the distant past and make hardware requirements as low as possible (lets convert from tower PC to raspberry).

piskoviste.py
#!/bin/python
from freenect import sync_get_depth as gdepth
import cv2
import numpy as np
 
def loopa():
	global depth
	while True:
		(depth,_) = gdepth()
		npd=np.array(depth)
		mn=npd.min()
		npd[npd>1000]=1000 # Eliminate kinect artefacts, constant to be fitted manually
		#print(npd.max())
		npd-=mn
		mx=npd.max()
 
		npd2=npd*(255/mx)
		npd=np.floor(npd2).astype(np.uint8)
 
# Debugging histrogram START
#		himg=np.zeros((300,256,1))
#		hst=cv2.calcHist([npd],[0],None,[256],[0,2048])
#		cv2.normalize(hst,hst,0,255,cv2.NORM_MINMAX)
#		hst2=np.int32(np.around(hst))
#		pts=np.column_stack((np.arange(256).reshape(256,1),hst2))
#		cv2.polylines(himg,[pts],False,(255,0,0))
# Debugging histogram END
 
		fdepth=cv2.applyColorMap(npd,cv2.COLORMAP_JET)
 
		cv2.imshow('dpth',fdepth)
		#cv2.imshow('hst',himg) # Debugging histogram
		if cv2.waitKey(1) & 0xFF == ord('q'):
			break
 
cv2.namedWindow("dpth", cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty("dpth",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
loopa()
 
cv2.destroyAllWindows()

Environment preparation

Easiest way to do anything pyrelated without fighting incompatible python versions is to create virtual environment (venv).

apt-get install python3-venv python-opencv libusb-dev libusb-1.0.0-dev python3-dev
mkdir ./piskoviste
cd ./piskoviste
wget "https://github.com/OpenKinect/archive/master.zip"
unzip "./master.zip"
python3 -m venv venv
source ./venv/bin/activate
pip install --upgrade pip
pip install matplotlib
pip install numpy
pip install opencv-python
pip install cython
mkdir ./libfreenect-master/build
cd ./libfreenect-master/build
cmake -L .. -DBUILD_EXAMPLES=OFF -DBUILD_PYTHON3=ON
make
make install
cd ../wrappers/python
python ./setup.py install
cd ../../..
wget "piskoviste.py_Z_BRMLABI_WIKI"
python ./piskoviste.py

Result

Similar Projects

SandyStation

SandyStation was created at Faculty of Applied Sciences, University of West Bohemia, Pilsen by Petr Altman and Robert Eckstein

more useful links