Musical Note Reader is a Python project that uses optical music recognition (OMR) technology to extract musical notes from digital images of sheet music. The project uses libraries such as numpy, skimage, matplotlib and scipy. The project includes a classifier that is trained on a set of musical notes to accurately identify and classify the notes found in the uploaded images.
- Image processing techniques
- Working with python
- Numpy and Scipy
- Scikit-mage package
- Working with images in python
- Edge detection
- Convolution
- Image histograms
- Image segmentation
- Hough transform
- Feature extraction
The image goes through a pipeline of processing in order to extract and identify musical notes. Here is a brief rundown of the pipeline.
- Preprocessing
a. Converting image to binaryb. Inverting image
c. Deskew image
d. Identify staff lines
e. Remove staff lines
- Partition image into staffs
- Segment staffs into notes
- Normalize notes into 100x100 blocks
- Classify notes
a. Calculate histogram of note
b. Compare with histograms of all other notes in pretrained model
c. Identify closest match - Output staffs and notes to file
- Connected notes are misclassified as the model was not trained on them.
- Notes that are close to each other and overlap in the x-axis are misclassified because they are segmented as one note.
- Errors in preprocessing can cause notes like this:
to have disconnects in x-axis, causing it to be regarded as 2 separate notes.
- Clone the repository by running the following command in your terminal or command prompt:
git clone https://github.com/ziadabdo98/Musical-Notes-Reader.git MusicalNotesReader
- Run the script main.py using python3 with the first argument as the folder containing the images, and the second argument as the folder to output the text files
python main.py test-cases output