1

I have developed a cluster of object detectors and now I want to use RabbitMQ to exchange messages between this cluster and the cameras themselves.

What I am trying to do is send the camera frames to the detector and the detector will reply to the cameras the content of the image.

As the content of what RabbitMQ sends has to be text only, I couldn't find a clear/good way to send the OpenCV images (I am using Python for that, so it's a np.ndarray) from the camera up to the cluster.

There were a couple of approaches that I found, but it usually transforms the image into a base64 string. The problem with that is that the images are usually really high resolution and take more time to convert the image to base64 back and forth than actually applying the objector itself. I am trying to make the process as efficient as possible on the message exchange/conversion.

The other approach I have seen was saving the image locally and only sending the image path, but what I am trying to do is consolidate every communication using RabbitMQ only.

John Lucas
  • 65
  • 1
  • 6
  • 3
    Not really sure what sort of answer you expect? You insist on using a text-only protocol to transfer something that isn't text while declining to convert it to text. Something's got to give! – Mark Setchell Jan 07 '19 at 22:41
  • What would you recommend then? – John Lucas Jan 07 '19 at 22:54
  • 1
    `np.ndarray <=( cv2.imencode| cv2.imdecode) => buff <==> base64` – Kinght 金 Jan 08 '19 at 00:59
  • Personally, I would probably run up a small Redis instance on the most appropriate node and cache all the images there in binary... along these lines https://stackoverflow.com/a/54037596/2836621 – Mark Setchell Jan 08 '19 at 10:25
  • Not sure why you say that data in RabbitMQ message has to be text - that is not a restriction imposed by the MQTT protocol. See e.g. https://stackoverflow.com/questions/22070639/sending-binary-file-through-rabbitmq – DisappointedByUnaccountableMod Jan 08 '19 at 19:24

0 Answers0