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/machinevision-toolbox-python.phone-sensor
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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5fd5222c02815f0d2fd47480c3273ed58a42c2ec3c0f90a6e70faa8890935e3 |
|
MD5 | 8ae9018d7d8bc42e46a714cde6551b65 |
|
BLAKE2b-256 | 55bbe08023e8fe57852eeb5d90661aa17ab8d6e33b87d17e10953d18ee7c0a10 |
Close
Hashes for machinevision_toolbox_python.phone_sensor-0.2.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5462289e30d5ea3e28ee66069f3a9521f8d23e9cfed149dd05bc175b5e3c331 |
|
MD5 | 703b9d8eea1395b7679a0e970a25928d |
|
BLAKE2b-256 | cfd6484763a270689f08a61f30febd9d4ecb9939afcb11b3b3af624687185055 |