valkjsaaa / Unity-ZeroMQ-Example

An example of Unity 3D 2017 works with NetMQ
79 stars 28 forks source link

Example for sending images from Unity to Python #6

Open Guidosalimbeni opened 6 years ago

Guidosalimbeni commented 6 years ago

I wonder if you could provide also an example of how to send an image from Unity to python (for example a render from the camera view in unity to python). That would be great thanks

bc commented 5 years ago

did you ever figure it out @Guidosalimbeni ?

Terminou commented 4 years ago

Need the solution as well. Have you ever figured it out? @bc @Guidosalimbeni

bc commented 4 years ago

Didn’t end up needing it. You just have to serialize the file as a string (like base64), send it as a normal message, and then in python decode the string back. zmq just uses strings to send messages (or bytes), so if you can turn whatever you want it to a string, you can send it

Terminou commented 4 years ago

@bc Do you have an example code? I could not figure out though I've tried everything :)

bc commented 4 years ago

Here are the pieces:

  1. C# save a picture from the device camera
  2. C# load that file as a base64 string
  3. C#: send that string to your ZMQ python endpoint (using same approach as in this example repo)
  4. Python: receive that string, and pass it to base64.b64decode(message_string)
Terminou commented 4 years ago

Here are the pieces:

  1. C# save a picture from the device camera
  2. C# load that file as a base64 string
  3. C#: send that string to your ZMQ python endpoint (using same approach as in this example repo)
  4. Python: receive that string, and pass it to base64.b64decode(message_string)

Done! Thank you for taking the time to answer my question. It was really helpful. I appreciate it.

AliAnisNOURA commented 3 years ago

can we send pictures from python to unity ? how ?