Thursday, September 27, 2007

monday (09.24) through wednesday (09.26) I have been working on a paper for ICASSP, as well as digesting the mathematical transformations presented in Phillipe's class. Today (thursday, 09.27) I will be starting to develop a pitch point analysis algorithm.

Friday, September 21, 2007

after a not so simple fix, i was able to use graphic converter to change the database to the two forms of each pic that were needed. I then simply made two versions of the script, batchConvert_A.py and batchConvert_B.py. The results are currently being run, and I assume that it will take a good portion of the evening.

But this part of the script is completed. Next I will need to start looking at pitch height... most likely on monday afternoon.

here is the code for batchConvert_B.py ... although i should note that this blogger doesnt seem to care for indents much.


import os
import sys

from gamera.core import *
from gamera.toolkits.musicstaves import musicstaves_rl_simple
from gamera.toolkits.musicstaves import musicstaves_rl_carter
from gamera.toolkits.musicstaves import musicstaves_rl_fujinaga
from gamera.toolkits.musicstaves import musicstaves_rl_roach_tatem
from gamera.toolkits.musicstaves import musicstaves_linetracking
from gamera.toolkits.musicstaves import musicstaves_skeleton
init_gamera()

source_folder = ['/Users/jasonos/SRI_B/']
target_folder = ['/Users/jasonos/SRI_B_conversion/']
folder_contents = os.listdir("/Users/jasonos/SRI_B/")[1:]

line_removal = ["rl_simple",
"rl_carter",
"rl_fujinaga",
"rl_roach_tatem",
"linetracking",
"skeleton"]

for i in range(0,len(folder_contents)):
source = folder_contents[i]
target_subfolder = str(target_folder)[2:-2] + source[:-4]
os.system("mkdir %s" % (target_subfolder))
os.system("cp %s %s" % ((str(source_folder)[2:-2]
+ "/" + source), str(target_subfolder)))

# gamera commands
image = load_image(str(source_folder)[2:-2]+source)
onebit = image.to_onebit()
onebit_name = source[:-4]+".png"
onebit.save_PNG(onebit_name)

os.system("mv %s %s" % (onebit_name, target_subfolder))
image = onebit

# music staves stuff
for n in range(0, len(line_removal)):
ms = eval("musicstaves_" + line_removal[n]
+ ".MusicStaves_" + line_removal[n]
+ "(image)")
ms.remove_staves(crossing_symbols = 'bars')
no_staves_img = ms.image.image_copy()
rl_name = source[:-4] + "_" + line_removal[n] + ".png"
no_staves_img.save_PNG(rl_name)
os.system("mv %s %s" % (rl_name, target_subfolder))

today I'm wrestling with the gamera script again to use the linetracking and skeleton utilities algorithms - shouldn't take too long...famous last words...

Tuesday, September 18, 2007

Monday (09.17.2007)

iterative plugins now are operational using simply using eval("whatever the string is") - not sure why this wasnt working before during command line - perhaps it was, but i wasnt aware that the output i was getting was what i needed...

with this solved i will be adding the one bit conversion to the python code on wednesday or thursday.


Sunday, September 16, 2007

Saturday (09.16.2007) - basic functioning

I spent the day working on the python script, which went rather nicely. I spent the afternoon and evening getting familiar with gamera through script commands and came up with the following (although not perfect by any means it works):


import os
import sys

from gamera.core import *
from gamera.toolkits.musicstaves import musicstaves_rl_simple
from gamera.toolkits.musicstaves import musicstaves_rl_carter
from gamera.toolkits.musicstaves import musicstaves_rl_fujinaga
from gamera.toolkits.musicstaves import musicstaves_rl_roach_tatem
init_gamera()

source_folder = ['/Users/jasonos/test_images/']
target_folder = ['/Users/jasonos/test_images_conversion/']
folder_contents = os.listdir("/Users/jasonos/test_images/")[1:]

line_removal = ["simple", "carter", "fujinaga", "roach_tatem"]

#folder generation & file copy
for i in range(0,len(folder_contents)):
source= folder_contents[i]
target_subfolder=str(target_folder)[2:-2] + source[:-4]
os.system("mkdir %s" % (target_subfolder))
os.system("cp %s %s" % ((str(source_folder)[2:-2] + "/" + source), str(target_subfolder)))

# gamera commands
image = load_image(str(source_folder)[2:-2]+source)
onebit = image.to_onebit()
onebit_name = source[:-4]+".png"
onebit.save_PNG(onebit_name)
os.system("mv %s %s" % (onebit_name, target_subfolder))
image = onebit

# music staves stuff -> staff removal
for n in range(0, len(line_removal)):
ms = "musicstaves_rl_" +line_removal[n] +".MusicStaves_rl_" + line_removal[n] + "(image)"
ms.remove_staves(crossing_symbols = 'bars')
no_staves_img = ms.image.image_copy()
rl_name = source[:-4] + "_" + n + ".png"
no_staves_img.save_PNG(tl_name)
os.system("m %s %s" % (rl_name, target_subfolder))


actually i lied. the last bit doesnt work yet because i havent figured out how to get a string to run as a command in python yet. I assume it has something to do with the eval statement, such that if I write my own little function, I can then evaluate that func. but I also think that there has to be some sort of simple transform functionality that im missing. anyways, the function DOES work without thte final for loop by replacing that tidy bit of code with blocks for each line removal algorithm.

Thursday, September 13, 2007

INSTALLING GAMERA (via python universal binaries)

here's how:

