diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..456b860
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,82 @@
+#FROM python
+#FROM ubuntu:20.04
+FROM nvidia/vulkan:1.1.121
+RUN mkdir /app
+WORKDIR /app
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get update && apt-get install -y python3-pip
+RUN apt-get install ffmpeg libsm6 libxext6 -y
+RUN apt-get install -y libeigen3-dev
+RUN apt-get install -y git
+RUN /usr/bin/python3 -m pip install --upgrade pip
+RUN /usr/bin/python3 -m pip install opencv-python
+RUN /usr/bin/python3 -m pip install pygame
+RUN /usr/bin/python3 -m pip install PyOpenGL
+RUN /usr/bin/python3 -m pip install scikit-build
+
+# Install CMake
+#RUN apt install -y libprotobuf-dev protobuf-compiler
+RUN apt-get install -y cmake
+RUN apt-get install -y g++
+RUN apt-get install -y freeglut3
+RUN apt-get install -y freeglut3-dev
+RUN apt-get install -y libglew-dev
+RUN apt-get install -y binutils-gold
+RUN apt-get install -y libsuitesparse-dev
+RUN /usr/bin/python3 -m pip install scipy
+RUN /usr/bin/python3 -m pip install scikit-image
+
+# Install Eigen
+WORKDIR /app
+RUN git clone https://gitlab.com/libeigen/eigen.git
+WORKDIR /app/eigen
+RUN git checkout 3.3.4
+RUN mkdir build
+WORKDIR /app/eigen/build
+RUN /usr/bin/cmake ..
+RUN /usr/bin/make -j12
+RUN make install
+
+# Install pangolin
+WORKDIR /app
+#RUN git clone https://github.com/uoip/pangolin.git
+RUN git clone https://github.com/AdityaNG/pangolin.git
+WORKDIR /app/pangolin
+RUN mkdir build
+WORKDIR /app/pangolin/build
+RUN /usr/bin/cmake ..
+RUN /usr/bin/make -j12
+#RUN /usr/bin/make
+WORKDIR /app/pangolin/
+RUN ls pangolin*.so
+RUN /usr/bin/python3 setup.py install
+
+# Install g2opy
+WORKDIR /app
+RUN git clone https://github.com/uoip/g2opy.git
+WORKDIR /app/g2opy
+RUN mkdir build
+WORKDIR /app/g2opy/build
+RUN /usr/bin/cmake ..
+RUN /usr/bin/make -j12
+RUN /usr/bin/make install
+WORKDIR /app/g2opy/
+RUN /usr/bin/python3 setup.py install
+
+RUN /usr/bin/python3 -m pip install pandas
+
+# Install twitchslam
+WORKDIR /app
+#RUN git clone https://github.com/geohot/twitchslam
+#RUN git clone https://github.com/AdityaNG/twitchslam
+COPY . /app/twitchslam
+WORKDIR /app/twitchslam
+RUN git checkout docker
+
+RUN touch /root/.Xauthority
+RUN apt-get -y install xauth
+
+EXPOSE 8887
+WORKDIR /app/twitchslam
+#CMD /usr/bin/python3 slam.py
+CMD sh run.sh
\ No newline at end of file
diff --git a/README.md b/README.md
index 77df6db..ca4d39d 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,33 @@ A toy implementation of monocular SLAM written while livestreaming.
+# Docker
+Pull the docker container
+```bash
+docker pull adityang5/twitchslam
+```
+
+Or you can build the container using the following
+```bash
+docker build -t twitchslam .
+```
+
+You can run the container customizing the provided `twitchslam_docker.sh`
+```bash
+./twitchslam_docker.sh
+```
+
+## Install nvidia-docker2
+
+```bash
+xhost +local:docker
+
+sudo apt install nvidia-docker2
+
+sudo systemctl daemon-reload
+sudo systemctl restart docker
+```
+
Stream
-----
@@ -25,6 +52,8 @@ export F=500 # Focal length (in px)
# good example
F=525 ./slam.py videos/test_freiburgxyz525.mp4
+F=525 python3 slam.py videos/test_freiburgxyz525.mp4
+
# ground truth
F=525 ./slam.py videos/test_freiburgrpy525.mp4 videos/test_freiburgrpy525.npz
diff --git a/frame.py b/frame.py
index c555fca..56d8a11 100644
--- a/frame.py
+++ b/frame.py
@@ -14,7 +14,8 @@ def extractFeatures(img):
pts = cv2.goodFeaturesToTrack(np.mean(img, axis=2).astype(np.uint8), 3000, qualityLevel=0.01, minDistance=7)
# extraction
- kps = [cv2.KeyPoint(x=f[0][0], y=f[0][1], _size=20) for f in pts]
+ #kps = [cv2.KeyPoint(x=f[0][0], y=f[0][1], _size=20) for f in pts]
+ kps = [cv2.KeyPoint(x=f[0][0], y=f[0][1], size=20) for f in pts]
kps, des = orb.compute(img, kps)
# return pts and des
diff --git a/run.sh b/run.sh
new file mode 100755
index 0000000..12e854a
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,3 @@
+xauth add $DISPLAY_COOKIE
+#FSKIP=1 F=525 python3 slam.py /videos/test_freiburgxyz525.mp4
+python3 slam.py /videos/$VIDEO_PATH
\ No newline at end of file
diff --git a/slam.py b/slam.py
index 43757bd..95e1989 100755
--- a/slam.py
+++ b/slam.py
@@ -1,10 +1,7 @@
#!/usr/bin/env python3
+
import os
import sys
-
-sys.path.append("lib/macosx")
-sys.path.append("lib/linux")
-
import time
import cv2
from display import Display2D, Display3D
@@ -210,7 +207,16 @@ def process_frame(self, img, pose=None, verts=None):
i = 0
while cap.isOpened():
- ret, frame = cap.read()
+ ret, frame_old = cap.read()
+
+ #FRAME_SKIP = int(os.getenv("FSKIP")) +1
+ FRAME_SKIP = 1 if not os.getenv("FSKIP") else int(os.getenv("FSKIP"))
+ i=0
+ while ret and i