I am trying to send a sequence of images from a "master" pi to two other pis on the same network. Each "slave" pi will need to receive a different image from the "master" pi but the two images will need to be displayed simultaneously on both of them for a few seconds each (it's a kind of stereoscope so one pi will display the "left eye" image and the other will receive the "right eye" image). I am using python opencv to display the images.

Sending the image on both pis is not a problem as I have achieved that using sockets but the problem is that the images quickly get out of sync, perhaps because the loops used to display the images on each pi don't start or finish at the same time or perhaps because the images are not sent at the same time from the master pi. Using threads on the master pi to minimise sending delay do not seem to resolve the problem. I was wondering whether anyone has implemented something similar and if anyone has any suggestions on how to sync the displays?

  • Try to fist send the images from the master, store them on the slaves and then after both raspberries have their images, have the master send/broadcast a command with which image pair the slaves to display. In this way the master will track the intervals. – GramThanos Feb 11 '19 at 9:04
  • This seems like it could work, I will work with it and post the results. Thanks for the suggestion. – Socrats Feb 12 '19 at 16:43
  • 1
    @GramThanos I have made the setup simpler by making the images into Web resources thus making them available to all Pis in the network as URLs. A simple protocol was designed where the master pi sends a "transmit" packet instructing each of the "slave" pis to start loading the images into memory with each of them sending an acknowledgment packet back to it when done. Once the master pi receives acks from all pis it starts sending a "tick" signal at regular intervals which acts as a clock. I have achieved display rates of 5 fps with no drift which is what I was aiming for. Thanks! – Socrats Feb 28 '19 at 20:05
  • Good job! I am glad I could help a little :P – GramThanos Mar 1 '19 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.