I'm not an expert on this.
I did some googling myself and found this video
It uses an Raspberry Pi Model B and Python.
So well I was to pessimistic a Raspi 4 can do it.
I second what JML suggested the Raspi does the optical recognition and should communicate with the Arduino
I just took a quick look. I have no ida of what quality this particular project is.
best regards Stefan