I wanted to put up a quick note on how to use Kalman Filters in OpenCV 2.2 with the C++ API, because all I could find online was using the old C API. Plus the kalman.cpp example that ships with OpenCV is kind of crappy and really doesn't explain how to use the Kalman Filter.
I'm no expert on Kalman filters though, this is just a quick hack I got going as a test for a project. It worked, so I'm posting the results.
Continue reading "Simple Kalman filter for tracking using OpenCV 2.2 [w/ code]"
Just sharing a snippet of code. Part of a project I'm doing, I need to analyse the links in the Wikipedia corpus. While using the API is one solution, it doesn't retain the order of where links appear in the page. It also returns links that are not part of the main text, which makes the linkage DB very cluttered.
So, I set out to parse the raw MediaWiki format all Wikipedia articles are written in, to get only the relevant links and in order. I call them contextual because they live inside the text and have context.
Initially I used string matching, and other complex string scraping parsing methods. It was a bust. There are too many end-cases to deal with. That is when I discovered PyParsing, the excellent parsing library. It did the job, and here are the results.
Continue reading "Getting all the links from a MediaWiki format using PyParsing"
I've seen some examples of people who build motion parallax capable screens using Kinect, but as usual - they don't share the code. Too bad.
Well this is your chance to see how it's done, and it's fairly simple as well.
Continue reading "A motion parallax screen using Kinect [w/ code]"
I'm a fan of Last.fm online radio, and I have a habit of marking every good song that I hear as a "loved track". Over the years I got quite a list, and so I decided to turn it into my jogging playlist. But for that, I need all the songs downloaded to my computer so I can put them on my mobile. While Last.fm does link to Amazon for downloading all the loved songs for pay, I'm going to walk the fine moral line here and suggest how you can download every song from existing free YouTube videos.
If it really bothers you, think of it as if I created a YouTube playlist and now I'm using my data plan to stream the songs off YT itself..
Moral issues resolved, we can move on to the scripting.
Update (4/27/12): youtube-dl.py has moved: https://github.com/rg3/youtube-dl/, and also added a very neat --extract-audio option so you can get the songs in audio right away (it basically does a conversion in a second step).
Continue reading "Download all your Last.fm loved tracks in two simple steps"
I found a nice little trick to ease the work with the very noisy depth image the Kinect is giving out. The image is filled with these "blank" values that basically note where the data is unreadable. The secret is to use inpainting to cover these areas and get a cleaner image. And as always, no need to dig deep - OpenCV has it all included.
Continue reading "Neat OpenCV smoothing trick when Kineacking (Kinect Hacking) [w/ code]"
Just a quick share of lessons learned about Android's Frame-by-Frame animations. Some of the functionality is poorly documented, as many people point out, so the web is the only place for answers. Having looked for some answers to these questions and couldn't find any - here's what I found out myself.
Update [2/3/11]: A new post on this topic gives a more broad view of my experience.
Continue reading "Some things I learned about Android's Frame animation"
I believe that every builder-hacker should have their own little Swiss-army-knife server that just does everything they need, but as a webservice. You can basically do anything as a service nowadays: image/audio/video manipulation, mock-cloud data storage, offload heavy computation, and so on.
Tornado, the lightweight Python webserver is perfect for this, and since so many of the projects these days have Python binding (see python-tesseract), it should be a breeze to integrate them with minimal work.
Let's see how it's done
Continue reading "10 lines-of-code OCR HTTP service with Python, Tesseract and Tornado"
Just wanted to share a thing I made - a simple 2D hand pose estimator, using a skeleton model fitting. Basically there has been a crap load of work on hand pose estimation, but I was inspired by this ancient work. The problem is setting out to find a good solution, and everything is very hard to understand and implement. In such cases I like to be inspired by a method, and just set out with my own implementation. This way, I understand whats going on, simplify it, and share it with you!
Anyway, let's get down to business.
Edit (6/5/2014): Also see some of my other work on hand gesture recognition using smart contours and particle filters
Continue reading "Hand gesture recognition via model fitting in energy minimization w/OpenCV"
On one of my Android apps, I added a trivial option to select a contact from the phone's contact list. This was working fine until SDK version 5, which changed the way the contacts are represented in the phone's SQLite database. It is using the "newer" class called ContactsContract instead of the deprecated People class
I have spent quite time in order to figure out which was the best way that will fit my needs. If you are in the same position, feel free to use the code below
My example below is will display a two row list of all the contacts, with alphabetical indexing. It is a mixture of code snippets I have found on the net, while may not be optimized; it will definitely give you the hang of things.
Continue reading "Reading contacts in Android 2.0+"
Another quicky on how to use Kinect (libfreenect) with OpenCV 2.1. I already saw people do it, but havn't seen code.
UPDATE (12/29): OpenKinect posted very good C++ code of using libfreenect with OpenCV2.X APIs: here it is. Plus, their git repo now has a very clean C code: here it is.
So here it goes
Continue reading "Kinect and OpenCV 2.1"