Hi there, I'm trying to know if there was an example somewhere that would help us to start with a Oak D devices that would detect people, and ideally send x,y,z data to the computer with which the cam would be linked to.

Just trying to figure out how to design such an architecture.
Distance Calculations could be done on the computer. I would only need a global mean.

Any ideas or words about this would help a lot.

Best regards,
Julien

  • erik replied to this.

    erik checking it asap. Thanks a lot Erik. Especially, I'd like to "retrieve" and parse coordinates as text over udp or something like this. Ideally in openframeworks based exe, or max msp. I'll let you know.

    a month later

    erik hi Erik,
    I'm stuck here.
    Would you mind to help me to set this up for just sending coordinates as osc/udp message?
    I can't figure out how to do this.
    Actually, in the social app demo, I'd like to have only something sending messages, no calculations, or any gui, just firing this to local host on a specific port.

    • erik replied to this.

      erik thabks a lot testing this asap.
      Which part. And which files would I alter?
      Is it the main.py where everything goes considering the social distance example?

      • erik replied to this.

        julienbayle you could just alter the file that I linked to. You could remove most of other (unused) logic. The main file that you would need is depthai_utils.py (which constructs pipeline and receives spatial coordinates from the device), other files are for Covid distancing and you could remove them. So you could just alter depthai_utils.py a bit and only use that.
        Thanks, Erik

          erik got it.
          Thanks a lot. In that case, it wouldn't create the ui window etc? Actually I wouldn't need that

          And actually, I'd love to code an example using cam data DIRECTLY in other framework.
          I'm thinking about max 8
          Or touchdesigner.
          I think there is a sdk somewhere 😀

          Thanks I understand this.
          It still doesn't work as I'd like.

          I initiated the sock etc.
          and put
          MESSAGE = int(detection.xmax * width)
          sock.sendto(int(detection.xmax * width), (UDP_IP, UDP_PORT))

          after the bbox.append() ...

          but it doesn't seem to fire osc message.
          I don't get it. code is ok
          sock defined and assigned globally
          after the import:

          UDP_IP = "127.0.0.1"
          UDP_PORT = 6666
          MESSAGE = "!"
          
          sock = socket.socket(socket.AF_INET, # Internet
                               socket.SOCK_DGRAM) # UDP

          But the main problem is: I'd need to have distances as a message like:
          distances 0.3 0.1 9.2 ....
          if I have 2 persons detected : 1 distance (one float)
          if I have 3 persons detected : 3 distances (three floats)
          etc
          actually I'd even need "just" a mean of distance.

          Where should I do that in the code ??

          It looks like your UDP client isn't working as expected. Could you try to develop UDP packet sending without the depthai code? After that you can copy it back to depthai code. Regarding the floats, you can just take spatial coordinates - they are already there in the depthai_utils.py script.
          Thanks, Erik