ReKinStruct- PCD: Check

After a bit of an initial struggle to set the Kinect up with the laptop, I have finally obtained Point Cloud Data.

First PCD

Yes, it is Alienware. Yes, I got my hands on the beast.

So, the visualisation window on the screen shows the frame that is being read from Kinect. The program as of now keeps adding XYZRGBA points to the temp file and saves it as a .pcd file when I press the ‘s’ key and continues to obtain the next dataset. This is just a basic program that I used to test if the Kinect was working.

However, this also gave me the idea to obtain and save PCDs periodically as discussed in the earlier posts. I have not yet tried exploiting all possibilities with the existing code like how big a file can it write, how long can I keep it running to obtain data, how good is the Kinect when it joins frames etc. The plan for the upcoming week would be to try exploring these areas.

Meanwhile, Dr.Ponto suggested the ‘SCENECT’ software which uses a GUI to obtain and modify the frames obtained from the Kinect. That would be a good idea to try along with the existing PCL visualisation code.

Will keep you posted.

Over and out.!

ReKinStruct: Installing PCL, OpenNI and other Kinect Dependencies on Windows (Tutorial)

Since I couldn’t find a simple and direct tutorial on the internet that helps compiling PCL, OpenNI and its related dependencies on a Windows machine, here goes one. Before this begins, a few clarifications.

  • Why use a Windows OS? Because I have a Kinect-for-Windows. If you are having a Kinect 360 that would work on other Operating Systems, I would suggest trying that in Linux before switching to OSX or Windows.
  • I tried installing KinFu too but had to quit as there were a lot of path errors in the CMakeLists. So, if you want KinFu specifically, I am afraid this post would not help you much. You could try installing KinFu with some help from http://pointclouds.org/documentation/tutorials/compiling_pcl_windows.php which is the official documentation and has the kinfu app extensions (See section Downloading PCL Source Code). Best of Luck!
  • If you want to try Kinect Fusion(Microsoft’s version of the same), this post is so tally not going to help you. Installing Kinect Fusion essentially means cutting off all ties with PCL and its dependencies. So, again, Best of Luck!
  • Stick to one architecture for all installations. Since most computers these days have a 64-bit architecture, we will use the 64-bit versions for all installation packages. *If you are having a computer with a 32-bit architecture, I think it is high time you get a time machine. You have so got to travel in time.*
  • You need a good graphics card. I used an Alienware laptop with a NVIDIA GeForce GT 750M graphics card.

Step 1: Basics

Get Microsoft Visual Studio 2010 from www.dreamspark.com (if you are a student, you get it for free) or get it online. It has been one of my favourite IDEs and I hope you will find it useful too. The setup installs only a 32-bit Visual Studio package. You can change it to 64-bit Debug/Release mode by choosing Build->Configuration Manager->Active Solution Platform and changing it to x64 from Win32.

Step 2: Installing PCL

Installing PCL should be fairly straightforward. You can download the setup executable  from http://pointclouds.org/downloads/windows.html. Download the Windows
MSVC 2010 (64bit) All in One Installer. During installation, the setup will ask for the 3rd party dependencies it needs to install. Select Boost, Eigen, FLANN, Qhull, VTK. Uncheck OpenNI. We will install OpenNI in the next step from a different source. Redirect your directories in Visual Studio to point to the PCL files locations(PCL and every 3rd party dependence have their own bin, include and lib files).

Step 3: Installing Kinect Drivers

Okay, this is where it gets tricky. You need one (and only one) type of driver for the Kinect. Since we are going to stick to OpenNI, Do not try installing Microsoft Kinect SDK or KinFu.

Install OpenNI-Win64 from http://www.openni.org/wp-content/uploads/2013/11/

Install SensorKinect-Win64 from https://github.com/avin2/SensorKinect/downloads

Install NITE-Win64 from http://www.openni.org/wp-content/uploads/2013/10/

Try installing the latest versions of these Drivers. After installation, you should be able to see Primesense in your Device Manager with the Kinect Hardware as shown below.

Device Manager Primesense

If it does not appear so, it means the Drivers did not sync with your hardware. Try going to an older version of the Drivers. I have OpenNI 1.5.7.10, SensorKinect v5.1.2.1 and NITE 1.5.2 which are not the latest versions but these are the ones that work on my computer.

Step 4: Verification

Connect the Kinect to your laptop. Select Start->OpenNI 64-bit->Samples->NiViewer64. If step3 was successful you must now be able to see your Kinect reading in data (both depth and colour). I guess you can have a sigh of relief at this point.

