Monday, June 21, 2010

After setting up my computer to take pictures of my television screen when finishing a Rock Band song, I can go back and see if I got any new high scores afterwards. However, the leaderboard interface is limited by the controllers and navigating hundreds of songs is clumsy, so I came up with a way to make the computer do most of that work. I can get my scores from rockbandscores.com in csv format, and use OCR (optical character recognition) software to get the name of the song out of the picture.

The scores and song names show up in two different ways. In the middle of a set, the song name appears at the bottom left of the screen. At the end of the set, the song name appears at the top of the screen, in uppercase, and in a different font. There are also lots of non-textual graphics on the screen. However, the OCR software doesn't have to be anywhere near perfect, since all it needs to do is to enable distinguishing between a limited set of a few hundred song titles. So I got ocrad, which is free, lightweight, and fast, though not very sophisticated or flexible.

I send the upper part of each image and the lower left of each image through OCR after processing the piece of the image into monochrome, selecting the whitest and brightest pixels. Originally, I selected for the brightest pixels, but I found that also selecting for the whitest pixels worked much better. There are still lots of non-text clutter left, which the OCR software interprets. So after gathering data on what results the OCR software got from various pictures, I made and refined a heuristic for matching the OCR results with the song titles.

Here are some initial results after getting it to work pretty well. First, a song in the middle of a setlist:


Processing the upper part and the lower left part causes the song title to stand out in the lower left.


The OCR software does a reasonable job on the lower left:

M1dn19htR1d9r. . .
\ a ' ;' '' .. , 1
_-__.


The OCR text is good enough that it matches one song in the scores.csv file, the correct one, and I did not get a new high score:

[Midnight Rider, The Allman Brothers Band, GUITAR:75218 6.18, DRUMS:127100 5.37]


After finishing the set:


Processing the upper part and lower left part of the image causes the song name and score to show up cleanly in the upper part:


The OCR software returns:

FRRNH11N'5 7DWER
225,225 _K1,v,v_

and the A in the picture does look like an R, and the K does look like an H, and all the other misread characters do look like the characters returned by the OCR software. The score was also correctly recognized, but that usually doesn't happen.

Matching the text with the scores.csv file, I got a new high score:

[Franklin's Tower, Grateful Dead, DRUMS:223275 5.98, GUITAR:155807 6.67]

1 comment:

  1. Have you tried Free Online OCR? It is pretty quick and very accurate.

    ReplyDelete