Musical character system
By converting digital score images into matrices and performing feature recognition and repair, the problem of music character recognition in the score is solved, high-quality digital processing is achieved, and the navigability and searchability of the score is improved.
Patent Information
- Application Number
- CN201980022815.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-03-28
- Filing Date
- 2019-03-26
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2039-03-26
AI Technical Summary
The prior art is difficult to effectively identify and convert musical characters in music scores, especially under the complex layout of music symbols and stalks in music scores, resulting in low quality of digital processing and difficulty in navigation, annotation and searching.
By converting digital images into matrices, identifying and grouping units with pixel intensities above the threshold, determining the stems of the quintile and notes, repairing the crack ends, removing fragments, adjusting page orientation, and realizing digital re-engraving of the score.
Improves the digital processing quality of the score, and generates high-quality, easy-to-navigate and search digital scores to ensure the accuracy and clarity of the stave and musical symbols.
Smart Images

Figure CN112204562B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method for recognizing musical characters in a musical score. Background Art
[0002] Currently, many sheet music exists in hard copy form or in the form of low-quality scanned copies from hard copy sources. These sources provide inconsistent quality and are designed for printing rather than viewing on electronic platforms. Moreover, they are not convenient for navigation, annotation, and searching.
[0003] Optical character recognition is a method of converting images of text into computer-encoded text. While the field of optical character recognition of text is well developed, technology is needed for accurately and efficiently converting sheet music and musical characters into a digitized computer-encoded format.
[0004] Recognizing musical symbols in sheet music is particularly challenging because, unlike traditional optical symbol recognition, where letters or symbols do not overlap with other letters or symbols, in sheet music, musical symbols are placed on top of the staves. Summary of the invention
[0005] The invention is set out in the claims.
[0006] According to a first aspect, a method for identifying a line of a staff or a stem of a musical note in a digital image of a musical score is provided, the method comprising: converting the digital image into a matrix, wherein at least one cell of the matrix corresponds to a pixel of the digital image; setting the at least one cell of the matrix to a first value if the pixel intensity of the corresponding pixel of the digital image is higher than a threshold intensity; identifying adjacent cells having the first value as linked cells, the adjacent cells corresponding to pixels adjacent in one of a horizontal direction or a vertical direction of the digital image; identifying linked cells whose number of cells exceeds a threshold as cell chains; grouping adjacent cell chains into a chain group; determining a size of the chain group; and comparing the size with a size threshold; wherein if the size is greater than the size threshold, the pixels corresponding to the linked cells of the chain group are determined to correspond to the lines of the staff, if the adjacent cells correspond to pixels adjacent in a horizontal direction of the digital image; or the pixels corresponding to the linked cells of the chain group are determined to correspond to the stems of musical notes, if the adjacent cells correspond to pixels adjacent in a vertical direction of the digital image.
[0007] Optionally, the adjacent unit is a directly adjacent unit corresponding to a directly adjacent pixel in one direction of the horizontal direction or the vertical direction.
[0008] Optionally, the adjacent cell chains are directly adjacent cell chains.
[0009] Optionally, the directly adjacent cell chains are directly adjacent in the other direction of the horizontal direction or the vertical direction.
[0010] The method may further include identifying a contour cell of the chain group, wherein the contour cell defines a perimeter of pixels of the chain group.
[0011] Optionally, determining the size of the chain group comprises: determining the size of a bounding box surrounding the chain group.
[0012] According to a second aspect, there is provided a method for identifying lines of a musical staff in a digital image of a musical score, the method comprising: converting the digital image into a matrix, wherein at least one cell of the matrix corresponds to a pixel of the digital image; setting the at least one cell of the matrix to a first value if a pixel intensity of a corresponding pixel of the digital image is above a threshold intensity; and determining that the cells having the first value in a row of the matrix correspond to lines of the musical staff if the total number of cells having the first value in the row is greater than a threshold.
[0013] Optionally, before converting the digital image into a matrix, the digital image is scaled down to create a scaled down digital image, optionally wherein the digital image is scaled down by at least one half, preferably the digital image is scaled down by at least three quarters.
[0014] The method may further comprise determining a total number of cells having the first value in each of a plurality of rows of the matrix, and determining a maximum total number of cells having the first value in each of the plurality of rows, wherein the threshold is based on the maximum total number of cells having the first value, preferably wherein the threshold is 70% of the maximum total number of cells having the first value.
[0015] Optionally, the threshold is based on the total number of cells in each row, preferably wherein the threshold is 60% of the total number of cells in each row.
[0016] According to a third aspect, a method for identifying at least a portion of a musical symbol in a digital image of a musical score is provided, the method comprising: converting the digital image into a matrix, wherein at least one cell of the matrix corresponds to a pixel of the digital image; setting the at least one cell of the matrix to a first value if the pixel intensity of the corresponding pixel of the digital image is above a threshold intensity; identifying cells of the matrix corresponding to line pixels, the line pixels corresponding to lines of a stave and / or stems of notes in the digital image; identifying a split end of an object in the digital image, wherein the split end includes cells having the first value and being directly adjacent to the cells identified as corresponding to the line pixels; adding at least one cell having the first value to the split end of the object to create a repaired object, the repaired object including the added at least one cell and the object, the at least one cell being directly adjacent to the split end of the object; determining a match value for the repaired object by comparing features of the repaired object with features of a representation of at least a portion of the musical symbol; and determining that the repaired object corresponds to at least a portion of the musical symbol if the match value exceeds a match threshold.
[0017] Optionally, the at least part of the musical symbol is the entire musical symbol.
[0018] Optionally, the object comprises a group of pixels, the group of pixels all having the first value, wherein each pixel in the group of pixels is directly adjacent to at least one other pixel in the group of pixels.
[0019] Optionally, identifying the split end of the object further comprises: determining a size of the object; and comparing the size with an object threshold size, wherein if the size is greater than the object threshold size, adding the at least one unit having the first value to the split end of the object.
[0020] Optionally, comparing the features of the inpainted object with the representation of the musical notation comprises: determining an outline of the inpainted object; and comparing the outline with the representation of the musical notation.
[0021] Optionally, the step of identifying cells of the matrix corresponding to line pixels includes: identifying adjacent cells having the first value as linked cells, the adjacent cells corresponding to pixels adjacent in one direction of the horizontal direction or the vertical direction of the digital image; identifying linked cells whose number of cells exceeds a threshold as cell chains; grouping adjacent cell chains into chain groups; determining the size of the chain groups; and comparing the size with a size threshold; wherein, if the size is greater than the size threshold, then when the adjacent cells correspond to pixels adjacent in the horizontal direction of the digital image, the pixels corresponding to the linked cells of the chain group are determined to correspond to lines of a staff; or when the adjacent cells correspond to pixels adjacent in the vertical direction of the digital image, the pixels corresponding to the linked cells of the chain group are determined to correspond to stems of musical notes.
[0022] Optionally, the step of identifying cells of the matrix corresponding to line pixels comprises determining that cells having the first value in a row of the matrix correspond to lines of a stave if the total number of cells having the first value in the row is greater than a threshold.
[0023] According to a fourth aspect, a method for removing debris from a digital image of a musical score is provided, the method comprising: converting the digital image into a matrix, wherein at least one cell of the matrix corresponds to a pixel of the digital image; setting the at least one cell of the matrix to a first value if the pixel intensity of the corresponding pixel of the digital image is higher than a threshold intensity; identifying cells of the matrix corresponding to line pixels, the line pixels corresponding to lines of a stave or stems of notes in the digital image; identifying one or more cells having the first value adjacent to the cells corresponding to the line pixels; determining that the one or more cells correspond to debris pixels and setting the values of the cells so that: when the matrix is converted into a digital image, the color of the one or more debris pixels is the color of the background of the digital image.
[0024] Optionally, the one or more cells include a single cell directly adjacent to cells corresponding to line pixels, and all other cells are directly adjacent to the single cell being cells corresponding to pixels having the color of the background of the digital image.
[0025] Optionally, the one or more cells comprise a group of cells, the group of cells all having the first value, wherein each cell in the group of cells is directly adjacent to at least one other cell in the group of cells.
[0026] Optionally, determining that the one or more cells correspond to fragment pixels includes: determining a size of the set of cells; and comparing the size with a fragment threshold size; wherein, if the size is less than the fragment threshold size, setting the value of the cell so that: when the matrix is converted into a digital image, the color of the fragment pixel is the color of the background of the digital image.
[0027] According to a fifth aspect, a method for adjusting the page orientation of a digital image of a musical score is provided, the method comprising: converting the digital image into a matrix, wherein at least one cell of the matrix corresponds to a pixel of the digital image; setting the at least one cell of the matrix to a first value if the pixel intensity of the corresponding pixel of the digital image is higher than a threshold intensity; identifying cells of the matrix corresponding to line pixels, wherein the line pixels correspond to lines of a musical score; determining an angle between the line of the musical score and an edge of the digital image, such as a top edge, a bottom edge or a side edge; and rotating the digital image by an angle.
[0028] Optionally, determining the angle between the line of the staff and the top of the bottom edge of the digital image comprises determining the angle between more than one line of the staff and the top edge or the bottom edge of the digital image.
[0029] Optionally, the angle is an average angle or a median angle.
[0030] According to a sixth aspect, a method for re-engraving a digital image of a musical score is provided, the method comprising: identifying the lines of a staff or the stems of notes according to the method of the first aspect; identifying musical symbols according to the third aspect; and creating a digital file containing data corresponding to the lines of the staff or the stems of the notes, and the musical symbols.
[0031] According to a seventh aspect, there is provided a method for re-engraving a digital image of a musical score, the method comprising: identifying lines of a staff according to the method of the second aspect; identifying musical symbols according to the third aspect; creating a digital file containing data corresponding to the lines of the staff and the musical symbols.
[0032] The methods of the sixth and seventh aspects may further comprise removing fragments from the digital image of the musical score according to the fourth aspect.
[0033] The methods of the sixth and seventh aspects may further comprise: according to the fifth aspect, adjusting the page orientation of the digital image of the musical score.
[0034] Optionally, in the method of any preceding aspect, the pixel density of the digital image is increased before converting the digital image into a matrix.
[0035] The method of any of the aforementioned aspects may further include: identifying two diagonally connected cells having the first value; identifying a weakly linked cell, wherein the weakly linked cell is a cell directly adjacent to both of the diagonally connected cells; and setting the weakly linked cell to the first value.
[0036] Optionally, in the method of any preceding aspect, the cell value of the weakly linked cell is equal to the cell value of the cell corresponding to the background color of the digital image.
[0037] Recognizing musical characters in digital images of sheet music, also known as sheet music, is desirable because it enables the removal of artifacts from the digital image creation process, thereby improving the visual appearance of the staff. The ability to re-engraving the score is highly desirable because it allows the staff to be converted into a high-quality digital format that is rich in metadata. After processing the staff, the result is a clean, legible and durable score optimized for digital delivery that is easily searchable, annotated and navigated. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Embodiments of the present invention will now be described by way of example with reference to the accompanying drawings:
[0039] Figure 1 An example of a musical score is shown;
[0040] Figure 2 Shows Figure 1 Examples of re-engraved versions of the sheet music;
[0041] Figure 3 A flow chart showing the steps for identifying lines of a stave in a musical score;
[0042] Figure 4 A method of strengthening weak connections between units is shown;
[0043] Figure 5 An example of a unit chain is shown;
[0044] Figure 6 An example of a chain group is shown;
[0045] Figure 7 An example of a unit crawl path is shown;
[0046] Figure 8 An example contour unit of a chain group is shown;
[0047] Fig. 9A flow chart is shown comprising the steps of a method for identifying musical symbols in a digital image of a musical score;
[0048] Fig.10 An example of the steps of a method of identifying musical symbols in a digital image of a musical score is shown;
[0049] Fig.11 An example of the lines of a stave dividing a musical symbol into equal parts is shown;
[0050] Fig.12 An example of a musical note including a stem overlapping multiple lines of a staff is shown;
[0051] Fig.13 An example of an object contour unit of a tracked object is shown;
[0052] Fig.14 A flow chart showing a method of removing debris from a digital image of a musical score;
[0053] Fig.15 An example of an object with a split end before and after repair is shown;
[0054] Fig.16 A double note is shown, the double note comprising two quarter notes connected by a beam and two stems;
[0055] Fig.17 The lines of the stave are shown surrounded by the fragments;
[0056] Fig.18 Shows Figure 1 of sheet music, in which the lines and notes of the stave have been identified;
[0057] Fig.19 Examples of re-engraved lines and re-engraved notes of a stave are shown;
[0058] Fig. 20 A portion of a digital image is shown, the portion being four pixels wide and six pixels high;
[0059] Fig.21 Shows Fig.10 The enlarged part of
[0060] Fig. 22 A flow chart showing a method for creating a contour of a repaired object;
[0061] Fig.23 A musical note with a hole is shown;
[0062] Fig.24 Shows Fig.23 a musical note in which an object contour unit and a hole contour unit have been identified; and
[0063] Fig.25 A flow chart showing a method for re-engraving a digital image of a musical score. DETAILED DESCRIPTION
[0064] Aspects disclosed herein relate to automatically analyzing digital images of musical scores. The digital image is generated from an original musical score, which may have been printed or handwritten, and the digital image is obtained by methods such as scanning or photographing a hard copy of the original musical score. Alternatively, the original musical score may have been digitally generated using computer software to produce a digital original that is then converted into a digital image of the musical score, or may already be a digital image of the musical score. The digital image of the musical score may be an image file encoded using any file format such as, for example, a bitmap (.bmp), a jpeg (.jpg), a graphics interchange format (.gif), a tagged image file format (.tiff), or a portable network graphic (.png).
[0065] The digital image thus has sheet music, also known as sheet music, musical notation, or written music, examples of which are in Figure 1 Shown in. Figure 1 A line 101 of a stave, a stem 102 of a note, a note 103, a flat symbol 104 and a decreasing symbol 106 are shown, wherein the note 103, the flat symbol 104 and the decreasing symbol 106 are examples of musical symbols. Musical symbols may also be referred to as musical notations. Therefore, a musical score depicts musical symbols or symbols representing music. For example, they indicate the pitch, rhythm and / or chord of a song or instrumental work. Other examples of musical symbols include, but are not limited to, clefs, rests, rests, time signatures, note relationships (e.g., beams, connecting lines, glissando and legato), dynamics (e.g., piano and long notes, articulation marks, decorations, octave notes, repetitions) and finales. In addition, musical symbols are composed of various components. For example, a double note as a musical symbol may include a beam and two note heads, each of which is also a component of a musical symbol.
[0066] In any aspect disclosed herein, as a first step, the digital original or original music score can be divided into separate pages before being converted into a digital image of the music score. Thereafter, the resolution or pixel density of the digital image of the music score can be increased, for example, from 500x 500 pixels to 1000x 1000 pixels or any other number of pixels, to provide an improved digital image of the music score, which allows, although this step may not be necessary, better control of pixel distribution and improved accuracy of the disclosed method in subsequent steps. Conventional methods well known to those skilled in the art can be used to increase resolution, such as resampling or nearest neighbor interpolation, in which each pixel is replaced by multiple pixels of the same color. The general term "digital image" or "digital image of music score" will be used to refer to the digital image of the music score or to refer to the improved digital image of the music score.
[0067] The digital image is converted into a matrix by setting one or more cells of the matrix to a first value if the pixel intensity of the corresponding pixel of the digital image is above a threshold pixel intensity. As will be appreciated, the term matrix refers to an array of values, quantities or expressions in rows and columns. A matrix contains cells, each of which has coordinates defined by its row and column.
[0068] A matrix is created that has the same size as the digital image (i.e., the number of rows and columns of the matrix cells is the same as the number of rows and columns of the pixels in the digital image). The pixels of the digital image may include data encoding one or more of color, brightness, transparency, or other attributes. Hereinafter, these data are referred to as "pixel intensities". Each pixel (after increasing the image resolution if necessary) corresponds to a cell of the matrix. Next, the pixel intensity of a single pixel is compared to a threshold value, and if the data is above the threshold value, the cell of the matrix corresponding to the pixel is set to a first value. For ease of illustration, a bitmap image of size 1000×1000 pixels will be used as an example. For example, each pixel has red, green, and blue intensity values, where each color has an 8-bit color depth. If any of the red value, green value, or blue value is above an intensity of, for example, 100 (where the minimum value is 0 and the maximum value is 255, as will be understood), the corresponding cell in the matrix is set to a first value, such as a value of 1. Otherwise, the cell is set to a different value, such as a value of 0. In subsequent examples, cells whose values are set to the first value (corresponding to pixels having an intensity equal to or above the threshold) may be referred to as black cells. Cells referred to as white cells in the subsequent examples are cells corresponding to pixels in the music score image whose pixel intensity is below a threshold value.
[0069] Although it is not necessary to convert the entire image into a matrix, the process is repeated for the entire digital image. The resulting matrix has the same size as the digital image (e.g., 1000 x 1000 cells) and directly represents the graphical data of the digital image. In the above example, since all cell values are 1 or 0, the resulting matrix is a binary matrix, but the cell values are not necessarily limited to binary values. The example binary matrix is essentially a black and white representation of the digital image in rows and columns. The resulting matrix can be rotated in subsequent steps. As will be appreciated, if the matrix is rotated, the following description of the columns and rows will be switched.
[0070] As part of the steps of the method of the following aspects, the cell values can be changed to represent different cell types. As will be explained, the possible cell types to be explained later include: linked cells; cells that are part of a cell chain, called chain cells; cells in a horizontal or vertical group of chain cells, called horizontal group cells or vertical group cells, respectively; cells that define a group of cell chain outlines, called outline cells; cells corresponding to rows of lines of a staff, called staff cells; cells corresponding to the stems of notes, called stem cells; cells corresponding to cleaves, called cleave cells; top, bottom, left and right cleave cells; cells corresponding to object outlines, called object outline cells; cells corresponding to object hole outlines, called object hole outline cells; and cells inside object outline cells, called filled cells. Each cell type has a unique value to identify it, for example, the value of a linked cell is 2, the value of a chain cell is 3, and so on. Any value or type of value (e.g., alphanumeric values) can be specified as long as each cell type corresponds to a unique value that is not shared with other cell types. In addition, each cell type has a corresponding resolved cell type that is updated to that cell after resolution. For example, these cell types are called resolved white cells, resolved black cells, resolved linked cells, etc. Any value or type of value (e.g., alphanumeric values) can be assigned to a resolved cell type as long as each cell type and resolved cell type corresponds to a unique value that is not shared with other cell types.
[0071] Now refer to Fig. 20 To give an example of how a digital image can be converted into a matrix, this figure shows for example purposes a portion of a digital image that is four pixels wide and six pixels high ( Fig. 20 A). Therefore, the corresponding matrix ( Fig. 20B) is also four cells wide (with four columns) and six cells high (with six rows). In this case, the digital image is a black and white image, where each pixel is either black or white. The pixel intensity of each white pixel is below the threshold, and each corresponding cell ("white cell") is given a value of 0. The pixel intensity of each black pixel is above the threshold, and each corresponding cell ("black cell") is given a value of 1.
[0072] For clarity, in Figure 4 , Figure 5 , Figure 6 , Figure 8 , Fig.10 , Fig.11 , Fig.12 , Fig.13 , Fig.15 , Fig.16 , Fig.17 , Fig.18 , Fig.21 , Fig.23 and Fig.24 In the matrix shown, white, black, and shaded or hatched squares or areas are used to represent the cell values of the cells. This is for ease of understanding and visual representation, and helps show how the cells of the matrix correspond to the pixels of the digital image.
[0073] The matrix may include "weak connections" that may be "enhanced". Two cells of the matrix having a first value that are diagonally adjacent, where the cells on either side of the diagonal connection (i.e., the diagonal opposite to the diagonal having the first value) do not have the first value, are described herein as having a "weak connection" 401. A weak connection may indicate a degradation in quality from the original score to the digital image due to poor scanning quality or low resolution of the digital image, or for other reasons. For example, the original score itself may not be of high quality. Weak connections may be "enhanced" to help avoid tracking errors and / or contour recognition errors in subsequent steps, as described below. Figure 4 A method of strengthening weak connections between cells is shown. Figure 4 A. Figure 4 B and Figure 4 C respectively corresponds to a portion of the matrix, which includes two columns and five rows.
[0074] Figure 4 A matrix is shown in which black squares represent black cells (having a first value) and white squares represent white cells. Figure 4 A shows an example weak connection. Figure 4 As shown in FIG. 4A , a black cell 404 has a column of white cells to the right of the black cell 404 and a row of white cells above the black cell 404. However, it is diagonally adjacent to the black cell 405. Figure 4There is a weak connection 401 between units 404 and 405 of A. Figure 4 As shown in FIG. 4B , the weak connection can be enhanced by converting the weakly connected unit 402 into a black unit (i.e., corresponding to a pixel with a pixel intensity higher than a threshold). In other words, the unit forming the L shape can be converted with the unit forming the weak connection. Alternatively, the weakly connected unit 403 can be converted into a black unit.
[0075] The connection can be further enhanced by converting both the weakly linked cell 403 and the weakly linked cell 402 into black cells ( Figure 4 C).
[0076] In addition, rows and / or columns of black cells of one cell thickness (i.e., corresponding to horizontal and / or vertical lines in the digital image having a thickness of only one pixel) may also be enhanced. For example, this process involves identifying columns and / or rows of one cell thickness of black cells and increasing the thickness of the rows or columns to two or more black cells by replacing one or more white cells immediately adjacent to each black cell with a black cell.
[0077] In summary, enhancing weak links may include identifying two diagonally connected cells having a first value; identifying weakly linked cells 402, 403, wherein the weakly linked cells 402, 403 are adjacent to the two diagonally connected cells and do not have the first value; and setting the weakly linked cells 402, 403 to the first value.
[0078] First aspect
[0079] A first aspect disclosed herein is a method of identifying the stems of musical notes or lines of a stave in a digital image of a musical score. Figure 3 A flow chart illustrating the steps of the method is shown in FIG.
[0080] In step s301, a digital image is converted into a matrix, which digital image can be a digital image of a musical score or an improved digital image of a musical score as explained above. Step s301 is divided into two parts: s301a and s301b. In step s301a, a matrix with the same size as the digital image is created, and in step s301b, the pixel enhancement of a single pixel is compared with a threshold value, and if the data is above the threshold value, the cell of the matrix corresponding to the pixel is set to a first value, as described above.
[0081] At step s302, adjacent black cells are identified as linked cells, the adjacent cells corresponding to pixels that are adjacent in one of the horizontal or vertical directions of the digital image. As will be discussed further below, adjacent cells corresponding to pixels that are adjacent in the horizontal direction are used to identify the lines of the stave in the digital image of the score, while adjacent cells corresponding to pixels that are adjacent in the vertical direction are used to identify the stems of the notes in the digital image of the score. In this case, the term "adjacent cells" refers to cells that are directly adjacent along a line that is parallel or perpendicular to the bottom of the page. Therefore, adjacent cells do not include diagonally adjacent cells.
[0082] Figure 5 The cells of the matrix are shown, where black squares represent black cells of the matrix corresponding to pixels having pixel intensities above a threshold value, and white squares represent white matrix cells corresponding to pixels having pixel intensities below the threshold value. Figure 5 For example, the black cells in rows A, B, C, and D correspond to pixels that are adjacent in the horizontal direction of the digital image. Therefore, the cells in boxes 501, 502, 503, and 504 are identified as linked cells. The cell values of the cells identified as linked cells can be updated to reflect that the cells are linked cells, that is, they can be assigned different values in the matrix to indicate that the cells are linked cells.
[0083] In step s303, linked units including a number of units exceeding a threshold number in the horizontal direction (identifying the lines of the stave) or in the vertical direction (identifying the stems of the notes) are identified as horizontal or vertical chains, respectively. Figure 5 For example, if the threshold is 3, the cells in boxes 501, 502 and 503 are respectively identified as cells that form part of a horizontal chain, while the cell in box 504 is not identified as a cell that forms part of a horizontal chain. The threshold may be a predefined threshold, such as 100 pixels and / or at least 90% of the width of the digital image for identifying a line of a stave, or 50 pixels and at least 5% of the height of the digital image for identifying a stem of a note, or the threshold may be determined dynamically based on the length distribution of the cells linked in the matrix, for example by identifying all possible chains and setting the threshold as a percentage of the average length of the chain. The cell values of cells that form part of a cell chain may be updated to reflect that the cell is part of a cell chain, i.e., they may be assigned different values (e.g., chain cell values) in the matrix to indicate that each cell is part of a cell chain.
[0084] In step s304, the unit chains are grouped into chain groups. For example, directly adjacent horizontal or vertical chains can be grouped to create horizontal or vertical chain groups, respectively. Their unit values are updated accordingly, for example, to the horizontal group unit value or the vertical group unit value, respectively. Continuing with the above example, Figure 5The horizontal chains of cells in boxes 501, 502 and 503 in are grouped as follows Figure 6 Shown is a horizontal chain group 601. All cells that are not grouped into a chain group in step s304 are set to white cells.
[0085] In step s305, the size of the chain group is determined. For example, the size may be the maximum height and / or the maximum width. Figure 6 For example, the maximum width of the group is six units and the maximum height is three units. In particular, determining the size of the chain group may be determining the size of a bounding box of the chain group.
[0086] An example of how to determine the bounding box will now be given. Cells defining the outline of a chain group are determined, called outline cells. Outline cells are those cells located at the periphery of a chain group. A predefined path theory can be applied to crawl through the matrix to identify the edges or perimeters of a group of cells. For example, a cell of the matrix takes one of three values: white (cells corresponding to pixels with pixel intensity below a threshold), horizontal group or vertical group cells (cells identified as horizontal or vertical chain groups), and outlines (cells forming the outline of a chain group). A code example written in C# for crawling the path is given below.
[0087] int[,]ScanPathController=new int[,]{{-1,0},{0,1},{1,0},{1,0},{0,-1},{0,-1},{-1,0},{-l,0},{0,1}};
[0088] Figure 7 An example crawling path is shown, where the numbers indicate the order in which the units are parsed. Figure 7 As shown, starting with the central starting cell 701, the value of each cell around the starting cell 701 is read in sequence. In this case, a clockwise path from cell 1 / 9 to cell 2 to cell 3, etc., is described, and then ends with cell 1 / 9; however, any suitable crawling path can be used. Using this path theory, if the central cell is a horizontal group or vertical group cell, and if any of the cells around the starting cell are white cells, the starting cell 701 must be a contour cell. Cells identified as contour cells will be updated with contour values, otherwise their current values will be retained or set to corresponding resolved values, such as resolved horizontal group or vertical group cell values, to indicate that they have been resolved to avoid re-resolving. As will be understood, other methods and codes can be used to crawl cells, and the methods described herein are merely examples.
[0089] Alternatively, the path may be used to find all black cells in the path, wherein once a black cell is found, the central starting cell 701 is moved to that cell and the scan path is followed again.
[0090] Figure 8 Shows Figure 6 The outline elements of the chain set 601 are shown, wherein the hatched squares represent the outline elements.
[0091] The bounding box surrounding the contour can be determined from the coordinates of the contour cells. The coordinates of the contour cells can be collected in the form of an array of row and column references that depict each contour cell. The coordinates of the contour cells can be used to identify the bounding box (characterized by four cell coordinates) surrounding the contour cells. As will be appreciated, the area of the bounding box can be minimized by iteratively passing through all edges of the convex hull that define the contour cells (i.e., the minimum set of cells) to find the minimum bounding box 801. The minimum bounding box defines the minimum area surrounding all contour cells. In fact, any boundary polygon or minimum boundary polygon can be calculated alternatively, and it is not necessary to be limited to a bounding box.
[0092] Figure 8 Shows Figure 6 The minimum bounding box 801 of the chain group 601 .
[0093] Therefore, in step s305, at least one size of the chain group or the bounding box or the minimum bounding box is calculated using the above method.
[0094] If the method is used to identify lines of a musical staff, a preferred dimension of the bounding box or minimum bounding box is the width, where the width corresponds to the following dimension of the matrix: this dimension corresponds to the left-to-right direction of the digital image of the musical score, that is, the direction in which the music will be read when the musical score is oriented in the conventional way.
[0095] If the method is used to identify the stems of notes, a preferred dimension of the bounding box or the minimum bounding box is the height, which corresponds to the dimensions of the matrix corresponding to the vertical direction of the box. A digital image of a musical score when the score is oriented in a conventional manner.
[0096] Pixels corresponding to lines of a staff or stems of a note may be collectively referred to as line pixels, and units corresponding to line pixels are staff units or stem units.
[0097] At step s306 / s307, the size is compared with a size threshold. The size threshold may be a predetermined threshold, for example, the size threshold may be at least 90% and / or 100 pixels of the width of the digital image for identifying the line of the stave, or at least 5% and 50 pixels of the height of the digital image for identifying the stem of the musical note. Alternatively, the size threshold may be a dynamic size threshold. The dynamic size threshold may be calculated by identifying multiple sizes (multiple chain groups) in the musical score image and calculating the dynamic size threshold based on the size distribution. For example, if the linked cells are adjacent cells corresponding to pixels adjacent in the horizontal direction of the digital image, the size distribution will generally have a narrow peak at a value greater than, for example, half the width of the matrix. The peak corresponds to the longest dimension of the line of the stave in the digital image. The dynamic threshold may be set just below this peak to ensure that only the line of the stave, and not other lines, are determined as the line of the stave. When the method is used to identify the stem of the musical note, necessary corrections should also be made. The benefit of using a dynamic size threshold is that the threshold will more reliably scale with the size of the stem line or stave line of the particular digital image. Alternatively, the threshold may be a percentage of the average length of all chain groups. If the size is above the size threshold, the method proceeds to step s309, in which pixels corresponding to linked cells of the chain group are determined to correspond to: 1) lines of a staff (if adjacent cells correspond to pixels adjacent in the horizontal direction of the digital image), or 2) stems of a note (if adjacent cells correspond to pixels adjacent in the vertical direction of the digital image).
[0098] Since the lines of the stave extend horizontally on the score, if the linked cells correspond to pixels that also extend horizontally on the digital image of the score, it is assumed that the pixels correspond to lines of the stave. Since the size of the cells / pixels is greater than the threshold size and the longest horizontally oriented object in the score is a line of the stave, it can again be assumed that the pixels correspond to lines of the stave.
[0099] Since the stems of notes extend vertically up and down on the sheet music, if the linked cells correspond to pixels that also extend vertically up and down on the digital image of the sheet music, then it is assumed that the pixels correspond to the stems of the notes. Since the size of the cells / pixels is greater than the threshold size, and the longest vertically oriented object in the sheet music is the stem of the note, it can again be assumed that the pixels correspond to the stems of the notes.
[0100] The values of the cells of the matrix identified as corresponding to pixels that are part of a note stem or a line of a staff can be updated to reflect that they correspond to a line of a staff or a note stem, i.e., a staff cell or a stem cell value, respectively. Alternatively, the values of these pixels are set to a value other than the first value, e.g., a value indicating that the cell corresponds to a pixel having a pixel intensity below a threshold intensity.
[0101] The coordinates of pixels or the coordinates of a bounding box determined to correspond to lines of a staff or stems of notes may be stored for use in: identifying musical symbols in a musical score; removing fragments from a digital image of a musical score; adjusting the page orientation of a digital image of a musical score or re-engraving a digital image of a musical score, as described below.
[0102] If after s307 the size does not exceed the size threshold, the method proceeds to step s308 where it is determined that the pixels corresponding to the linked cells of the set of chains do not correspond to lines of a staff or stems of notes.
[0103] Second aspect
[0104] A second aspect disclosed herein is a method of identifying lines of a musical stave in a digital image of a musical score.
[0105] The method of the second aspect works under the assumption that if a row of the digital image includes a large number of black pixels (or pixels with intensities above a threshold intensity), then the pixels in the row are part of a line of a musical staff, because a row including a line of a musical staff includes primarily black pixels, while a row including primarily white pixels will not include a line of a musical staff. Therefore, the method of the second aspect is based on determining the number of pixels with intensities above a threshold intensity in a row of pixels in the digital image of the musical score, and if the number of pixels is greater than the threshold number, determining that the pixel corresponds to a line of a musical staff.
[0106] The method of the second aspect will now be described in detail.
[0107] The digital image of the second aspect is the same as the digital image described above.
[0108] The digital image is converted into a matrix, wherein at least one cell of the matrix corresponds to a pixel of the digital image, and the at least one cell of the matrix is set to a first value if the pixel intensity of the corresponding pixel of the digital image is above a threshold intensity, as described above.
[0109] Next, the matrix is iterated to determine the total number of black cells in at least one row of cells. That is, the number of cells having a first value in a row of the matrix is determined. If the total number of cells having a first value in the row is greater than a threshold value, it is determined that the cells having the first value in the row of the matrix correspond to a line of the stave.
[0110] Optionally, the digital image may be reduced to a set ratio before being converted into the matrix to create a reduced digital image. For example, the digital image may be at least twice, and preferably four times, the reduced digital image. As will be appreciated, reducing the digital image may repair degraded portions of the digital image.
[0111] As the matrix is iterated through to capture the total number of black cells in a row, the maximum total number of black cells in a single row can also be determined during that iteration. Using the maximum total value, a threshold can be calculated. For example, the threshold can be 70% of the maximum total value. The black cell counts are then iterated row by row and verified against the threshold. For rows where the black cell count is greater than or equal to the threshold, it is assumed that the black cell corresponds to a pixel of a stave line.
[0112] Alternatively, the threshold value may be a fixed value or a percentage of the total number of cells per row, such as 60% of the total number of cells per row.
[0113] The third aspect
[0114] A third aspect disclosed herein is a method of recognizing at least a portion of a musical notation in a digital image of a musical score. Fig. 9 A flow chart showing the steps of the method is shown, and Fig.10 An example of a portion of the method is shown.
[0115] At step s901, if a corresponding pixel of the digital image has a pixel intensity above a threshold intensity, the digital image is converted into a matrix by setting one or more cells of the matrix to a first value as described above. Fig.10 A. Fig.10 B and Fig.10 C shows a reduced matrix, respectively, in which areas of similar cells can be seen, but the individual cells of the matrix cannot be distinguished. Instead of cells having numerical values, each area of cells having the same value corresponds to a colored area or a patterned area. The black area corresponds to the area of black cells, which correspond to pixels above a threshold intensity. The white area corresponds to the white cells, which correspond to pixels below a threshold intensity. The hatched area corresponds to the area of cells determined to correspond to the lines of the stave.
[0116] Fig.10 A shows a matrix with cells corresponding to notes 1001 in a musical score and lines 1002 of a stave.
[0117] At step s902, cells corresponding to line pixels are identified, where a line pixel is a stem of a note or part of a line of a stave in a digital image. This may be done according to the first or second aspect of the invention or by any other means known to the skilled person.
[0118] As an example, a line of a staff is identified according to the first aspect of the invention, wherein a staff cell corresponding to a line of the staff is also a cell corresponding to a line pixel.
[0119] Fig.10B shows cells that have been identified as lines 1008 of the staff represented by the hatched area. The identified cells also correspond to line pixels. Cells corresponding to pixels that are part of the identified line 1008 of the staff (hatched) are shown. The cell values of these cells have been updated accordingly to indicate that they are part of a line of the staff. If staff identification is performed as described in the first aspect above, the values of such cells are the described staff values.
[0120] exist Fig.10 As can be seen in , some cells correspond to pixels that are both part of a line 1002 of the staff and part of a note 1001, e.g. Fig.10 Some of the pixels highlighted by circles 1009 in A. Fig.10 B, the values of these cells are updated to indicate that they are part of a line of the staff. This leaves cells corresponding to the lower portion 1005 of the note, which do not correspond to the complete shape of the note 1001. The lower portion 1005 of the note is an example of an object. The term "object" refers to a group of directly adjacent cells having a first value, at least some of which are directly adjacent to cells corresponding to pixels that form part of a stem of a note or a line of the staff in the digital image of the musical score.
[0121] As previously explained, the values of the cells of the matrix corresponding to pixels that are part of a line of a staff may have staff values indicating that they are part of a line of a staff. If the lines of a staff are identified using the method of the first aspect described above, where a bounding box or minimum bounding box around a set of chains has been calculated, all cells falling within that bounding box or minimum bounding box may have their values updated as above. Alternatively, the values of all cells in the set of chains may be updated to indicate that they are part of a line of a staff.
[0122] At step s903, a "split end" of an object in the digital image of the musical score is identified. A split end comprises a group of cells directly adjacent to a stem of a note or a line of a stave, each cell in the group having a first value. The group of cells may be a line of cells or a straight line to a cell. An object may have one split end, or an object may have multiple split ends. For example, an object may have two split ends.
[0123] Now we will give an example of how to identify the split ends. This is done by parsing the matrix cells that have been set to either the staff value or the stem value, indicating that these cells correspond to the stem of a note or the line of a staff, respectively. A code example of the crawling path for each cell is given below.
[0124] int[,]ScanPathController=new int[,]{{-1,0},{0,1},{1,0},{1,0},{0,-1},{0,-1},{-1,0},{-l,0},{0,1}};
[0125] As mentioned earlier, the crawl path is Figure 7 As shown in Figure 7 As shown, starting from the central starting cell 701, the value of each cell around the starting cell 701 is read in sequence. In this case, a clockwise path from cell 1 / 9 to cell 2 to cell 3, etc., and then ending at cell 1 / 9 is described; however, any path can be used. Using this path theory, if the starting cell is a staff cell or a stem cell, and Figure 7 8 are black cells, then these cells correspond to the split ends, particularly the bottom split ends, and the cell values can be updated to the specific split end values. The split ends correspond to the bottom split ends because there are black cells above the split ends. The cell values are updated to indicate that these cells correspond to the split ends or the bottom split ends. In other words, the black cells in the row directly adjacent to the center start cell 701 correspond to the cells of the bottom split ends.
[0126] If cells 4, 5, and 6 are black cells, then these cells correspond to the rip ends, particularly the top rip ends, e.g., back to Fig.10 B, the top of the lower portion 1005 of the note, and these cell values may be updated to indicate that the cell corresponds to a particular split end value or a top split end. In other words, the black cells in the adjacent row below the central starting cell 701 correspond to cells for the top split end. The split end values for the bottom split end and the top split end may be the same or may be different.
[0127] Similarly, if Figure 7 If units 6, 7 and 8 are black units, then these units correspond to the split ends of the object, in particular to the right split end of the object; if units 2, 3 and 4 are black units, then these units correspond to the split ends of the object, in particular to the left split end of the object.
[0128] exist Fig.10 In the example shown in B, the pixels located at the top of the lower portion 1005 of the note that are directly adjacent to those pixels having stave values are identified as a split end or top split end. Fig.10 The example object of B has a top split end. Fig.21 An enlarged view of the cells in circle 1010 is shown in FIG, but rotated 90 degrees counterclockwise for clarity. The cross-hatched squares represent stave cells 2101 corresponding to pixels that are part of a line of the stave, i.e., they are Fig.10The black square represents the black cell 2103 and corresponds to the cell corresponding to the identification line 1008 of the stave in B. Fig.10 A portion of the lower portion 1005 of the note in B. The striped squares represent split-end cells 2102 of the note head portion 1005 that have been identified as split-ends, and therefore have a split-end value.
[0129] In order to determine a specific musical symbol or a portion of a musical symbol corresponding to the musical note 1001, it is necessary to repair the note head portion 1005. The term "repairing" refers to reconstructing the shape of a missing portion of an object, wherein the missing portion is a portion that overlaps or overlaps with the stem of the note or the line of the staff by adding at least one black cell (a cell having a first value) to the note portion in the overlapped or overlapping area.
[0130] exist Fig.10 In the example of B, the object (the cell corresponding to the lower portion 1005 of the note) has only a top split end, so at step s904, the top split end of the object is repaired to form a repaired object. The term "repaired object" refers to a group of directly adjacent cells having a first value that are adjacent to cells having a staff value or a stem value, wherein the cells having the staff value or the stem value are added to the group to be included as part of the repaired object. The group of cells to be included as part of the repaired object also includes cells identified as split ends.
[0131] In the case of a cleft end that is not opposite to another cleft end, e.g. Fig.10 The step of repairing the object to form a repaired object includes applying a dome fill to the top tear end. A "tear end that is not opposite another tear end" means that there is no second tear end on the opposite side of the note stem or the line of the staff directly adjacent to the first tear end when moving in a direction perpendicular to the note stem or the line of the staff.
[0132] like Fig.10 C, the top tear of the lower portion 1005 of the note has been repaired with a dome fill, resulting in a repaired note 1007 (repaired object). The size of the dome is based on half the height of the corresponding staff line. For example, the dome fill starts from a first side of the tear and creates a curved profile of cells with a first value based on half the height of the corresponding staff line (i.e., half the thickness of the staff line), which ends on a second side of the tear and reaches half the staff height. Therefore, the dome fill overwrites the values of those cells with staff values with the first value to create a repaired object. Such a dome fill can be applied to the bottom, left, or right tear in the same manner.
[0133] In some cases, the object may be bisected by note stems or staff lines, so that the resulting split ends include a top split end and a bottom split end. Fig.11 An example of a matrix is shown, where the cells correspond to the lines of a stave that divides a musical symbol into equal parts ( Fig.11 A). Fig.10 As shown, Fig.11 A reduced matrix is shown in which areas of similar cells can be seen, but the individual cells of the matrix cannot be distinguished. Instead of a numerical value, each area of the cell has a color or pattern representing the numerical value so that the relationship between the matrix and the corresponding digital image can be more easily seen. The area of black cells of the matrix corresponds to the area of pixels above a threshold intensity, while the area of white cells corresponds to the area of pixels below the threshold intensity. Fig.11 A shows a matrix corresponding to lines 1102 and notes 1101 of a staff. Fig.11 B shows a matrix corresponding to the identification line 1108 (cross-hatched), the note top portion 1104 and the note bottom portion 1105 of the staff. Fig.11 C shows the matrix corresponding to the repaired note 1107. It can be seen that some areas of the cells correspond to areas of pixels that are part of both the line 1102 of the staff and the note 1101, such as some of the cells highlighted by the circles 1109. Fig.11 In the example of , the previously described method can be used to identify the bottom split end of the note top portion 1104 and the top split end of the note bottom portion 1105. The top split end and the bottom split end, which are opposite to each other but slightly offset in this example, can be repaired by providing a diagonal fill in the shape of a trapezoid between the two split ends (described below), which replaces the value of the cell between the split ends and has a staff value of the first value. The result is a repaired note 1107. In other examples, the top split end and the bottom split end may not be offset, so the fill can be a square or rectangular fill between the split ends (described below).
[0134] Fig.12 An example of a matrix corresponding to a musical note 1210 is shown, which includes a note head 1201 and a stem 1203 (overlapping a plurality of lines 1202 of a staff) Fig.12 A). Similarly, Fig.12 Each of A, 12B and 12C is a reduced matrix in which regions of similar cells can be seen, but the individual cells of the matrix cannot be distinguished. Cells 1208 (cross-hatched) corresponding to a plurality of lines of the identified staves divide the note heads 1201 and stems 1203 to produce note head top portions 1204, note bottom portions 1205 and stem portions 1206, each having one or two split ends, namely a top split end and / or a bottom split end ( Fig.12B). In this case, all of these split ends can be repaired using the previously described method to form a repaired note 1211 including a repaired note head 1207 and a repaired note stem 1209 ( Fig.12 C). The pixel groups corresponding to the note head top portion 1204, the note bottom portion 1205 and the stem portion 1206 are examples of objects. Two split ends of separate stem portions directly opposite each other can be repaired with square fills.
[0135] If the split end is opposite to another split end, i.e., the split end is a bottom split end, and the bottom split end is directly opposite to the top split end, or vice versa, the split end can be repaired using square fill, which fills the space between the split ends with a square. If the split end is opposite to another split end but not directly opposite (i.e., offset), the split end can be repaired using diagonal fill, which fills the space between the split ends with a trapezoid.
[0136] Now refer to Fig.15 Give detailed instructions on how to repair the split end.
[0137] Fig.15 A, 15B and 15C show matrices before (top matrix) and after (bottom matrix) the tear end of the object has been repaired. Fig.15 The black squares in represent black cells corresponding to pixels whose pixel intensities are above a threshold value (i.e., they have a first value). The black cells are part of the object 1502. The white squares represent white cells 1501 corresponding to pixels whose pixel intensities do not exceed the threshold value (i.e., they do not have a first value). The dotted squares represent stave or stem cells 1503 corresponding to pixels that have been identified as part of a stave line or a stem of a note. The diagonally striped squares represent split-end cells corresponding to split ends 1504 of the object 1502 that includes the black cells.
[0138] Fig.15 A shows a split end unit that is part of a split end 1504 that is not opposite another split end. Therefore, the dome fill 1505 is used to repair Fig.15 A's Cleft 1504.
[0139] Fig.15 B shows two rows of split end cells that are part of split ends 1504 that are directly opposite each other. Therefore, the split end 1504 is repaired with a square fill 1506.
[0140] refer to Fig.15 C, the square with vertical stripes represents the split end unit of the first split end 1504a. The square with horizontal stripes represents the split end unit of the second split end 1504b, which is partially offset relative to the first split end 1504a. Therefore, Fig.15 C shows a matrix in which some cells of the first crack end 1504a are opposite cells of the crack end, while other cells of the first crack end 1504a are not opposite to another crack end. Therefore, the second crack end is repaired with diagonal filling.
[0141] When repairing a split end, identify the split end and its type, i.e., top split end, bottom split end, left split end, or right split end. Then, treat each split end separately as follows:
[0142] exist Fig.15 A, 15B and 15C show the first end of the split end 1507 and the second end of the split end 1508. It is determined whether there is a split end unit directly opposite to the first end 1507 or the second end 1508. That is, it is determined whether there is a split end unit 1504 on the opposite side of the line of the staff or the stem of the note 1503 across the vertically adjacent staff unit or the horizontally adjacent stem unit 1503 (i.e., in a direction perpendicular to the stem of the note or the line of the staff).
[0143] Fig.15 A shows a matrix corresponding to a line or stem 1503 of a note of a staff directly adjacent to a break 1507 on one side and the pixel intensity of the pixels on the other side is not greater than a threshold 1501. Therefore, neither end of the break 1504 is opposite another break, so a dome fill 1505 is applied as shown.
[0144] Dome filling will now be described. Depending on the type of break (top, bottom, left or right) and taking half of the corresponding staff line height or stem width, cells are assigned a first value (i.e. set to black cells) by iterating from the beginning to the end of the break in an increasing or decreasing manner to obtain a dome-like shape. The orientation of the dome is based on the type of break. Thus, dome filling overwrites the values of those cells that have staff values or stem values with the first value to create a repaired object.
[0145] If the first end 1507 and the second end 1508 of the split end 1504 are both opposite to the other split end 1504, such as Fig.15 B, then a square fill 1506 is applied as shown. The orientation of the square fill is based on the rip end type: the square fill 1506 will be below the bottom rip end but above the top rip end.
[0146] Square filling will now be described. Iteration is performed from the start point to the end point of the split, and all staff or stem cells located between the opposite split ends are set to the first value according to the staff line height. Thus, square filling overwrites the values of those cells having staff values or stem values with the first value to create a repaired object.
[0147] When one end is opposite to the other split end and the other end is not opposite to the other split end, for example, the first end 1507 of the first split end 1504a is opposite to the second split end 1504b, but the second end 1508 of the first split end 1504a is not opposite to the second split end 1504b. Fig.15 C, apply diagonal fill 1510 as shown.
[0148] Now refer to Fig.15 C describes diagonal filling. When a portion of the first split end 1504a is directly opposite to the second split end 1504b, such as Fig.15 In the area of C directly below the second split end 1504b but above the first split end 1504a, the same fill as the square fill is applied, i.e., all cells in the area are set to the first value. A triangle 1514 is formed between three staff / stem cells. These staff / stem cells are: staff / stem cell 1512 directly adjacent to the end of the second split end 1504b directly opposite to the first split end 1504a, staff / stem cell 1511 directly adjacent to the split end cell directly opposite to the end of the second split end 1504b, and staff / stem cell 1513 not directly opposite to the second split end 1504b but directly adjacent to the split end cell at the end of the first split end 1504a. Staff cells or stem cells falling within the triangle and corresponding to the edges of the triangle are set to the first value. Thus, the diagonal fill overwrites the values of those cells having staff values or stem values with the first value to create a repaired object. Therefore, in this case, the shape of the repaired portion of the repaired object is trapezoidal.
[0149] Once the split ends have been repaired, the split end cells are set to a first value, ie, to a black cell.
[0150] Alternatively, the size of the object may be determined, for example, by determining a bounding box of the object and determining the size of the bounding box. The size may be compared to an object size threshold, wherein the object is repaired only if the size is above the object threshold size.
[0151] At step s905, the repaired object is compared with a representation of at least a portion of the musical notation.
[0152] Examples of representations of a musical symbol are an image of a musical symbol, a portion of an image of a musical symbol, an outer contour or outline of a musical symbol, or any other representation of features of the musical symbol, or any other representation defining at least a portion of a musical symbol. The representation of a musical symbol may capture information about holes inside the musical symbol, i.e. the absence of black pixels.
[0153] Conventional template matching methods known to the skilled person can be used to compare the inpainted object with a representation of at least a portion of the musical notation. Alternatively, this can be done visually by a human. Reference will now be made to Fig. 22 The example flow chart shown presents an example method to achieve this goal by first creating an outline of the inpainted object and comparing it to a representation of the musical notation.
[0154] The contour of the inpainted object is any feature or set of features that represents the shape of the inpainted object. For example, the contour may be a cell corresponding to the contour of the inpainted object; a cell corresponding to all pixels of the inpainted object or a cell corresponding to all pixels within the contour of the inpainted object. The contour may capture information about holes inside the inpainted object, i.e., the absence of black pixels.
[0155] In this example, the outline of the repaired object is determined in step s2201. This can be called tracking. A predefined path theory can be applied to crawl through the repaired object to identify the outline of the repaired object. For example, the cells of the matrix derived from the digital image of the musical score take one of the following five values: white (cells corresponding to pixels with pixel intensities below a threshold), black (cells corresponding to pixels with pixel intensities above a threshold), staves or stems (cells corresponding to lines of a stave or stems of a note), and object outlines (cells forming the outline of the object). A code example of a crawling path is as follows:
[0156] int[,]ScanPathController=new int[,]{{-1,0},{0,1},{1,0},{1,0},{0,-1},{0,-1},{-1,0},{-l,0},{0,1}};
[0157] like Figure 7 As shown, starting with the central starting cell 701, the value of each cell around the starting cell 701 is read in turn in the same manner as previously described. In this case, a clockwise path from cell 1 / 9 to cell 2 to cell 3, etc., and then ending at 1 / 9 is described; however, any path can be used. Using this path theory, if the starting cell is a black cell and none of the cells around the starting cell have a first value, then the starting cell must be an object contour cell. Cells identified as object contour cells will be updated with the object contour value, otherwise their original value will be retained. Resolved cells can have their values updated to avoid re-resolving.
[0158] Fig.13B shows a matrix for a tracked object 1302, which includes an object contour cell region 1303 (represented by a cross-hatched region) surrounding a black cell region (represented by a black region). The corresponding matrix for an untracked object 1301 is shown in Fig.13 Shown in A. Fig.13 A and Fig.13 Each of the graphs in B is a zoomed-out matrix in which regions of similar cells can be seen, but the individual cells of the matrix cannot be distinguished.
[0159] In step s2202, the black cells inside the object contour cells are assigned fill cell values and are referred to as fill cells.
[0160] In step s2203, the contours (hole contours) of the inpainted object interior are identified. First, white pixels ("holes") are identified within the inpainted object interior. White cells within the object contour cells are parsed to identify hole contour cells, which are those white cells directly adjacent to fill cells and those white cells directly adjacent to object contour cells (if any). This is accomplished by analyzing cell values - white, contour, and fill - and using a predefined path described below:
[0161] Once a white cell is reached, the surrounding cells are crawled using a predefined path, such as the one described below.
[0162] int[,]ScanPathController=new int[,]{{-1,0},{0,1},{1,0},{1,0},{0,-1},{0,-1},{-1,0},{-l,0},{0,1}};
[0163] like Figure 7 As shown, starting from the central starting cell 701, the value of each cell surrounding the starting cell 701 is read in sequence. In this case, a clockwise path from cell 1 / 9 to cell 2 to cell 3, etc., and then ending at 1 / 9 is described; however, any path can be used. Using this path theory, if the starting cell is a white cell, and any cells around the starting cell have a fill cell value or an object outline value, then the starting cell must be a hole outline cell. Cells that are identified as hole outline cells will be updated with the hole outline value, otherwise their original value will be retained. Resolved cells can have their values updated to avoid re-resolving.
[0164] Fig.23 A matrix corresponding to a musical note 2301 with a hole 2302 as a repaired object is shown. Fig.24A matrix corresponding to the same note is shown, but object contour cells 2401 (represented by cross-hatched squares) and hole contour cells 2402 (represented by striped squares) have been identified. Fig.23 and Fig.24 In , black squares represent matrix cells having a first value (black cells), which correspond to pixels having a threshold value, while white squares correspond to white cells, which correspond to pixels not having a threshold value.
[0165] Since an object can have multiple holes inside, the above algorithm will continue to scan the object until all holes are identified.
[0166] In step s2204, the row and column values of the object contour cells, fill cells and hole contour cells are combined to determine the contour of the object. Alternatively, the contour may include the row and column values of a subset of the object contour cells, fill cells or hole contour cells, or in fact only one of them. For example, the contour may only include the row and column values of the object contour cells.
[0167] The above algorithm is applied to a single repaired object at a time.
[0168] In step s2205, the outline is compared to a representation of at least a portion of the musical notation. The outline may be converted to a format suitable for comparison with a representation of the musical notation in the same format. For example, the outline may be converted to a binary representation (a bitmap). The bitmap may be resized to fit a fixed resolution (e.g., 100 x 100 pixels) to maintain consistency of the match. To facilitate comparison, the representations of the musical notation may be in the same format.
[0169] This comparison or matching can be performed on a machine learning server in the cloud. To improve the performance of sending data to the cloud, the bitmap can be encoded using a run length encoding (RLE) algorithm. RLE is a form of lossless data compression in which data runs (i.e., sequences of occurrences of the same data value in many consecutive data elements) are stored as a single data value and a count rather than in the original run.
[0170] This encoded data can then be sent to a request queue in the cloud. A series of machine learning servers process this request and match the data with a representation of the musical notation, quantifying the similarity between the encoded data and the representation using conventional support vector machine methods.
[0171] The music symbol representation library can be prepared by training a machine learning server using training data. The methods of the first and third aspects disclosed herein can be used to create training data. Individually identified contours can be converted into 0 and 1 text data that directly represent the matrix. If the contours are converted from a bitmap of a fixed resolution (e.g., 100x 100 pixels), there will be 10100 (including carriage returns) single characters for each representation. It can be stored as a string rather than binary data so that it is easier to split and operate when training a machine learning server engine.
[0172] The results of the training data are used to pre-define musical characters, musical symbols, letters, numbers or any other shapes that may appear on the sheet music. This can be achieved by visually identifying the musical symbol corresponding to the object and mapping the musical symbol to the corresponding training data results. Newly identified shapes can be added to the library. The category of the object (for use when re-engraving the digital image of the sheet music as described below), the matching stage, template matching data, replacement fonts, etc. are also linked to the data set.
[0173] return Fig. 9 In the process shown, after the comparison between the repaired object and the representation of at least a portion of the musical notation is completed, at step s906, at least a portion of the musical notation corresponding to the repaired object is determined based on the comparison result.
[0174] This may include quantifying the similarity between the restored object or restored object outline (as described above) and the representation of the musical notation. For example, as will be appreciated by those skilled in the art, a probability value for a match may be determined, or any other descriptor that quantifies the similarity between the restored object or restored object outline and the representation of the musical notation. For example, if the similarity is above a similarity threshold, then it may be determined that the restored object corresponds to the musical notation. The similarity threshold may be a probability value threshold, such as 64%.
[0175] Alternatively, the repaired object or the repaired object outline can be compared to one or more representations of at least a portion of a musical notation. For example, the machine learning server can compare the repaired object or the repaired object outline to one or more representations of a musical notation. For example, multiple representations of musical notations can be stored in a representation library to which the repaired object or the repaired object outline is compared. The similarity between the repaired objects or the repaired object outlines can be quantified for each representation in the library. It can be determined that the repaired object corresponds to the musical notation with the highest similarity to the repaired object. This approach improves the accuracy of the comparison step.
[0176] The machine learning server engine can have a distributed architecture with a service bus and scalable server instances, where the core of the engine is a multi-class support vector machine with a polynomial kernel with a linear strategy. Every time a new contour is built, the training data and the corresponding contour can be provided through these engines. From the training data and the representation library, 10,000 separate features are generated for each mapped representation. The support vectors are then created and the learning content is cached. The engine then receives a matching request and makes a decision using a voting method. Based on the probability of this decision, the best results are compiled and sent back to the queue to be selected through the music symbol matching process.
[0177] Optionally, to avoid matching errors, the matched data can be delivered by conventional template matching. The template can be selected based on the matched classification. The classification and template can be configured in a training platform such as the above-mentioned training platform. Optionally, only when the template matching also gives a matching probability higher than the template matching probability threshold can it be determined that the object corresponds to the corresponding music symbol.
[0178] Optionally, isolated black pixels or isolated black pixel groups can be removed before determining the outline of the inpainted object. Isolated black pixels or isolated black pixel groups are pixels that are not in contact with the stave lines and are smaller than a threshold size (e.g., 175 pixels). They can be removed, for example, by setting them to a color that is the color of the digital image background (usually white or close to white) and with an intensity lower than a threshold intensity before determining the outline of the inpainted object, so that the outline of the isolated black pixels or isolated black pixel groups is not generated.
[0179] As mentioned above, a musical symbol may be composed of a part of a musical symbol. For example, notes (e.g., snare drum, trill, etc.) may be connected to each other by a beam, which is a part of a musical symbol. The note itself includes a stem and a note head, wherein the note head is a part of a musical symbol. Fig.16 A matrix is shown, the area of which corresponds to a double note 1601 comprising two quarter notes 1602, each quarter note having a note head portion 1607 and a stem 1603 connected together by a beam 1604. For clarity, the staff lines are not shown. Fig.16 A. Fig.16 B and Fig.16 C each shows a zoomed out matrix, in which areas of similar cells can be seen, but individual cells of the matrix cannot be distinguished.The method of the third aspect may be used to recognize at least a part of a musical symbol, which may be the entire musical symbol.
[0180] The identification of the stem unit area 1605 (corresponding to the cross-hatched area) may be achieved according to the method of the first aspect disclosed herein. Alternatively, the identification may also be performed visually by any other method known to the skilled person or by a human.
[0181] Corresponds to Fig.16 The adjacent unit area (represented by the black area) of the note head portion 1607 of B is an example of an object and has a split end directly adjacent to the area 1605 of the identified stem unit. The split end is the left split end. Fig.16 C, the split end may be repaired to form a repaired note head 1606. In this example, the split end has been repaired with a dome fill as described above.
[0182] Break notes connected by stems and other musical symbols (e.g., beams) to separate the connected notes into their individual note heads, as described above. Fig.16 This may improve the accuracy of comparing the repaired object with the representation of the musical notation (s905) and / or determining that the repaired object corresponds to the musical notation based on the comparison of the repaired object with the representation of the musical notation (s906).
[0183] The fourth aspect
[0184] A fourth aspect disclosed herein is a method of removing fragments from a digital image of a musical score, wherein the fragments are directly adjacent to a line of a stave or a stem of a note. Fig.14 A flow chart of a method for identifying fragmented pixels of a digital image of a musical score is shown in FIG.
[0185] The term "fragment" refers to a pixel in a digital image of a musical score that does not correspond to a musical symbol, a line of a staff, or a stem of a note. In particular, a fragment may refer to one or more pixels directly adjacent to a line of a staff or a stem of a note, wherein the pixel does not correspond to at least a portion of a musical symbol. A fragment may also refer to a plurality of pixels that are directly adjacent to a line of a staff or a stem of a note but are not identified as part of a line of a staff or a stem of a note using the method of the first aspect or the second aspect described above. In other words, a fragment includes any element in a digital image that is unintentionally present adjacent to a line of a staff or a stem of a note. Such a fragment - in Figure 1An example of this type of debris can be seen on line 101 of the staff in FIG - making the edges of the staff lines or note stems appear rough or uneven rather than smooth. Creating a digital image of the sheet music from the original sheet music can result in debris due to scanning problems, degradation, bleed marks, and other unexpected artifacts. When creating an image from the sheet music, debris can also be caused by markings on the original sheet music such as thumbprints, stains, smudges, and other unexpected markings that can be incorporated into the digital image. Figure 1 The points 105, 107 in FIG. 1 are examples of fragments and isolated pixels / pixel groups that are not adjacent to the lines of a staff or the stems of a note.
[0186] Now refer to Fig.14 and Fig.17 A method for removing debris from a digital image of a musical score is provided. Fig.17 A. Fig.17 B and Fig.17 C each shows a zoomed-out matrix in which regions of similar cells can be seen, but individual cells of the matrix cannot be distinguished. Black regions represent regions of black cells, and white regions represent regions of white cells. Fig.17 A shows the area of the cell corresponding to the line 1701 of the musical staff. The line 1701 of the musical staff is degraded, for example, due to scanning problems when preparing a digital image of the musical score. As a result, the line 1701 of the musical staff has fragments 1702 at its edges.
[0187] In step s1401, cells corresponding to pixels of a line of a stave or a stem of a note in a digital image are identified. This may be done according to the first aspect or the second aspect or any other method described previously. Such pixels may be referred to as line pixels. Fig.17 B shows the area of the staff unit corresponding to the identification line 1703 of the staff (cross-hatched area).
[0188] In step s1402, one or more cells adjacent to a cell corresponding to a line of a stave or a stem of a note are identified. The identified cells correspond to pixels having a color different from the background color of the digital image (the background is typically white). Thus, the identified cells correspond to pixels having intensity values that are different from the values of pixels having the background color of the image. Thus, the identified cells may, for example, have a first value (i.e., a black pixel).
[0189] In addition, the identified cells exclude cells corresponding to stave lines or note stems. Therefore, the cells also have values different from stave cell values or note stem cell values. The identified cells are directly adjacent to those cells corresponding to stave lines or note stems. As an example, Fig.17The identified cell 1704 of B is directly adjacent to the identified line 1703 of the staff.
[0190] An example of how to identify one or more cells directly adjacent to a line of a staff or a stem of a note will now be described. Cells 1704 directly adjacent to a line of a staff can be identified by crawling through the outline of the identified line 1703 of the staff. First, the outline of a line of a staff or a stem of a note is identified, for example, according to the first aspect disclosed herein. Therefore, the cells within the outline will have a staff value. Next, cells directly adjacent to the outline of a line of a staff or a stem of a note with a first value are identified. This is achieved by analyzing cell values - for example, outlines, staffs, and neither outlines nor staffs - and using the predefined path described below:
[0191] Once a contour cell is reached, the surrounding cells are crawled using a predetermined path such as the path described below.
[0192] int[,]ScanPathController=new int[,]{{-1,0},{0,1},{1,0},{1,0},{0,-1},{0,-1},{-1,0},{-l,0},{0,1}};
[0193] like Figure 7 As shown, starting from the central starting cell 701, the value of each cell around the starting cell 701 is read in sequence. In this case, a clockwise path from cell 1 / 9 to cell 2 to cell 3, etc., and then ending at 1 / 9 is described; however, any path can be used. Using this path theory, if any cell around the starting cell (contour cell) has a first value, the cell with the first value will be assigned a fragment value, indicating that the cell may correspond to a pixel that is a fragment. Otherwise, all cells retain their original values. The values of resolved cells can be updated to their corresponding resolved values to avoid re-parsing.
[0194] Cells that are identified as having a fragment value that are directly adjacent to a line of a staff or a stem of a note may be part of a group of cells.
[0195] The set of cells may be a straight line of directly adjacent cells that extends away from the line of the stave or the stem of the note (i.e., vertically or horizontally, respectively). If the length of such a line of cells is large, this would indicate that the line of cells corresponds to pixels that are part of a musical symbol, as described above with reference to the third aspect disclosed herein. On the other hand, if the length of such a line is small, this indicates that the line corresponds to pixels that are fragments, and it is desired to remove the entire line of pixels from the digital image.
[0196] Thus, in step s1403, the length of the line of directly adjacent pixels extending away from the line of the staff or the stem of a note is determined.
[0197] The length of a straight line of directly adjacent pixels extending away from a line of a staff or a stem of a note can be determined by determining whether there is a cell having a first value that is adjacent to the identified cell having a fragmentation value in a direction away from the line of the staff or the stem of a note. For example, if the identified cell is above a line of the staff, it is determined whether the cell directly above the cell having the fragmentation value has the first value. If so, the cell is provided with a fragmentation value and the process is repeated to determine whether the next cell directly adjacent to the newly identified fragmentation cell along the straight line also has the first value. This process is repeated until a cell is identified that does not have the first value.
[0198] Alternatively, in step s1403, a set of directly adjacent cells (which may not be a straight line) including the identified cell having the fragmentation value may be determined. The set of directly adjacent cells includes all cells having the first value that are connected to the identified cell having the fragmentation value through cells having the first value, and the set of directly adjacent cells includes cells having the first value that are directly adjacent to the identified cell. As will be appreciated, the crawling method disclosed herein may be used, mutatis mutandis, to determine cells that belong to a set of directly adjacent cells. Cells that belong to a set of directly adjacent cells may have their cell values updated to the fragmentation value.
[0199] At step s1404, the size of one or more cells or a group of cells or lines of cells having a fragmentation value is determined. To determine the size, the total number, total area, maximum height or maximum width of the cells or a group of cells or the length of a line of fragmentation cells is determined. Optionally, the minimum bounding box of the cells is determined. Thus, the size may be the total number, total area, maximum height, maximum width or the size of the minimum bounding box.
[0200] In step s1405, the size of step s1404 is compared to a fragmentation threshold size. The fragmentation threshold size sets an upper size limit below which identified cells with that size (total area, total number, total height, total width, or minimum bounding box size) are considered to correspond to fragmentation pixels. The fragmentation threshold size may be, for example, a total number of 175 cells or a total length of 3 cells.
[0201] Thus, if the size is below the debris threshold size, the identified cells having that size are determined to correspond to debris, and the cells are set to a value such that when the matrix is converted to a digital image, the color or intensity of the corresponding debris pixel is the color or intensity of the digital image background. For example, the cell may be assigned a white cell value. If the size is above the size threshold, the cell value of the identified cell may be set to a first value.
[0202] The matrix can be converted to a new digital image by first creating a blank digital image with the same dimensions as the matrix. For example, if the matrix has 1000 x 1000 cells, the new digital image may have 1000 x 1000 pixels. Each pixel of the new digital image may correspond to a cell of the matrix. The intensity or color of the pixels of the new image is then set to a value corresponding to the cell value of the matrix. For example, pixels corresponding to white cells may be set to white, which may be the background color of the new image. Pixels corresponding to black cells may be set to black. Thus, cells identified as corresponding to debris may be set to white cells so that when the matrix is converted to a digital image, the corresponding pixels are the same color as the background of the image.
[0203] Alternatively, in place of steps s1403, s1404 and s1405, the identified one or more cells having fragment values may be determined to correspond to fragment pixels and set to a value such that when the matrix is converted into a digital image, the one or more fragment pixels have a color that is the color of the background of the digital image, as described above.
[0204] Fifth Aspect
[0205] A fifth aspect disclosed herein is a method of adjusting the angle of a digital image of a musical score to remove tilt.
[0206] The term "tilt" is defined as the average angle between the lines of the staves in the digital image of the musical score and the bottom edge of the image of the musical score (which is a straight line).
[0207] When creating a digital image (a digital image of a musical score or an improved digital image of a musical score), for example, by scanning an original musical score, the image may be tilted if, for example, the original musical score was scanned at an angle. The resulting digital image may be less aesthetically pleasing and more difficult to read than a digital image that is not tilted. Therefore, it is desirable to correct the angle of the digital image by removing the tilt (making the tilt equal to zero degrees).
[0208] Lines of a stave in a digital image of a musical score are identified, wherein each line may be identified according to the method of the first aspect or the second aspect disclosed herein.
[0209] The angle of each identified line of the musical staff is calculated relative to the bottom edge of the digital image of the musical score.
[0210] The commonality of angles is calculated to determine a common angle, such as a median angle or a mean angle.
[0211] The digital image of the musical score is rotated by a common angle using conventional means to remove the tilt from the digital image.
[0212] The sixth aspect
[0213] A sixth aspect disclosed herein is a method of re-engraving a digital image of a musical score.
[0214] Re-engraving a digital image of a musical score is the process of identifying elements in the digital image and then creating a new file or new digital image that includes new elements that correspond to the original elements in the original digital image. The shapes of the new elements are similar to the shapes of the elements in the original digital image, although not necessarily identical, as the new elements may be better defined and less degraded than the original elements, or the shapes of the new elements may have variations in style in a manner that is stylistically different from letters in a different font but still conveys the same meaning. At the end of the re-engraving process, a new image or digital file encoding the properties and locations of the new elements is created. The file can be read in order to display an image that corresponds to the original digital image.
[0215] Now refer to Fig.25 The flowchart of the invention describes a method for re-engraving a digital image of a musical score.
[0216] In step s2501, the lines of a stave in a digital image are identified according to the method of the first aspect disclosed herein. Figure 3 steps.
[0217] In step s2502, one or more musical symbols in a digital image are identified according to the method of the third aspect disclosed herein. Fig. 9 steps.
[0218] In step s2503, the positions of the lines of the staff and the musical symbols are determined, including their size and orientation. These positions are easy to determine because the matrix contains cells with staff values, stem values and repaired object values.
[0219] In step s2504, a digital file is created that includes data defining the position of the lines of the stave and the musical symbols. The position may be an absolute position or a relative position. When defining the position of the lines of the stave and the musical symbols, the file also includes data encoding the shapes of the lines of the stave and the musical symbols. The digital file may be an image file, such as a bitmap (.bmp), jpeg, graphics interchange format (.gif), tagged image file format (.tiff), or portable network graphics (.png) file; a file containing vectorized image data, such as a portable document format (.pdf) file; a proprietary format; or any other file type that includes data defining the position of the lines of the stave or the stems of the notes and the musical symbols. Based on the previous information, a skilled person will understand how to define the positions and shapes in a digital file.
[0220] Now refer to Figure 1 , Figure 2 and Fig.18 An example of a method for re-engraving a digital image of a musical score is given. Fig.18 Shows Figure 1 A musical score in which a line 101 of a staff has been identified as a line of a staff. An identified line 1801 of a staff is shown (cross-hatched). This is achieved using the method of the first aspect disclosed herein. A note 103 has also been identified as an example musical symbol. Fig.18 An identified note 1802 (cross-hatched) is shown in . This is achieved using the method of the third aspect of the invention.
[0221] The coordinates of the lines of the stave and the musical symbols within the digital image are determined. The coordinates may be determined based on the coordinates of the pixels or corresponding matrix cells of the lines of the stave and the musical symbols.
[0222] As will be appreciated by those skilled in the art, a digital file is created that includes vectorized data defining the positions of the lines of the stave or the stems of the notes and the musical symbols.
[0223] When viewing a digital file, you see Fig.19 Such an image includes all the recognized objects, in this case, all the recognized objects are Fig.18 An identification line 1801 and an identification note 1802 of the staff in FIG. Fig.19 Shown is a re-engraved line 1901 of the stave, corresponding to the re-engraved line 1901 of the stave Figure 1 Line 101 of the stave ( Fig.18 and re-engraved musical notes 1902, the re-engraved musical notes 1902 corresponding to Figure 1 Note 103 ( Fig.181802).
[0224] The foregoing method may be used to identify more than one stave and / or musical symbol, determine their location and add them to the digital file. For example, Figure 1 All the lines of the stave and all the musical symbols in the stave are identified, their positions are determined, and a digital file including data defining the positions of the lines of the stave and the musical symbols can be created. When viewing the generated digital file, it can be found in Figure 2 See examples of the resulting images in Figure 2 middle, Figure 1 All the lines and musical symbols of the staves in have been re-engraved. Figure 2 Re-engraved lines 201 , re-engraved note heads 202 , re-engraved flat symbols 203 , re-engraved stems 204 , and re-engraved decrement symbols 205 of the staff are shown.
[0225] Optionally, objects that are not recognized as stave lines, note stems, or musical symbols (including objects whose similarity above a similarity threshold cannot be determined) can be copied and added to the digital file. Such objects can be manually inspected to determine whether such objects should be added to the digital file. Such objects can be converted into a vector image format.
[0226] Optionally, the page orientation of the digital image of the musical score may be adjusted according to the fifth aspect disclosed herein.
Claims
1. A method for identifying the stems of staves or musical notes in a digital image of a musical score, the method comprising: converting the digital image into a matrix, wherein at least one cell of the matrix corresponds to a pixel of the digital image; If the pixel intensity of the corresponding pixel of the digital image is higher than a threshold intensity, setting the cell in the matrix corresponding to the corresponding pixel to a first value; identifying neighboring cells having the first value as linked cells, the neighboring cells corresponding to pixels that are adjacent in one of a horizontal direction or a vertical direction of the digital image; identifying linked cells whose number of cells exceeds a threshold as a cell chain; Grouping adjacent chains of units into chain groups; determining a size of the chain set; as well as comparing the size to a size threshold; Wherein, if the size is greater than the size threshold, then when the adjacent units correspond to pixels adjacent in the horizontal direction of the digital image, the pixels corresponding to the linked units of the chain group are determined to correspond to the lines of the staff; or when the adjacent units correspond to pixels adjacent in the vertical direction of the digital image, the pixels corresponding to the linked units of the chain group are determined to correspond to the stems of the musical notes.
2. The method according to claim 1, wherein: The adjacent unit is an immediately adjacent unit corresponding to a pixel immediately adjacent to one of the horizontal direction or the vertical direction.
3. The method according to claim 1 or 2, wherein: The adjacent cell chains are directly adjacent cell chains.
4. The method according to claim 3, wherein: The directly adjacent cell chains are directly adjacent in the other of the horizontal direction or the vertical direction.
5. The method according to claim 1 or 2, further comprising: A contour cell of the chain group is identified, wherein the contour cell defines a perimeter of pixels of the chain group.
6. The method according to claim 1 or 2, wherein: Determining the size of the chain group includes determining the size of a bounding box surrounding the chain group.
7. The method according to claim 1, further comprising: identifying cells of the matrix corresponding to line pixels corresponding to lines of the stave and / or stems of the musical notes in the digital image; identifying a split end of an object in the digital image, wherein the split end includes cells having the first value and directly adjacent to cells identified as corresponding to line pixels; adding at least one cell having the first value to the split end of the object to create a repaired object, the repaired object comprising the added at least one cell and the object, the at least one cell being directly adjacent to the split end of the object; determining a match value for the repaired object by comparing features of the repaired object to features of the representation of at least a portion of a musical notation; If the match value exceeds a match threshold, determining that the repaired object corresponds to at least a portion of a musical notation; and A digital file is created, the digital file containing data corresponding to the lines of the stave or the stems of the notes, and the musical symbols.
8. The method according to claim 7, further comprising: identifying one or more cells having the first value that are adjacent to a cell corresponding to a line of pixels; The one or more cells are determined to correspond to fragment pixels and the values of the cells are set so that when the matrix is converted into a digital image, the color of the one or more fragment pixels is the color of the background of the digital image.
9. The method according to claim 7 or 8, wherein: The line pixels correspond to lines of the musical stave in the digital image, the method further comprising: After identifying cells of the matrix corresponding to line pixels, determining an angle between the line of the stave and an edge of the digital image, the edge being a top edge, a bottom edge or a side edge; The digital image is rotated by an angle to adjust the page orientation of the digital image.
10. The method according to claim 1, wherein: Prior to converting the digital image into a matrix, the pixel density of the digital image is increased.
11. The method according to claim 1, further comprising: identifying two diagonally connected cells having said first value; identifying weakly linked cells, wherein the weakly linked cells are cells that are directly adjacent to both of the diagonally connected cells; and The weakly linked cell is set to the first value.
12. The method according to claim 11, wherein: The cell value of the weakly linked cell is equal to the cell value of the cell corresponding to the background color of the digital image.
Citation Information
Patent Citations
Music note primitive segmentation method based on music note knowledge and double projection method
CN101944180A
Music score recognition method
CN103646247A
Stave playing system based on image recognition technology
CN105022993A
Method and apparatus for recognizing score image
CN106446952A
Musical score automatic recognition device
JP1998228519A
