Just sharing a code snippet about how to implement a jQuery+Bootstrap progress bar for a background operation in Tapestry 5. There's not a lot to it, but it took me a while and serious digging through the internet to find how to make it work. Essentially it's based on a couple of examples and references I found:
But I simplified things because I don't like the over-design Java can easily make you do...
Continue reading "Apache Tapestry 5 Progress Bar with jQuery+Bootstrap [w/code]"
You already know I love libQGLViewer. So here a snippet on how to do AR in a QGLViewer widget. It only requires a couple of tweaks/overloads to the plain vanilla widget setup (using the matrices properly, disable the mouse binding) and it works.
Continue reading "Augmented Reality on libQGLViewer and OpenCV-OpenGL tips [w/code]"
Just sharing a simple recipe for a video stabilizer in OpenCV based on goodFeaturesToTrack() and calcOpticalFlowPyrLK().
Well... it's a bit more than 20 lines, but it is short. And it doesn't work for every kind of video (although the results are funny anyway! :).
Continue reading "Simplest 20-lines OpenCV video stabilizer [w/ code]"
So lately I'm into Optical Music Recognition (OMR), and a central part of that is doing staff line removal. That is when you get rid of the staff lines that obscure the musical symbols to make recognition much easier. There are a lot of ways to do it, but I'm going to share with you how I did it (fairly easily) with Hidden Markov Models (HMMs), which will also teach us a good lesson on this wonderfully useful approach.
OMR has been around for ages, and if you're interested in learning about it [Fornes 2014] and [Rebelo 2012] are good summary articles.
The matter of Staff Line Removal has occupied dozens of researchers for as long as OMR exists; [Dalitz 2008] give a good overview. Basically the goal is to remove the staff lines that obscure the musical symbols, so they would be easier to recognize.
But, the staff lines are connected to the symbols, so simply removing them will cut up the symbols and make them hardly recognizable.
So let's see how we could do this with HMMs.
Continue reading "Using Hidden Markov Models for staff line removal (in OMR) [w/code]"
Sharing a simple code snippet for run-length encoding with OpenCV...
Continue reading "Run length encoding in OpenCV [w/code]"
So I needed to speed up / slow down an audio stream I had (speech generated with Flite TTS) and naively I thought it would suffice to simply sample it at the right intervals and interpolate.
I quickly discovered that just re-sampling won't do because changing frequency also changes pitch proportionally. And then I discovered the world of Time Scaling in audio and it's many algorithms and approaches to change the tempo without changing pitch.
To my surprise there were a number of ready made free libraries that do it, but the first one I tried - RubberBand - did not work out, it had too many dependencies I simply couldn't be bothered compiling it for the Mac. But SoundTouch, well it had a Homebrew formula so it won by default.
I wrote a little simple wrapper around it, that interfaces nicely with Qt.
Let's see what's going on there
Continue reading "Touch up your sound with SoundTouch [w/code]"
I needed to create a small, cheap USB-enabled circuit to serve as a key logger, and I've found some nice projects online that explain how to do this.
I found out you could use an ATTiny85 to run the V-USB software USB stack, and I only needed the one input pin to gather data (it's going to be a USB "That was easy" button).
Since this was done so many times before, I will be brief, and try to point out problems I had instead of a regular tutorial.
Continue reading "Simple ATTiny85 USB board"
¡Hola mis amigos!
I'm learning spanish, but I'm also annoyed with collaborating on LaTeX papers. That's why I've created the GDoc-LaTeXifier so the syntax will be clear when I collaborate on a paper with a remote friend.
But now we both want to compile a PDF on our machines. So I've created the tiny shell script that downloads the paper and runs PDFLaTeX.
The problem is that this opens a new terminal window and runs the script. I've been able to sort it out so that it closes the terminal window when it's done, by on my friend's mac it doesn't, so he ends up with a ton of open windows.
Enter - the GDoc/LaTeX compiler GUI.
Continue reading "GDoc/LaTeX compilation GUI with Tkinter/Python [w/ code]"
Don't you just love scouring the web for a piece of simple code, come up short and then just write it yourself? Well that was the case with NURBS for me. These simple curvy lines, why doesn't anyone just dish out a straightforward implementation of them? Well, now you have it. I wrote a simple renderer that reads a DXF file with NURBS (from Rhino3D) using DXFLIB, although the DXF file format is super easy to parse, and renders them to an image with OpenCV.
Continue reading "Simple NURBS renderer [w/ code]"
So I have this incredibly old and stupidly cheap AIPTEK tablet (like a Wacom, only Chinese and cheap) that is so outdated it practically has almost no existence online. Why did I bring this item across the atlantic? I have no answer, but it's here anyways and I can't seem to bring myself to trash it. Of course no drivers are available for it so I wrote a tiny simple driver using the great libHID library from Brandon Fosdick. It was painless, and my old tablet was saved.
Continue reading "Simple HID driver to save an old AIPTEK HyperPen tablet trashing"