User Tools

Site Tools


project:ar_sandbox:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
project:ar_sandbox:start [2019/06/14 18:01] – add links and restart info rainbofproject:ar_sandbox:start [2019/07/23 20:17] (current) – fullscreen support sachy
Line 7: Line 7:
 hw=-| hw=-|
 founder=[[user:harvie]]| founder=[[user:harvie]]|
-interested=[[user:stick]]\\ [[user:niekt0]]\\ [[user:pasky]]\\ [[user:nephirus]]\\ [[user:Gygal]]|+interested=[[user:stick]]\\ [[user:niekt0]]\\ [[user:pasky]]\\ [[user:nephirus]]\\ [[user:Gygal]]\\[[user:sachy]]|
 status=active status=active
 }} }}
Line 145: Line 145:
   * 3x VIKA LERBERG Trestle - http://www.ikea.com/gb/en/catalog/products/80130776/   * 3x VIKA LERBERG Trestle - http://www.ikea.com/gb/en/catalog/products/80130776/
   * custom parts from OBI   * 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).
 +
 +<code python 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()
 +
 +</code>
 +
 +===== Environment preparation =====
 +Easiest way to do anything pyrelated without fighting incompatible python versions is to create virtual environment (venv).
 +
 +
 +<code bash>
 +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
 +</code>
 +
 +===== Result =====
 +
 +{{:project:ar_sandbox:dpth.png?direct|}}
  
 ===== Similar Projects ===== ===== Similar Projects =====
project/ar_sandbox/start.txt · Last modified: 2019/07/23 20:17 by sachy