ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Python, OpenCV, MAVLink, Docker, and cameras how to use all?

    VOXL m500 Reference Drone
    5
    5
    543
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      Alfonso Ponce
      last edited by

      Hello! So I work on a ModalAI m500 developement drone. I've used Docker to run python programs along with MAVSDK. My next goal is to create a program that detects faces or AprilTags or any specified object and make the drone follow it while the object/person moves, however I don't know how to stream what the camera sees into my Pyhton program using OpenCV. Considering my program is running inside a Docker, how can I get real time images from any of the cameras on the drone, make the stream get into the Docker, make the Python program get that stream, process it and make the drone react to the processing output?

      Thank you!

      Eric KatzfeyE 1 Reply Last reply Reply Quote 0
      • Daniel RyuD
        Daniel Ryu
        last edited by

        Not Modalai, but this is what I used. When running the docker container, make sure you run it with the --device tag. This will let you add devices such as cameras you can then access with opencv. For instance, if I use the gimbal camera, I would add to the "docker run" command the "--device=/dev/video2." I would then use opencv like "cap = cv2.VideoCapture(2)" which will try to access the camera at /dev/video2. I'm uncertain whether this process will work for the other cameras, but theoretically as long as you find the correct folders where the camera devices are stored, you should be able to connect to them

        1 Reply Last reply Reply Quote 0
        • Eric KatzfeyE
          Eric Katzfey ModalAI Team @Alfonso Ponce
          last edited by

          @Alfonso-Ponce If you want to use any of the standard cameras then you need to get the frames from voxl-camera-server. It is based on our "ModalAI Pipe Architecture" (MPA) that uses standard Linux pipes to move data between processes. You can make an MPA client application in your Docker and receive the frames there. You will likely need to use the "-v" flag when launching your container to remap the pipe names outside of the Docker to new names inside of the Docker (e.g. -v <pipe name>:<container pipe name>)

          J 1 Reply Last reply Reply Quote 0
          • J
            jaredjohansen @Eric Katzfey
            last edited by

            @Eric-Katzfey , would you be able to share a minimal code example (preferably in python) that retrieves a single frame from the high-res camera? The minimal code would be running in a Docker container running on the VOXL.

            1 Reply Last reply Reply Quote 0
            • todd45040T
              todd45040
              last edited by

              I'm going to assume you know about the Docker examples at:
              https://gitlab.com/voxl-public/voxl-docker-images

              Will any of those help?

              -Todd

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB | Contributors