Detect string and fret indexes on guitar fretboard

asked 2019-02-20 04:14:45 -0500


I'm trying to use opencv to detect frets and strings on guitar fretboard and be able to index and display some kind of information on them, like on the attached screenshot.

Here are requirements I'd like to comply with:

  • I'd like it to run it in realtime ( minimum 30fps ) on mobile
  • The whole fretboard will be visible and will not be occluded in any way
  • Neck and guitar body will be visible at least partially (I'm thinking about using them as corners)
  • I don't want to use paper markers or anything like that
  • I'd like to be able to display 3d objects on certain fret / string, for example, display a small box on fret 1, string 5
  • Fretboard might be presented with a slight angle

Is something like that feasible ? Could you please point me an effective way to approach this problem ? Which algorithms methos will be best to approach this ?

Please check the attached screenshot to see exactly what I'm talking about.


edit retag flag offensive close merge delete


First try to detect the 6 strings and the frets with linear Hough transform.

Apply HoughLines(tutorial) to your image and tune the parameters until the needed lines are detected.

Then, try to identify the strings (6 lines with the same orientation and equal distances), and the frets (perpendicular to the strings and the distance decreases logarithmically, if I'm right - I'm not a guitar player).

If you do this, it will be a good starting point on identifying the positions on the fretboard.

This won't work in real time at the moment, but with some optimizations I could achieve 10-15fps on a Raspberry Pi 3 (it has a processor similar to the mobile phones) with the hough line detection.

kbarni gravatar imagekbarni ( 2019-02-20 05:24:23 -0500 )edit

This sounds promising, thank you !

deckard_cain gravatar imagedeckard_cain ( 2019-02-20 05:36:19 -0500 )edit