I'm working on Audiveris, an open-source scanner for printed music scores (Audiveris site
For the time being, the program is able to detect a global skew and rotate the input image accordingly.
But I'd like to go further, and somehow "dewarp" the input image.
Let me precise the context:
From a first image analysis, I'm able to detect nearly all staff lines and barlines.
In theory, staff lines should be horizontal straight lines and barlines should be vertical straight lines. But this is not always the case in reality.
So I would like to "straighten" the staff lines to significantly ease the other recognition tasks down the road.
I'm not very familiar with warping. I've got the feeling that I should be able to use the crossing points between staff lines and barlines as kinds of "control points" for the dewarping process.
I'm already using JAI for image processing in Audiveris, and I've just investigated the Warp class and its subclasses, especially the WarpGrid class.
The WarpGrid class is almost what I'm looking for, since it performs a bilinear transformation within each cell.
However WarpGrid expects a regular grid of cells (same width, same height) something that does not easily fit my structure of staff lines x barlines.
What would be fine is a non-regular grid of cells, actually a collection of cells which are adjacent to one another and globally cover the whole page, but which are not necessary all of the same width and height.
Or perhaps another approach?
Any help or advice on how to address this dewarping problem of music scores would be much appreciated.
Thanks in advance