Code Monkey home page Code Monkey logo

png_to_klg's Introduction

DOI

You can cite by

@misc{jacky_liu_2018_1419222,
  author    = {Tse-An (Jacky) Liu},
  title     = {png to klg}
  version   = {1.0},
  publisher = {Zenodo},
  month     = Aug,
  year      = 2018,
  doi       = {10.5281/zenodo.1419222},
  url       = {https://github.com/HTLife/png_to_klg}
}

docker image is provided here https://github.com/HTLife/png_to_klg-docker

converted klg could be download from here

png to klg format convertor for ElasticFusion

Convert TUM RGB-D png dataset to .klg format for Kintinuous and ElasticFusion

Also work with ICL-NUIM dataset (TUM RGB-D Compatible PNGs)

What do I need to build it?

  • Ubuntu 14.04, 15.04 or 16.04 (Though many other linux distros will work fine)
  • CMake
  • Boost
  • zlib
  • libjpeg
  • OpenCV
sudo apt-get install g++ cmake cmake-gui libboost-all-dev build-essential

wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip
unzip opencv-2.4.9.zip
cd opencv-2.4.9.zip
mkdir build
cd build
cmake -D BUILD_NEW_PYTHON_SUPPORT=OFF -D WITH_OPENCL=OFF -D WITH_OPENMP=ON -D INSTALL_C_EXAMPLES=OFF -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D WITH_QT=OFF -D WITH_OPENGL=OFF -D WITH_VTK=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D WITH_CUDA=OFF -D BUILD_opencv_gpu=OFF ..
make -j8
sudo make install

Python package

  • numpy
sudo apt-get install pip
pip install numpy

Build

cd ./pngtoklg
mkdir build
cd build
cmake ..
make

Usage

Parameters

All parameters are required.

  • -w working directory
  • -o output file name (the output file will be place under working directory)
  • -r associations.txt is in reverse order (rgb)(depth)
  • -t TUM format / defualt format is ICL-NUIM
  • -s Scale factor in floating point. default=5000

For more scale factor detail, please reference: http://vision.in.tum.de/data/datasets/rgbd-dataset/file_formats#intrinsic_camera_calibration_of_the_kinect

Prerequirement##

Should place associations.txt under working directory. About how to generate associations.txt please read "Related files" section.

Download

ICL-NUIM

Download the file provided by ICL-NUIM (Living Room 'lr kt0') => (TUM RGB-D Compatible PNGs)

TUM

TUM RGB-D png dataset

Convert TUM dataset

./pngtoklg -w '/TUM/rgbd_dataset_freiburg2_desk/' -o '/TUM/rgbd_dataset_freiburg2_desk/fr2desk.klg' -t

After execute the command above, "/TUM/rgbd_dataset_freiburg2_desk" folder should contain fr2desk.klg file (about 4.4GB).

Run with ElasticFusion

./ElasticFusion -l (path to fr2desk.klg) -d 12 -c 3 -f

Convert ICL-NUIM dataset

remove -t option which is stand for tum

./pngtoklg -w '/iclnuim/living_room_traj0_frei_png/' -o '/iclnuim/living_room_traj0_frei_png/liv.klg'

http://www.doc.ic.ac.uk/~ahanda/living_room_traj0_frei_png.tar.gz

Related files

rgb.txt format

One row contain two informations. First is time sequence. Actually the time is not important. We only need increasing number sequence.

timeSequence filePath

Sample file content

0.033333 ./rgb/scene_00_0000_rs.png
0.066666 ./rgb/scene_00_0001_rs.png
0.099999 ./rgb/scene_00_0002_rs.png
0.133332 ./rgb/scene_00_0003_rs.png
0.166665 ./rgb/scene_00_0004_rs.png
0.199998 ./rgb/scene_00_0005_rs.png
...

associate.py

This code is developed by TUM, which use to associate rgb.txt and depth.txt

Type the following command

(Be aware you should remain the order of parameters, feed the depth file first and then rgb file.)

python associate.py PATH_TO_SEQUENCE/depth.txt PATH_TO_SEQUENCE/rgb.txt > associations.txt

Sample file content (TUM RGB-D dataset format) If you are using ICL-NUIM, the timestamp will be integer number

0.033333 ./depth/scene_00_0000_rs.png 0.033333 ./rgb/scene_00_0000_rs.png
0.066666 ./depth/scene_00_0001_rs.png 0.066666 ./rgb/scene_00_0001_rs.png
0.099999 ./depth/scene_00_0002_rs.png 0.099999 ./rgb/scene_00_0002_rs.png
0.133332 ./depth/scene_00_0003_rs.png 0.133332 ./rgb/scene_00_0003_rs.png
0.166665 ./depth/scene_00_0004_rs.png 0.166665 ./rgb/scene_00_0004_rs.png
0.199998 ./depth/scene_00_0005_rs.png 0.199998 ./rgb/scene_00_0005_rs.png

png_to_klg's People

Contributors

chunibyo-wly avatar htlife avatar puzzlepaint avatar xunshanman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

png_to_klg's Issues

If you have the error with make

I got the error below when I typed make.
/usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFReadRGBAStrip@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFSetErrorHandler@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFReadEncodedStrip@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFReadRGBATile@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFSetField@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFScanlineSize@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFSetWarningHandler@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFWriteScanline@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFRGBAImageOK@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFIsTiled@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFReadEncodedTile@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFClose@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFGetField@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.9: undefined reference to TIFFOpen@LIBTIFF_4.0'
collect2: error: ld returned 1 exit status
CMakeFiles/pngtoklg.dir/build.make:112: recipe for target 'pngtoklg' failed
make[2]: *** [pngtoklg] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pngtoklg.dir/all' failed
make[1]: *** [CMakeFiles/pngtoklg.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Realsense Dataset

Hello,
I succeeded in converting the TUM dataset, but I want to make some dataset using Realsense, so I record 100 depth and color png images by realsense, the associations.txt file like this:
1 depth/1.png 1 rgb/1.png
2 depth/2.png 2 rgb/2.png
3 depth/3.png 3 rgb/3.png
4 depth/4.png 4 rgb/4.png
5 depth/5.png 5 rgb/5.png
6 depth/6.png 6 rgb/6.png
7 depth/7.png 7 rgb/7.png
8 depth/8.png 8 rgb/8.png

and then I use this code to convert it to klg format.
but problem occurred.
the result is as follows:
Current working directory:
/input-output/dataset1
Depth: depth/99.png
RGB: rgb/99.png
scale: 5000
klg_name:
/input-output/dataset1.klg
Progress:
Conversion complete!
although it said "Conversion complete" but the output klg file is only 4 bytes. and I cannot run ElasticFusion with the converted klg dataset.

what is the problem?

segment error

Hi,
I want to convert dataset png to klg, I used the rgbd_dataset_freiburg3_long_office_household dataset, first I used the associate.py to generate associations.txt, then I convert, but it failed, this is the output error:
Current working directory:
/home/png_to_klg/build/rgbd_dataset_freiburg3_long_office_household
段错误 (核心已转储)

what is the problem? thank you very much

timestamp issue

Hi, i try to use this useful tool to convert a TUM dataset to klg format and I ran Kintinuous on the it.
But as I run the evaluation tool, it said that :

Couldn't find matching timestamp pairs between groundtruth and estimated trajectory!

What should I do to fix it?

klg2png

Hi, Jacky,
May I ask can we extract png from klg files?
I need to do some processing on some frames in the klg video.
I'm wondering if we can extract the depth and rgb pngs from the klg.
thanks

Not a JPEG file: starts with 0x15 0xe5

hi,gay!
I compiled your project and get the .klg. but when I run the elasticfusion, it makes no sense. I think elasticfusion maybe support the jpeg file format only. TUM dataset is composed of png, but the elasticfusion needs jpeg.

my method is as followed:
~/work/ElasticFusion/GUI/build$ ./ElasticFusion -l /home/yeweicai/Downloads/dataset/TUM/rgbd_dataset_freiburg2_desk/fr2desk.klg -d 12 -c 3 -f
Not a JPEG file: starts with 0x15 0xe5

I want to know how you can run the elasticfusion. Should I write the support of png for elasticfusion to use the png file format? And can you give me your method to run the elasticfusion with the png? I want your help. I am the beginner of slam and 3D Reconstruction (such as Elasticfusion).

you can email me [email protected]
thanks all.

Segmentation fault (core dumped)

I typed the following sentence

./pngtoklg -w '/home/username/Downloads/pngtoklg/build/living_room_traj0_frei_png/' -o 'home/username/Downloads/pngtoklg/build/living_room_traj0_frei_png/liv.klg' -s 0.0002

and I got

Current working directory:
/home/username/Downloads/pngtoklg/build/living_room_traj0_frei_png
Depth: depth/1508.png
RGB: rgb/1508.png
scale: 0.0002
klg_name:
home/username/Downloads/pngtoklg/build/living_room_traj0_frei_png/liv.klg
Segmentation fault (core dumped)

How can I fix it? Thanks

Segmentation fault

Hi,
I created the liv.klg as suggested but when i try to use it in Kintinuous i get :

CloudSliceProcessorThread started
Segmentation fault (core dumped)

Likewise ElasticFusion troughs a Segmentation fault (core dumped), even using the -d 12 -c 3 -f

Any clues?

Not a JPEG file: starts with 0x15 0xe5

Hi,

First off, thanks a lot for this repo. I was able to convert the TUM freiburg2_desk dataset to .klg format using your code. However when i try to run it with ./ElasticFusion -l /home/s/png_to_klg/rgbd_dataset_freiburg2_desk/freiburg2.klg -d 12 -c 3 -f, I get the following error:
Not a JPEG file: starts with 0x15 0xe5

Is there a way to make it accept PNG source files instead of JPEG?

Thanks in advance.

Not a JPEG file: starts with 0×2f 0×30

Hello all,
I'm having this error when trying to run another generated .klg file using ElasticFusion:

Not a JPEG file: starts with 0×2f 0×30

I tried freiburg1desk dataset and it works fine. I've checked similar issues and tried the answered solutions but nothing worked. Here are some lines from my associations.txt:

0.011110 depth/frame0.png 0.011110 rgb/frame0.png
0.016520 depth/frame1.png 0.016520 rgb/frame1.png
0.021930 depth/frame2.png 0.021930 rgb/frame2.png
0.027340 depth/frame3.png 0.027340 rgb/frame3.png
0.032750 depth/frame4.png 0.032750 rgb/frame4.png
0.038160 depth/frame5.png 0.038160 rgb/frame5.png
0.043570 depth/frame6.png 0.043570 rgb/frame6.png
0.048980 depth/frame7.png 0.048980 rgb/frame7.png
0.054390 depth/frame8.png 0.054390 rgb/frame8.png
0.059800 depth/frame9.png 0.059800 rgb/frame9.png
0.065210 depth/frame10.png 0.065210 rgb/frame10.png
0.070620 depth/frame11.png 0.070620 rgb/frame11.png
0.076030 depth/frame12.png 0.076030 rgb/frame12.png
0.081440 depth/frame13.png 0.081440 rgb/frame13.png

I think I correctly followed the steps to create the .klg (otherwise I don't think the frieburg1desk dataset would've worked). What could be wrong here? Thanks.

Run ElasticFuison with ground truth pose

Hi,Jacky.
I'm going to run the ElasticFusion with ground truth pose given by the file livingRoom2.gt.freiburg from the ICL-NUIM.And i've convert the origin depth and rgb data to klg file by your tool.
When i run with the command ./ElasticFusion -l livingRoom2.klg,it was ok.
But it was error(the reconstruction result was erroneous visibly) when i run with ./ElasticFusion -l livingRoom2.klg -p livingRoom2.gt.freiburg.
What should i do to run correct with the -p option?Thanks a lot!

Segmentation fault with my klg on ElasticFusion

So, I used png_to_klg to obtain a dataset to run with ElasticFusion. The dataset was collected with the Realsense D435i sensor. Even though png_to_klg says that the conversion was successful, when I run the klg with ElasticFusion I get segmentation fault. However, I'm a 100% sure I'm doing it right, because I also tried to convert the TUM dataset (and ICL-NUIM) and it worked on ElasticFusion.
Then, I discovered that the TUM dataset is collected with a Kinect and that the depth images produced by the Realsense and the Kinect are different, as you can see in the images below.

Realsense: rs-save-to-disk-output-depth45

TUM: 1305031453 374112

So, is there a way to create a functioning klg for ElasticFusion with this converter using a dataset produced by the Realsense?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.