I was able to determine it was the Sensor driver package which was causing my point cloud vs RGB image offset so using the latest v5.1.6.6 is another binary package installed via the resources directory of the Docker project. My doit-rgbdemo script handles getting these packages off the internet and extracting them so they are ready to be installed once the Dockerfile starts getting used to build the image. I create a new user in the image with the userID of ‘docker’ and passwd of ‘docker’. The password would come in handy if you want to use ‘sudo’ to install anything later. I’ve also added access to /dev/dri so you can get OpenGL optimized rendering for 3D.
So here are the two files, doit-rgbdemo and Dockerfile, put them in a director of their own, make doit-rgbdemo executable( chmod +x doit-rgbdemo ) and run it. After a bit you will have a new Docker image created called “rgbdemo/openni” and you should see an xterm pop up on your desktop waiting for you to run something. Change into the /home/docker/rgbdermo/build/bin directory and try running ./rgbd-viewer after plugging in your ASUS Xtion Pro Live camera.
doit-rgbdemo:
#!/bin/bash # Creates a Docker image for running RGBDemo( /home/docker/rgbdemo/build/bin ) programs for 3D vision and capture using the # ASUS Xtion Pro Live camera( might work with kinect ). It builds the image based on commands in the Dockerfile file and # then starts an xterm controlled by the default user( userID=docker passwd=docker ). # You'll find the rgbdemo package installed in the /home/docker director and the executable applications are in build/bin. # OpenNI and PCL are installed so there are samples for those installed to. Look for NiViewer and Sample-Ni...... progs to run. # # Installing various required packages into the Docker resources for installation into the container without including # the compressed file or even the expanded installation directory using files in the resources' directory in the hosts Docker # directory. There are three packages needed, the OpenNI, NiTE and Sensor packages. After those packages are setup in the # resources director, the Docker image is created or started # HERE=`pwd` mkdir -p resources if [ ! -e resources/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10.tar.bz2 ] then echo "doesn't Exist bz2" if [ ! -e resources/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10.tar.zip ] then echo "doesnt Exist zip" cd resources wget http://www.openni.ru/wp-content/uploads/2013/11/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10.tar.zip cd $HERE fi echo "unzip and remove zip" unzip resources/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10.tar.zip -d resources rm -rf resources/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10.tar.zip # Final check to make sure we have the NiTE installation file if [ ! -e resources/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10.tar.bz2 ] then echo "ERROR: OpenNI install file doesn't exist.... EXIT!" exit fi fi if [ ! -e resources/NITE-Bin-Linux-x64-v1.5.2.23.tar.bz2 ] then echo "doesn't Exist bz2" if [ ! -e resources/NITE-Bin-Linux-x64-v1.5.2.23.tar.zip ] then echo "doesnt Exist zip" cd resources wget http://www.openni.ru/wp-content/uploads/2013/10/NITE-Bin-Linux-x64-v1.5.2.23.tar.zip cd $HERE fi echo "unzip and remove zip" unzip resources/NITE-Bin-Linux-x64-v1.5.2.23.tar.zip -d resources rm -rf unzip resources/NITE-Bin-Linux-x64-v1.5.2.23.tar.zip # Final check to make sure we have the NiTE installation file if [ ! -e resources/NITE-Bin-Linux-x64-v1.5.2.23.tar.bz2 ] then echo "ERROR: NiTE install file doesn't exist.... EXIT!" exit fi fi if [ ! -e resources/Sensor-Bin-Linux-x64-v5.1.6.6.tar.bz2 ] then echo "doesn't Exist bz2" if [ ! -e resources/Sensor-Bin-Linux-x64-v5.1.6.6.tar.zip ] then echo "doesnt Exist zip" cd resources wget http://www.openni.ru/wp-content/uploads/2013/11/Sensor-Bin-Linux-x64-v5.1.6.6.tar.zip cd $HERE fi echo "unzip and remove zip" unzip resources/Sensor-Bin-Linux-x64-v5.1.6.6.tar.zip -d resources rm -rf resources/Sensor-Bin-Linux-x64-v5.1.6.6.tar.zip # Final check to make sure we have the NiTE installation file if [ ! -e resources/Sensor-Bin-Linux-x64-v5.1.6.6.tar.bz2 ] then echo "ERROR: Sensor Driver install file doesn't exist.... EXIT!" exit fi fi CONTAINER="rgbdemo/openni" # check if the image exists and build it if it doesn't, otherwise setup and run it #RUNNING=$(sudo docker inspect --format="{{ .State.Running }}" $CONTAINER 2> /dev/null) RUNNING=$(docker inspect --format="{{ .State.Running }}" $CONTAINER 2> /dev/null) if [ $? -eq 1 ]; then echo "$CONTAINER does not exist." echo "creating $CONTAINER." #create the container using the Docker File debDockerFile-xterm #it's based on the default debian container # #sudo docker build -t rgbdemo/openni . docker build -t $CONTAINER . fi # create the var to pass to docker linking host file X0 to container file X0 # USB bus for USB devices # Direct Rendering Interface to GPU DRI for 3D acceleration XSOCK=/tmp/.X11-unix/X0 VBUS=/dev/bus/usb VDRI=/dev/dri # run the xterm xapp container # -i keeps stdin open # -t creates a psuedo tty #docker run -u docker --privileged -it -v $XSOCK:$XSOCK -v $VBUS:$VBUS -v $VDRI:$VDRI $CONTAINER docker run --privileged -it -v $XSOCK:$XSOCK -v $VBUS:$VBUS -v $VDRI:$VDRI $CONTAINER
Here is the Dockerfile:
FROM ubuntu # quiets down mesg to console about TERM not being set ENV TERM linux USER root RUN apt-get update \ && apt-get install -qqy \ openssh-client \ wget \ git \ gawk \ libusb-1.0-0-dev \ freeglut3-dev \ openjdk-7-jdk \ doxygen \ graphviz \ software-properties-common \ cmake build-essential \ xterm # install OpenNI ADD resources/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10.tar.bz2 /tmp RUN cd /tmp/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10 \ && ./install.sh RUN rm -rf /tmp/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10 # getting ROS packages because they contain all the openni,opencv/pcl goodness needed RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list' RUN wget http://packages.ros.org/ros.key -O - | apt-key add - RUN apt-get update \ && apt-get install -qqy \ ros-indigo-perception-pcl \ ros-indigo-vision-opencv RUN add-apt-repository --yes ppa:xqms/opencv-nonfree RUN apt-get update \ && apt-get install -qqy \ libopencv-nonfree-dev # if UsbInterface is commented out, remove the comment char and flag(DJL) as changed RUN sed -i '/;UsbInterface=2/c\UsbInterface=2;DJL' /etc/openni/GlobalDefaults.ini # install NiTE middleware ADD resources/NITE-Bin-Linux-x64-v1.5.2.23.tar.bz2 /tmp RUN cd /tmp/NITE-Bin-Dev-Linux-x64-v1.5.2.23 \ && ./install.sh RUN rm -rf /tmp/NITE-Bin-Dev-Linux-x64-v1.5.2.23 # install Sensor Driver ADD resources/Sensor-Bin-Linux-x64-v5.1.6.6.tar.bz2 /tmp RUN cd /tmp/Sensor-Bin-Linux-x64-v5.1.6.6 \ && ./install.sh RUN rm -rf /tmp/Sensor-Bin-Linux-x64-v5.1.6.6 # add a user and add the user to the sudoers list RUN useradd -ms /bin/bash docker RUN sed -i '/root\tALL/i\docker\tALL=(ALL:ALL) ALL' /etc/sudoers \ && echo 'docker:docker' | chpasswd USER docker # get rgbdemo RUN cd /home/docker \ && git clone --recursive https://github.com/rgbdemo/rgbdemo.git RUN cd /home/docker/rgbdemo \ # fix linux_configure.sh to use OpenNI not OpenNI2 && sed -i '/\$\*/i\ -DNESTK_USE_OPENNI2=0 \\' linux_configure.sh \ #edit scan_markers/ModelAcquisitionWindow.cpp, comment out line 57,58,59,60,61 && cd scan-markers \ && gawk '/if \(!m_controller/, c==4 {$0 = "//" $0; c++} { print }' ModelAcquisitionWindow.cpp > /tmp/tmpfile \ && cp /tmp/tmpfile ModelAcquisitionWindow.cpp RUN cd /home/docker/rgbdemo \ && ./linux_configure.sh \ && cd build \ && make # get rules.d file #/etc/udev/rules.d/55-primesense-usb.rules ENV DISPLAY :0 #because some gui widgets were not loading ENV QT_X11_NO_MITSHM 1 USER docker CMD xterm #CMD NiViewer
Advertisements