Archive for category Programacion / Programming

Drawing a histogram of an image with OpenCV

I needed to do a histogram of the depth image of Kinect so here I leave the code for me and anyone that could give it some use. This can be used in C and in C++. (I use OpenCV 2.1)

Tags: , , ,

Class name generator, classnamer

You don’t know what name should your useless class have? Want to make that your code looks complicated and awesome? Try to use ClassNamer!

Its great for me now because my RecursiveCacheLexer does not parse well the results of the DynamicMetadataHelper, it could be because the SmartRequestCounter overflows or something…

Tags:

First contact with Meego in a ExoPC Slate

First of all I must thank Intel for the oportunity of going to their AppLab.
In this lab we got introduced to MeeGo and to AppUp, they showed us how to program a couple of simple apps with their SDK 1.2 and we got an ExoPC with MeeGo to develop on the device.
This post is dedicated to the ExoPC with MeeGo and to the first impressions it gives to me.

Lets start with the hardware of ExoPC Slate, the fabricant fabricant web says this tablet has:

-Multitouch capacitative screen of 11,6 inches (1366×768).
-2GB RAM.
-Intel Atom Pineview-M N450 1.66 GHz – 64 bit support
-Intel GMA 3150 BROADCOM Crystal HD 1080p
-Webcam 1.3MP
Weights 950g and is 295 x 195 x 14.0 mm.
For more data: fabricant web.

The tablet (has only one button).


Read the rest of this entry »

Tags: , ,

Playing with the Kinect

With the objective of learning a bit of OpenCV and about Kinect I’ve coded a little app that lets you choose from what distance you want to see until what distance you want to see with a two trackbars. And you can choose the quantity of times you want to repeat the color scale to represent the distance too.
Here you have a screenshot, in another post I’ll attach the commented code.
Click to see it full.

Tags: , , , ,

Kinect with OpenCV first contact!

After fighting all day with it I’ve got the basic stuff with Kinect, getting the RGB image and the Depth image and show them in real time.

For doing it I wanted to use OpenCV and the libfreenect driver. I’ve been able to do it thanks to the example of OpenKinect.org thats posted on here.

My code looks like this:

Tags: , ,

Try Kinect apps without a Kinect thanks to Fakenect

I’m waiting to get my hands onto a Kinect and while this happens Fakenect from Brandyn White has appeared that can help us to put an eye over the scene.

The instructions to be able to run (for example) the glview demo (I do it on Ubuntu) are:

1) Install the libraries that we'll use for OpenKinect (libfreenect): libusb-1.0 >= 1.0.3, Cmake >= 2.6, OpenGL:
sudo apt-get install libusb-1.0-dev freeglut3-dev libxmu-dev libxi-dev cmake

2) Clone the repository of the project with git to our pc: (if you don't have git: sudo apt-get install git-core)
git clone https://github.com/OpenKinect/libfreenect.git OpenKinect
(It will create a directory called OpenKinect where you are).

3) Create a directory where to compile and build:
cd OpenKinect
mkdir build

4) Use cmake and compile:
cd build
cmake ..
make
sudo make install

5) Now we need a Kinect capture (someone can make one for you if he has a Kinect and the tool "record" from the utils directory) we can use the capture of the Fakenect creator: download from here. Extract it somewhere, I did in: /home/sam/git/legos0

6) Now we can execute glview with the next line (with your FAKENECT_PATH) (you need to use all the line, dunno why, someone knows why?):
LD_PRELOAD="/usr/local/lib/fakenect/libfreenect.so" FAKENECT_PATH="/home/sam/git/legos0" ./bin/glview

Here you have a screenshot of it working:

Tags: , , , ,

Reverse engineering Kinect!

From reddit/r/programming I found this VERY interesting article about how to reverse engineer USB devices. They use as an example the motor of the Kinect. Its pretty well explained and they use python as example language.

Link to the article at ladyada.net!

Tags: , , , ,

Acquiring images from the webcam from MATLAB

To acquire images from a webcam from MATLAB 7.9 (R2009b) I just needed to:

imaqhwinfo
ans =

InstalledAdaptors: {'coreco' 'winvideo'}
MATLABVersion: '7.9 (R2009b)'
ToolboxName: 'Image Acquisition Toolbox'
ToolboxVersion: '3.4 (R2009b)'

Tells us what video adapters we have.

wininfo= imaqhwinfo('winvideo')
wininfo =

AdaptorDllName: [1x87 char]
AdaptorDllVersion: '3.4 (R2009b)'
AdaptorName: 'winvideo'
DeviceIDs: {[1]}
DeviceInfo: [1x1 struct]

With this we find the DeviceID (1) of the webcam.
Now, if we go wininfo struct, from there to DeviceInfo struct there we will find an array called SupportedFormats of our webcam.

I’ll use ‘YUY2_320x240′:

winvid = videoinput('winvideo',1,'YUY2_320x240');

In my case the imagenes are being returned in YUV for default, to change this you need to change the ReturnedColorSpace variable from the object winvid (I do this from the variables explorer of MATLAB like in the screenshot above). I changed it to RGB.

preview(winvid);

With this we can see the webcam :) Example of whats the window like:

With:

capt1 = getsnapshot(winvid);

We capture an image.

We can show it using:

imshow(capt1);

For example.

For learning more stuff we can go to the MATLAB help and search for Image Acquisition Toolbox and search what we need.

Source: madan.wordpress.com

Tags: , , , , , , ,

Sorry, but this post is not available in English

Sorry, but this post is not available in English

Tags: , , ,

Creating independent executables from MATLAB

~I’ll translate it later, haven’t got time right now! Sorry!

Tags: , , , , , , , ,