Basic code to to export images from Xtion Pro/ Kinect using OpenNI2 - openni

I've got the Asus Xtion Pro plugged into my PC, and am now trying to run basic OpenNI2 code to export snaphots from the cameras. I am able to run the sample projects that comes with the OpenNI2 package (e.g. SimpleViewer), so I know that it is 'working', but I am trouble getting anywhere past that.
The documentation and how-to side of things for this library seems quite sparse, and I can't find an actual example online that does what I'd like to do, so it would be great if anyone who has the code available that does the following, I'd be grateful:
set up a video stream of depth and colour images.
takes snapshots of these streams at regular intervals (e.g. every 0.5 seconds)
saves these in a format like .png
Thanks

This is not a hard task, try using an example from the openni2 samples. I have a tool that you can tweak to do the three tasks (sample here)
In 1) what exactly you mean with video stream? you want to compress the images into a movie? or just to show them?
If it is just to show them you can take a look to the sample I linked before.
Basicly what you have to do is:
initialize the openni and the devices
start the streams you need (usually depth and color)
show each frame in a window (i used opencv for that) [this will do 1)]
every x number of frames or time save the frames (i used opencv for this task too) [this will be 2 and 3)]
create a key interface to exit properly (can be done with opencv too)
All of this is things are done in a way in the sample I gave you, but you can also ask me if you want specific details about it.
I hope this helps you

Related

Stereo image acquisition using bumblebee2

I am using the Bumblebee2 camera and I am having trouble with acquiring stereo images from it. When I attempt to access the camera using MATLAB, the program crashes.
Does anyone know how I can acquire the stereo images using FlyCapture?
Matlab cannot read the BumbleBee 2 output directly. To do that you'll have to record the stream and process it offline. I wrote a proprietary recorder based on the code samples in the SDK. You can split the left/right images and record each one in a separate video container (e.g. using OpenCV to write a compressed avi file). Later, you can load these images into memory, and use Triclops to compute disparity maps (or alternatively, use OpenCV to run other algorithms, like semi-global block matching).
Flycapture can capture image series or video clips, but you have less control over what you get. I suggest you use the code samples to write a simple recorder, and then load your output into Matlab in standard ways. Consult the Point Grey tech support.

Video capture/record library of desktop/screen " pc not mobile " [c++/Qt]

so I've been searching for something like this , either library or a way to do this but either it's for mobiles or it's not for noobs :D
Basically I want to capture a full screen video where the user can stop/start/ save the video in many formats.
I've thought of capturing the screen " images " and combine them but it's going to take a lot of cpu power I think and I think there's a better way.
I don't think there is a Qt way for doing this perfectly. You can use QPixmap::grabWindow to take a pixmap from a window or take screen-shots like this repeatedly and combine them to form a video. But these are not optimal and i doubt it can please you by taking smooth videos.
You need to use platform specific features and libraries. on Linux you are better to use OpenGL or X shared stuff directly. On windows it is best to use Directx and mac works best with OpenGL.
SimpleScreenRecorder is a Linux based screen recorder written in Qt. It is such nice and easy to use tool. It enables you to recored the entire or part of the screen as well as the audio. It is multi-threaded and so smooth and supports many video codecs.
SimpleScreenRecorder is licensed under GPL. You can download the source and take a look at it.

Image processing in ARM (angstrom)

I'm new to ARM and linux in general but I have eclipse set up for programming my beaglebone black (running angstrom). I want to process an image (local file) and then use the processed image information to turn on/off some LEDs.
What's the most best/most efficient way to process images with my setup? Should I make some script to process the image in Matlab or linux equivalent? If so how would I get the information from those programs into my c++ program? Or should I simply process the image in c++ (probably more difficult)?
This highly depends on what do you mean by process. If you want to do something complicated, I would recommend OpenCV since it offers a vast range of functionalities you can use to process your images.
That being said, if by process you mean extract text from images, you could take a look at Tesseract which is an open source OCR. If you will be going for an OCR, you could use OpenCV to do some pre-processing to make the text extraction process easier and more succesful.
If I am understanding you correctly, then you could take a look at this tutorial which should do what you are after (you start with an image and end up with a pixellated version of it).

How to make rgbdemo working with non-kinect stereo cameras?

I was trying to get RGBDemo(mostly reconstructor) working with 2 logitech stereo cameras, but I did not figure out how to do it.
I noticed that there is a opencv grabber in nestk library and its header file is included in the reconstructor.cpp. Yet, when I try "rgbd-viewer --camera-id 0", it keeps looking for kinect.
My questions:
1. Is RGBDemo only working with kinect so far?
2. If RGBDemo can work with non-kinect stereo cameras, how do I do that?
3. If I need to write my own implementation for non-kinect stereo cameras, any suggestion on how to start?
Thanks in advance.
if you want to do it with non-kinect cameras. You don't even need stereo. There are algorithms now that are able to determine whether two images' viewpoints are sufficiently different that they can be used as if they were taken by a stereo camera. In fact, they use images from different cameras that are found on the internet and reconstruct 3D models of famous places. I can write you a tutorial on how to get it working. I've been meaning to do so. The software is called Bundler. Along with Bundler, people often also use CMVS and PMVS. CMVS preprocesses the images for PMVS. PMVS generates dense clouds.
BUT! I highly recommend that you don't go this route. It makes a lot of mistakes because there is so much less information in 2D images. It makes it very hard to reconstruct the 3D model. So, it ends up making a lot of mistakes, or not working. Although Bundler and PMVS are awesome compared to previous software, the stuff you can do with kinect is on a whole other level.
To use kinect will only cost you $80 for the kinect off of ebay or $99 off of amazon and another $5 for the power adapter off of amazon. So, I'd highly recommend this route. Kinect provides much more information for the algorithm to work with than 2D images do, making it much more effective, reliable and fast. In fact, it could take hours to process images with Bundler and PMVS. Whereas with kinect, I made a model of my desk in just a few seconds! It truly rocks!

Best way to load in a video and to grab images using c++

I am looking for a fast way to load in a video file and to create images from them at certain intervals ( every second, every minute, every hour, etc.).
I tried using DirectShow, but it just ran too slow for me to start the video file and move to a certain location to get data and to save it out to an image. Even if I disabled the reference clock. Tried OpenCV, but it has trouble opening the AVI file unless I know the exact codec information. So if I know a way to get the codec information out from OpenCV I may give it another shot. I tried to use FFMPEG, but I don't have as much control over it as well as I would wish.
Any advice would be greatly appreciated. This is being developed on a Windows box since it has to be hosted on a Windows box.
MPEG-4 format is not an intra-coded format, so you can't just jump to a random frame and decode it on its own, as most frames only encode the differences from one or more other frames. I suspect your decoding is slow because when you land on a frame for which several other dependent frames to be decoded first.
One way to improve performance would be to determine which frames are keyframes (or sometimes also called 'sync' points) and limit your decoding to those frames, since these can be decoded on their own.
I'm not very familiar with DirectShow capabilities, but I would expect it has some API to expose sync points.
Also, I should mention that the QuickTime SDK on Windows is possibly another good option that you have for decoding frames from movies. You should first test that your AVI movies are played correctly in the QuickTime Player. And the QT SDK does expose sync points, see the section Finding Interesting Times in the QT SDK documentation.
ffmpeg's libavformat might work for ya...