1) do you have XCODE installed?

make sure that the developers tools are installed with the SDK option. The developer's tools are available for free @:

http://developer.apple.com/tools/download/

(again, during install, don't forget the SDK option)


2) which version of PYTHON do you have?


check which version of python is currently running...you can do this in terminal with the command:

python

if it comes up as: Python 2.4.4 , thats a good thing move on to step 3.

otherwise, verify that Python 2.4 is NOT on your machine by searching the following directory:
/Library/Frameworks/Python.framework/Versions/

and if 2.4 is not present download the Python 2.4 universal binary here:
http://www.pythonmac.org/packages/py24-fat/index.html

the installer will then make this version the current one, so you should be all set. verify this returning to terminal (if not there already) and type:

python

this time it should read:
Python 2.4.4


3) which version of wxPYTHON do you have?

wxPython is required for proper communication bt/ c++ wxwidgets and python.
you'll need wxPython 2.8.4.2 unicode (although versions up to 2.8.6.1 have been successful), which can be downloaded here (under MAC OS X section, in Python 2.4):
http://www.wxpython.org/download.php#binaries



there. the background stuff is complete.


4) is SVN on your system?

Subversion is the version control program utilized for the Gamera project. You will need to have Subversion (SVN) on your computer to download Gamera properly. If you do not have SVN. please download the most recent stable universal binary here:
http://metissian.com/projects/macosx/subversion/


5) $PATH: is SVN in your path?

SVN may not be in the path of searchable folders, so in terminal, check if:
'/usr/local/bin' is in the path, by typing:

$PATH

if not, simply write (in terminal):

export PATH = $PATH:
/usr/local/bin

this command will place this folder into your path temporarily (it will reset once the terminal shell is closed). If you choose to later, you can permanently change the path by editing your .profile file with vi, emacs, or pico... all within terminal.



6) download GAMERA using SVN

now we are going to download the most recent Gamera using subversion, within terminal. Type the following:

svn co https://gamera.svn.sourceforge.net/svnroot/gamera/trunk/gamera


if it says permission denied, type:

sudo svn co https://gamera.svn.sourceforge.net/svnroot/gamera/trunk/gamera

you will be asked for your password (which is your account password for your computer). Gamera will now download, trunk, branches and all...it is possible to download the trunk alone, but thats not what we did...


7) build and install GAMERA:

a) using Terminal enter the Gamera directory, find the trunk, then keep entering folders until you are in the folder
with setup.py (should just be gamera/gamera). Once there, you can begin the build. Type:

python setup.py build

again if you get a return error that reads permission denied do a 'sudo'.

sudo python setup.py build
then enter your password.

b) once the build is completed, you can do the install:

sudo python setup.py install

when this is completed, you can check to see if Gamera is working by typing:

gamera_gui


8) install MUSIC STAVES

follow the instructions on the music staves page... works wonderfully ;)
http://lionel.kr.hs-niederrhein.de/~dalitz/data/projekte/stafflines/


9) install AOMR2: properly soon...

the AOMR2 software will hopefully be rehosted soon, and as a result, has been installed in piecemeal fashion from the html pages comprised of the most recent versions of the code. for quick access to this version, until rehosted please send an email.
Wednesday (09.12.2007)

In the morning I continued studying Python scripting in preparation for my upcoming script weekend. :D I plan on using much of thursday and friday finishing review of the python tutorial and gamera/music staves class information, then starting to build the script on the weekend.

Spent much of the day reading an article, "Fast Sinusoid Synthesis for MPEG-4 HILN Parametric Audio Decoding", as well as a lot of the day and evening reviewing the mathmatical formulas found in the paper. Then I went home and reviewed trigonometry and calculus for the rest of the evening into the next morning.


Wednesday, September 12, 2007

Tuesday (09/11/2007)

worked on python tutorial further - now I'm getting into derived classes and such in greater detail than before, which is exactly the information I will need to begin the script for the Music Staves thing I'm working on... Basically I spend the full day reviewing this sort of material, apart from meeting with Ich.

Thursday, September 6, 2007

today I continued learning python from the online tutorial. Progress has been quite swift through the first few chapters and I am finding that I am understanding the basics with greater ease than the c++ tutorials ive been through - which is expected...I also had Professor Scavone's class today, in which we had a brief overview of basic Matlab filter design - very interesting :). This weekend I must travel to Ithaca and will be back early Monday, but am taking the tutorial with me as I hope to get through a large amount of it by the beginning of next week so I can write the script for the database of image samples for friday.


Wednesday, September 5, 2007

I have been given the task of finding pitch position of the output glyphs from Gamera after MusicStaves has extracted staff lines.

Yesterday, I went though the music staves documentation to figure out a good starting point to get pitch information from the stave points. Clearly 'get_staffpos' is the place to get this information, as the StaffObj outputs 'staffno' (staff number) and 'yposlist' (y position list of the staff lines). These lines can be used to create fields onto which the glyph note (and rest) centers may be overlaid for determination of pitch information.

Today, this project has been put on hold briefly, to create a python script that will run the staff removal algorithms on a small database of image samples...

Saturday, September 1, 2007

moving and then music staves

yesterday (friday) I had to move...

but today I was able to get MusicStaves up and running. Long story short, I tried several options to make round become attributed with the math namespace, vs the viagra one, but finally chose lround vs round in both 'skewed_runs' and 'staff_removal_fujinaga'. After that the install went smoothly, and all is up and running. I'll be in tomorrow to play with the program...