Converting FSM into code

I have to convert a finite state machine .png/.jpg image into a code. I am stuck at how to parse through the image and see the directions of the arrows to determine the states. I want to write an automation code to convert FSM into a code. Please help me on how to start about this.

please read about things first (google is your friend !)
then ask things specific to opencv here.

(sorry, but so far, this is a dreaded ‘i want’ question, showing no own research at all)

Thank you, have a nice day :slight_smile: