Skip to content

ziadabdo98/Musical-Notes-Reader

Repository files navigation

Musical Notes

About Project

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.

What I learned

  • 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

Notes recognition pipeline

The image goes through a pipeline of processing in order to extract and identify musical notes. Here is a brief rundown of the pipeline.

Original input image: Original input image

  1. Preprocessing
    a. Converting image to binary Binarized image b. Inverting image Inverted image c. Deskew image Deskewed image d. Identify staff lines Staff lines e. Remove staff lines Staff lines removed
  2. Partition image into staffs One staff
  3. Segment staffs into notes Segmented musical notes
  4. Normalize notes into 100x100 blocks Normalized musical notes
  5. Classify notes
    a. Calculate histogram of note
    b. Compare with histograms of all other notes in pretrained model
    c. Identify closest match
  6. Output staffs and notes to file Output text file

Limitations

  • Connected notes are misclassified as the model was not trained on them.
    Connected notes
  • Notes that are close to each other and overlap in the x-axis are misclassified because they are segmented as one note.
    Overlapping notes
  • Errors in preprocessing can cause notes like this:
    Example error note
    to have disconnects in x-axis, causing it to be regarded as 2 separate notes.
    Two separate notes

Installation instructions

  1. 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
  2. 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages