How to detect specific parts of an image


I want to create an interactive musical score by opening a .jpg version of the actual score in OF. I would like to be able to detect every bar so I can highlight them sequentially. I guess an answer would be openCV, but the available examples focus on detecting faces. I would like to be able to detect all clefs (in the .jpg I’ve uploaded the clef is a G one, but I’ll be working with C clefs too), as well as all bar lines (vertical lines on the stave). Any help is greatly appreciated.

Here is a sample score I intend to work with.


Just skimmed it. This looks promising.


Thanks, but seems a bit over-complicated. I found a way to create certain parts of the score in red color, so what I’m going to do is create the normal score and the one with the red parts and then use OpenCV to detect contours.

Thanks for the feedback.