Skip to main content

A small project to grab and parse images from the MU3 Vision Sensor.

Project description

my_mu3

A small project to grab and parse images from the MU3 Vision Sensor in a seperate process (to free up CPU).

Installation

pip install my-mu3

API Usage

Note the below relies on the camera being connected to the same WLAN (WIFI) network as the computer. Also note that it also relies on the ip address being known. See the section Connecting WLAN for help. It also relies on the camera being configured into image transmission mode, where both switches on the camera are in the up position. In this mode, the camera will show it is connected to a wifi network (and not broadcasting one) if both front lights are off. however, by default in this mode the camera will broadcast a network, this could be used though I haven't tested it.

One point to note is that the below relies on cv2.waitKey(1) to exit, so if you are running headless it won't exit cleanly. Sorry.

import time

import cv2

from my_mu3.mu3_image_grabber import Mu3ImageGrabber

IP_ADDRESS = "192.168.1.183"

def main():

    my_mu3 = Mu3ImageGrabber(ip_address=IP_ADDRESS)

    exit_flag = False
    my_mu3.start()

    while not exit_flag:

        image = my_mu3.get_image()
        if image is not None:
            cv2.imshow('mu3 camera', image)

        if cv2.waitKey(1) == ord("q"):
            exit_flag = True
        time.sleep(0.01)

    my_mu3.stop()

if __name__ == "__main__":
    main()

Connecting WLAN

The library relies on being connected to the same WLAN as the camera. To do so, AT commands can be sent to the camera via UDP or via Serial. A convenience script is included in this repository that sends AT commands to connect the camera to a WLAN network, that relies on having a serial port connected. One example of a repo that provides a "soft" serial port for the raspberry pi, ie you can use non-serial pins at a much lower speed, is here. I used this with 9600 baud rate, the default for the camera.

setup-wlan MY_WIFI_NAME MY_PASSWORD /dev/ttyS0

Using AT Commands/Chatting with the Camera

You can also use AT commands yourself. The camera will print AT commands if you send the below via serial. Note the space after the command, this is vital (or a combo of carriage return and new line).

AT+HELP 

The output of this AT_HELP is included in this repo as the 'output_at_help.txt' file. Additionally, a program to chat via serial with the camera is included where it will let you type and send input in examples/serial_chat.py.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

my-mu3-0.0.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

my_mu3-0.0.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file my-mu3-0.0.3.tar.gz.

File metadata

  • Download URL: my-mu3-0.0.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for my-mu3-0.0.3.tar.gz
Algorithm Hash digest
SHA256 bb17bde736583d0a10207f11abd7ac986b71965809daaec2d56e5c04b900c279
MD5 c45d12a7c942aa2063a2ff4906e718cd
BLAKE2b-256 065e39c2cd37f241bd4013b5947e0e22f17e224b6e2d2520216795fcf29e37cd

See more details on using hashes here.

File details

Details for the file my_mu3-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: my_mu3-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for my_mu3-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 76ca6b70b4170debf41c450f5c16811bf48570484cd0d6371e4937f99b8d9686
MD5 d9b375b215f9e30166de6dd4e712d987
BLAKE2b-256 cdaf263ff5cf021fc20cc7747745f3cd43520c453f75e1bfd60b504c49c7857d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page