CN-120431562-B - Key recognition method based on key joint, intelligent musical instrument, equipment and medium
Abstract
The application relates to the field of performance digitization, in particular to a key identification method based on key slits, an intelligent musical instrument, equipment and a medium. The method comprises the steps of obtaining a first view image, intercepting first partial images of areas where a plurality of second keys are located from the first view image according to key image areas where the first keys are located, identifying a plurality of initial inter-key gaps between adjacent second keys in the first partial images, performing morphological operation on the initial inter-key gaps to obtain a target partial image, and identifying a plurality of second keys from the target partial image, wherein the morphological operation comprises the steps of obtaining target second keys adjacent to the initial inter-key gaps to be processed, updating setting parameters of structural elements based on perspective deformation parameters of the target second keys, and performing morphological operation on the initial inter-key gaps to be processed based on the updated structural elements. The double optimization of the efficient utilization of the computing resources and the identification precision is realized, and the anti-interference performance of the identification is effectively improved.
Inventors
- GAO JIAN
Assignees
- 五线宏音(重庆)科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20250508
Claims (9)
- 1. A key recognition method based on key slits, the method comprising: S401, acquiring a first view image, wherein the first view image comprises a plurality of keys of one type and images corresponding to the keys of two types; S402, based on the preset position relation between the keys of the first class and the keys of the second class, according to the key image area where the keys of the first class are positioned, first partial images of areas where the keys of the second class are positioned are intercepted from the first view image; S403, identifying a plurality of initial inter-key gaps between adjacent keys in the first partial image, and executing morphological operation on the initial inter-key gaps in the first partial image to obtain a target partial image; S404, identifying a plurality of keys of the second class from the target partial image based on a third preset model; Wherein the morphological operation comprises the steps of: s4031, acquiring at least one target class II key adjacent to the gap between the initial keys to be processed, and updating the setting parameters of the structural elements based on the perspective deformation parameters of the target class II keys; s4032, performing morphological operation on the gap between the initial keys to be processed based on the updated structural elements; The setting parameters of the structural element include a long axis direction, a long axis length, and a short axis length, and the method further comprises: Obtaining perspective deformation parameters of the target class II keys, wherein the perspective deformation parameters comprise shrinkage proportion and/or shrinkage direction; Determining the long axis direction of the structural element based on the contraction direction, and/or, And determining the major axis length and the minor axis length of the structural element according to the target morphological parameters of the target class II keys.
- 2. The method according to claim 1, wherein said S403 comprises: According to the color information of a plurality of pixel points in the first partial image, identifying the outlines of a plurality of the second class keys from the first partial image; identifying a plurality of candidate inter-key gaps between the two types of keys from the first partial image; The method comprises the steps of obtaining at least one adjacent type of keys adjacent to a gap between candidate keys, and determining a gap inclination threshold value of the adjacent type of keys according to longitudinal contours of the adjacent type of keys based on preset angle constraint; And when the inclination angle of the candidate inter-key gap meets the gap inclination threshold, taking the corresponding candidate inter-key gap as the initial inter-key gap.
- 3. The method according to claim 1 or 2, further comprising, after S402, performing a preset thresholding on the first partial image and performing a first filtering operation to suppress image noise of a first modality, or And executing a first filtering operation on the first partial image to inhibit image noise of a first form, and performing preset threshold processing.
- 4. The method according to claim 1, wherein the preset positional relationship of the one type of key and the two types of keys is a shape ratio or an area ratio of the one type of key and the two types of keys.
- 5. The method according to claim 1, wherein the method further comprises: Expanding the boundary of the gap between the initial keys based on the updated structural elements so as to fill the internal holes or the fracture parts of the gap between the initial keys to obtain a second partial image; And based on the updated structural elements, contracting the boundary of the initial inter-key gap in the second partial image to eliminate burr noise and linear noise of the initial inter-key gap, thereby obtaining the target partial image.
- 6. The method according to claim 1, wherein the method further comprises: Acquiring at least one near-end inter-key gap with the perspective deformation parameter lower than a first deformation threshold value, and determining a reference morphological parameter of the inter-key gap based on the morphological parameter of the at least one near-end inter-key gap; Acquiring at least one far-end inter-key gap with the perspective deformation parameter higher than a second deformation threshold, wherein the first deformation threshold is smaller than or equal to the second deformation threshold; adjusting the reference morphological parameters of the gaps between the keys based on the perspective deformation parameters of the gaps between the remote keys, and determining the target morphological parameters of the gaps between the remote keys; and adjusting the outline of the corresponding gap between the remote keys according to the target morphological parameters of the gap between the remote keys.
- 7. A smart musical instrument, the smart musical instrument comprising: the image acquisition module is used for acquiring a first visual field image, wherein the first visual field image comprises a plurality of keys of one type and images corresponding to the keys of the second type; A memory for storing a computer program; a processor for executing the computer program and implementing the key recognition method based on keyways as claimed in any one of claims 1 to 6 when the computer program is executed.
- 8. A computer device, the device comprising: A memory for storing a computer program; a processor for executing the computer program and implementing the key recognition method based on keyways as claimed in any one of claims 1 to 6 when the computer program is executed.
- 9. A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program which, when executed by a processor, causes the processor to implement the key recognition method based on key slots as claimed in any one of claims 1 to 6.
Description
Key recognition method based on key joint, intelligent musical instrument, equipment and medium Technical Field The application relates to the field of performance digitization, in particular to a key identification method based on key slits, an intelligent musical instrument, equipment and a medium. Background Along with the development of science and technology, the digital expression forms of music and art are more and more abundant, and the method has wide application prospects in the fields of education, entertainment, virtual reality and the like. Among them, the key recognition technology is a core technology in the fields of music teaching, performance assistance, intelligent musical instrument development, etc., and its core objective is to detect key positions and states through sensors or vision systems. For example, the invention patent application with the application publication number of CN111695499A discloses a key identification method, a device, electronic equipment and a storage medium, wherein the method comprises the steps of collecting a first keyboard image of a target musical instrument, wherein a black key and a white key are arranged on a keyboard of the target musical instrument, inputting the first keyboard image into a preset image identification model to determine the outline of each black key in the first keyboard image, and determining the key range corresponding to each octave in the first keyboard image and the outline of each white key in each octave according to the outline of each black key and the interval between adjacent black keys. For another example, the Chinese patent application publication No. CN 113723264A discloses a method for intelligently identifying play errors for assisting piano teaching, which comprises acquiring a 2D image of an player piano including a full piano keyboard from above the piano keyboard, performing object detection on the 2D image through a piano keyboard detection network to detect a piano keyboard region expressed in relative position coordinates of the 2D image, and obtaining piano keyboard position coordinates under original coordinates of the 2D image through conversion. However, in practical application, the vision system is in a complex or dynamic environment, and fluctuation of ambient illumination conditions, background interference and target mixing all cause significant degradation of recognition accuracy, resulting in limited reliability in practical application. Disclosure of Invention The application mainly aims to provide a key identification method based on key joints, an intelligent musical instrument, equipment and a medium. In order to solve the technical problems, the application adopts the following technical scheme: A first aspect of the present application provides a key identification method based on key slots, the method comprising: S401, acquiring a first view image, wherein the first view image comprises a plurality of keys of one type and images corresponding to the keys of two types; S402, based on the preset position relation between the keys of the first class and the keys of the second class, according to the key image area where the keys of the first class are positioned, first partial images of areas where the keys of the second class are positioned are intercepted from the first view image; S403, identifying a plurality of initial inter-key gaps between adjacent keys in the first partial image, and executing morphological operation on the initial inter-key gaps in the first partial image to obtain a target partial image; S404, identifying a plurality of keys of the second class from the target partial image based on a third preset model; Wherein the morphological operation comprises the steps of: s4031, acquiring at least one target class II key adjacent to the gap between the initial keys to be processed, and updating the setting parameters of the structural elements based on the perspective deformation parameters of the target class II keys; S4032, performing morphological operation on the initial inter-key gaps to be processed based on the updated structural elements. A second aspect of the present application is to provide a smart musical instrument comprising: the image acquisition module is used for acquiring a first visual field image, wherein the first visual field image comprises a plurality of keys of one type and images corresponding to the keys of the second type; A memory for storing a computer program; and a processor for executing the computer program and implementing the steps of the key identification method based on key slot provided by any embodiment of the application when executing the computer program. A third aspect of the present application provides a computer apparatus, the apparatus comprising: A memory for storing a computer program; and a processor for executing the computer program and implementing the steps of the key identification method based on key slot provided by an