Step 5: PCL program to obtain a PCD

Compile and run the example program from http://pointclouds.org/documentation/tutorials/openni_grabber.php in Visual Studio. Again, make sure the library files and linkers are directed properly in Visual Studio. When the program runs, you must be able to see a visualisation window in which you can see the input data from the Kinect and you can save the frame as a PCD when you click ‘s’.

There you go.!

I hope the tutorial was helpful. I know it is not as simple as installing it on Linux or OSX. Reminded me of this meme through out.

sudo sandwich

Image Courtesy: http://imgs.xkcd.com/comics/sandwich.png

However, I hope this post makes it easy now. Have fun. Happy Kinect-ing.!

For further details, email me at nsubramania2@wisc.edu. I will try to help as much as I can.

LEL Project Blog : https://blogs.discovery.wisc.edu/projects/

My Blog : https://blogs.discovery.wisc.edu/projects/author/nsubramaniam/

ReKinStruct : The Hardware-Software Battle

So, I was trying to obtain PCDs from the Kinect and in order to do so, I wanted to read something from the Kinect. Like I mentioned in the previous post, I had PCL and MSVC2010 installed. I had also obtained the latest version of OpenNI and SensorKinect to serve as drivers for the Kinect. And the following happened.

I had one line of code that initialises the Kinect and returns a pointer to grab data. It kept crashing at run-time and there was no stack trace. A little bit of googling led me to believe that OpenNI does not comply with my laptop’s underlying hardware.

Okay, *deep breaths* that is not a dead-end. There had to be something else. So I got Kinect Fusion installed from Microsoft site. And from the tutorials, all I needed to do was type one command line code and my Kinect would (magically?) start obtaining a PCD. Although what happened was a different story.

There was something wrong with my Graphics card. I tried installing the latest CUDA drivers from NVIDIA but that did not help too. I have an Intel 4000HD Graphics card on my laptop and I wonder if KinFu works only with NVIDIA Graphics cards which would mean I would have to start using another machine.

So, the plan for this week is to check if the Kinect works on another machine and start proceeding from there. I also have a bad ( and a good ) feeling that I might have missed installing something on my laptop and so I can get the Kinect working on my machine too. Will keep you posted.

All in all, the classic conclusion, Hardware and Software do not like each other.

ReKinStruct – PCL : Check

So, the aim was to get PCDs from Kinect as soon as possible so I can start working with the point cloud data. On the way, I stumbled into getting the hang of how Kinect works, some basic programs that came along with the Kinect like obtaining a color+depth image, skeletal viewer etc.

Apologies if it looks distorted, had to both be in the image and take a screenshot (And taking a screenshot on Windows with a Mac keyboard requires clicking keys on all corners).

There were few more installations before even getting the Kinect running. Point Cloud Library with its 3rd party dependencies and OpenNI framework are installed and running. Compiled a simple program that reads data from Kinect and displays it on the screen. Stumbling into runtime errors and code halts. Memory usage is already up to 3GB which is three-fourths of the total. Let’s hope it doesn’t crash any soon.

Essentially, would like to get something like this in the next few weeks.

Image Courtesy: pointclouds.org

The target for this week is to get the program working on the IDE and start reading some data from the Kinect and store them as PCDs.

ReKinStruct – Abstract & First Look

Kinects are generally used to obtain depth maps of an environment using their speckle pattern reflection of infrared light and a color pattern similar to a video camera. This data is used to analyze the position and movement of human body thus giving a virtual reality gaming environment. Contrary to the above traditional use of Kinects, they can be used to obtain 3D Point Clouds similar to the usage of a LiDaR scanner. The striking difference between the Kinect and LiDaR scanning would be that a Kinect could be moved in any direction and still continues to obtain the Point Cloud Data while the LiDaR scanner has to be kept stationary during its operation. The Point Cloud Data obtained can be simultaneously or subsequently processed to enhance, reconstruct missing points and texturize the data obtained and can also serve as a map for SLAM (Simultaneous Localization and Mapping). The Point Cloud Library(PCL) and C++ are to be used almost for the entire process. OpenCV, OpenNI are the next likely frameworks.

And to get this project kicked off, I got Windows, Visual Studio and Kinect SDK installed on my Mac (It took much longer than I thought). With a little help from the Kinect SDK apps, I was able to obtain the color and depth maps of my laptop inside my laptop inside my laptop inside. . .

Voila.!

From here, the next step would be obtain a continuous point cloud from the Kinect which would get us something like a 3D image. And from there, it all looks exciting.

Naveen