Optical Music Recognition (OMR) systems are an important tool for the automatic recognition of digitized music scores. However, handwritten musical scores are especially problematic for an automatic recognition. They have irregularities that go from heterogeneous illumination to variability in symbols shape and complexity inherent to music structure. These issues cause serious difficulties when one wants a robust OMR system facilitating search, retrieval and analysis operations. To transform the paper-based music scores and manuscripts into a machine-readable symbolic format several consistent algorithms are needed. In this paper a method for music symbols extraction in handwritten and printed scores is presented. This technique tries to incorporate musical rules as prior knowledge in the segmentation process in order to overcome the state of the art results.