Using Hidden Markov Models for staff line removal (in OMR) [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.
Screen Shot 2015-01-24 at 10.11.00 PM
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]"


Simple NURBS renderer [w/ code]

Screen Shot 2013-12-18 at 11.01.23 AMDon'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]"