PhoneSensor for machinevisiontoolbox. Get camera and IMU data from a camera remotely with Python
Project description
machinevision-toolbox-python.phone-sensor
Quickstart
Install with pip
:
pip install -U machinevision-toolbox-python.phone-sensor
# or
pip install git+https://github.com/CallumJHays/mvt-phonesensor-app
Example Code:
from phone_sensor import PhoneSensor
from matplotlib import pyplot as plt
# Hosts a webserver in a background thread.
# Display a QR code link to the app
phone = PhoneSensor(qrcode=True)
# wait for button press to snap a photo
img = phone.grab(button=True)
# get device orientation as a Quaternion
quaternion = phone.imu().quaternion
plt.subplot(1, 2, 1)
plt.imshow(img)
plt.subplot(1, 2, 2)
plt.bar(['x', 'y', 'z', 'w'], quaternion)
plt.show()
Will create an ASCII QRcode in your terminal. Scanning it with a smartphone will take you to a webapp hosted by the PhoneSensor
, which looks like:
Contributing
PRs welcome! The stack is Python3.6 and Typescript4.1 & CreateReactApp4.0
Development Install
First, clone this repo and install dependencies
npm install
pip install -e .
Running in Development Mode
- Run the dev-server (and keep it running):
npm start
- Create a PhoneSensor in proxy mode:
>>> from phone_sensor import PhoneSensor
>>> phone = PhoneSensor(qrcode=True, \
proxy_client_from="localhost:3000")
>>> phone.grab(button=True)
or just run the python examples/devmode.py
Then click the link in terminal to test the app
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for machinevision-toolbox-python.phone-sensor-0.2.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f67f60f0c057659d781cd8132240e4a537c5f6586046899131e0662671a3857a |
|
MD5 | 28129f1b2d316e7822c226372574aedf |
|
BLAKE2b-256 | 5d257036f558e1ebb6b92133fe2f59c2008da74dca68252189409837e3b5ed2d |
Close
Hashes for machinevision_toolbox_python.phone_sensor-0.2.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a827d7afa37cc5b7c8e1691c9a3895ef7ec602436d2830f63f38d42d8f0894ce |
|
MD5 | f42031879e6c686b7c18779fec24bec8 |
|
BLAKE2b-256 | eef16ab7b46d0f66cc8b16f2b16216709c4578880308b077ae573112884b3bc2 |