Skip to main content

No project description provided

Project description

Pycameleon

CI PyPI PyPI Downloads

A python binding for cameleon, a rust crate to interact with GenICam compatible U3V (USB3 Vision) camera.

Example demo using Rerun viewer and SILIOS Toucan camera

We welcome new contributors!

Your contributions, whether code, documentation, or ideas are highly appreciated!

Instalation

PyPI (Recommended)

This package is available in PyPI.

pip install pycameleon

Build from source

Build dependencies:

  • Rust/Cargo toolchain installed
  • maturin pip install maturin/pipx install maturin
  • libusb header (See cameleon FAQ)

First install maturin using pip or pipx or other package manager.

pip install maturin

Then run the following to install the package into the current environment.

maturin develop

Linux

By default, many devices are only accessible to root and need udev rules for non root users to access.

First use lsusb to list vendor and product id ID vendor_id:product_id.

Then, create an udev rule file at /etc/udev/rules.d/, for example /dev/udev/rules.d/99-u3v.rules

Choose and change vendor and product id with your own.

# Example: USB with vendor Id 2676 and product id 5678
SUBSYSTEM=="usb", ATTRS{idVendor}=="2676", ATTR{idProduct}=="5678", MODE:="0666", TAG+="uaccess", TAG+="udev-acl"
# Example: USB with vendor Id 1234 with any product id
SUBSYSTEM=="usb", ATTRS{idVendor}=="1234", MODE:="0666", TAG+="uaccess", TAG+="udev-acl"

If the framerate is low, you may need to increase usbfs_memory_mb limit. By default, USB-FS on Linux systems only allows 16 MB of buffer memory for all USB devices. This is quite low for high-resolution image streaming. We recommend you to set the value to 1024MB. You could set the value as following as root:

echo 1024 > /sys/module/usbcore/parameters/usbfs_memory_mb

or using sudo tee

echo 1024 | sudo tee /sys/module/usbcore/parameters/usbfs_memory_mb

Windows

For Windows, driver supported by libusb like WinUSB is required.

In most case, Zadig is recommended as an Automated Driver Installer GUI application.

NOTE: Make sure to install a driver to a composite device not to its child devices. To do this, you need to list all devices connected to the host computer with Zadig like below.

MacOS

MacOS should have out of box support after installing the pip package, for building from source, the libusb package is available in homebrew.

Quick Usage

See ours example repository that contain code snippet for generic Mono8/Mono12 camera and SILIOS Toucan multispectral camera.

Or quick starter cheatsheet below.

import pycameleon


# List all available cameras
available_camera = pycameleon.enumerate_cameras()

# Get the first U3V camera
cam = available_camera[0]

# Open the device in USB level
cam.open()

# Load the GenApi context and return it as XML string
gen_api_context = cam.load_context_from_camera()

# As a alternative, you can load gen api context dumped previously as `.load_context_from_camera()` can fail if already streaming or in invalid state.
# cam.load_context_from_xml(read_xml_to_string(str(cam)))


# After loading the context, we can read/write nodes and execute commands.
# Depending on the camera model, some nodes may not be available.
# Check the dumped GenApi XML for available nodes.

# Reset the device, need to enumerate it again and open from scratch after this.
# cam.execute("DeviceReset")

# Tell the camera to use Mono8 pixel format
cam.write_enum_as_str("PixelFormat", "Mono8")

# Start streaming and prepare a payload buffer for 1 channel.
payload = cam.start_streaming(1)

# Receive a single image from camera.
img, info = cam.receive_raw(payload)

# `img`` is an numpy array with type uint8, it's the raw byte array received from camera.

# `info` contain image information such as width, height and pixel format.


# At the end, close the camera to release USB handler.
cam.close()

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pycameleon-0.2.9-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl (982.8 kB view details)

Uploaded PyPymanylinux: glibc 2.28+ x86-64

pycameleon-0.2.9-pp311-pypy311_pp73-manylinux_2_28_i686.whl (1.1 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ i686

pycameleon-0.2.9-cp39-abi3-win_amd64.whl (746.3 kB view details)

Uploaded CPython 3.9+Windows x86-64

pycameleon-0.2.9-cp39-abi3-win32.whl (693.3 kB view details)

Uploaded CPython 3.9+Windows x86

pycameleon-0.2.9-cp39-abi3-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

pycameleon-0.2.9-cp39-abi3-musllinux_1_2_i686.whl (1.3 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

pycameleon-0.2.9-cp39-abi3-musllinux_1_2_armv7l.whl (1.3 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

pycameleon-0.2.9-cp39-abi3-musllinux_1_2_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

pycameleon-0.2.9-cp39-abi3-manylinux_2_28_x86_64.whl (992.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ x86-64

pycameleon-0.2.9-cp39-abi3-manylinux_2_28_s390x.whl (1.0 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ s390x

pycameleon-0.2.9-cp39-abi3-manylinux_2_28_ppc64le.whl (1.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ppc64le

pycameleon-0.2.9-cp39-abi3-manylinux_2_28_i686.whl (1.1 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ i686

pycameleon-0.2.9-cp39-abi3-manylinux_2_28_armv7l.whl (984.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARMv7l

pycameleon-0.2.9-cp39-abi3-manylinux_2_28_aarch64.whl (989.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

pycameleon-0.2.9-cp39-abi3-macosx_11_0_arm64.whl (853.1 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

pycameleon-0.2.9-cp39-abi3-macosx_10_12_x86_64.whl (869.5 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file pycameleon-0.2.9-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f4ecf770c0175c21c67e172644d54b1a7ebcaca7c7d9326f369bc7aac14349fd
MD5 d20271007abb73e8b9b50ff00dbe4ba0
BLAKE2b-256 eb99ab8a03002c9fa2e49301e8597f4e6575b8953ef725bbac509762c264f6ef

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-pp311-pypy311_pp73-manylinux_2_28_i686.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-pp311-pypy311_pp73-manylinux_2_28_i686.whl
Algorithm Hash digest
SHA256 50b475779b9f9388c47a01eb00cdc75d004e60c66f91aecc5529c50f6f67c4c5
MD5 4a58f6b77060883377028fb36b0e22cc
BLAKE2b-256 81c69db9ab8d548923f37ef7eb3143e308041c1add26046c993ce867373c4b0e

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: pycameleon-0.2.9-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 746.3 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 00d9398869bb4ac9373029409a4c4af020a5cd2e1c45c3f2e4efce977c2018db
MD5 a735eb5f0e351324ed58cd3e386f8b3c
BLAKE2b-256 cf6438355ca49281ffad10184dca00eddf7982a37954bf3173003e4a1463d158

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-win32.whl.

File metadata

  • Download URL: pycameleon-0.2.9-cp39-abi3-win32.whl
  • Upload date:
  • Size: 693.3 kB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 0884c6b3b748d4ba7afa8fff56d9ce363773f429f54c0e034e395a63413937f1
MD5 c55ae5e57deb6e454823c63a983645bd
BLAKE2b-256 95988c25e2db7e73a5cad1b02923e6665badd2d02c47e04a2d3bfd973127689e

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7790ed74c2e9fb20ea46070809779fe660fd27cb0d2771a5a92e7396c289e057
MD5 e42822e0f3cd15b764d4b437c6318e6a
BLAKE2b-256 fbed22bed30f0119b290c0dbc4d2436d7866f36eca885478cf9252d21c113eeb

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 48da4f1be89e5344ec295138d6c757b4775e8049c1b57d956698a051eb4e09fa
MD5 1e6f3f3a2586b6f7e9b7d0a27e13236d
BLAKE2b-256 d552a2fca2f92b4ea18dd1c85cd5b9ffe9e70914d3ced85bcf147702fb846ee3

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 dd3499fc1bff79ff691a38287ae488a8cb87d961bbf6c5dc63494459300b770c
MD5 85ca9e931ca42a6de729fbdbcc6ac9cb
BLAKE2b-256 557a8a2f06d6683a8a52f2ee1d7faaed81cf89567f6af8fd65d7f88535b06ad5

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8fcc2e7ea1b15bad7713ea297ef7a95fb1dce765dd6e031a4cdea34adf25abb9
MD5 c9cdc5f86adc826cea5e0b2a506725ca
BLAKE2b-256 69aa2606e2ad41f062b396e4a44a8c217cf92e257d9bbc3c6e06639f0c94b024

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e0d0f38b9bef0ebef1b13dee6ec7d2e899fbbeeb80ea359da659645a457c1aca
MD5 27ad0f2f7c85ec70501343f80f16a6c0
BLAKE2b-256 2f775505c540010a11fdd07e3ef52503fdfaca91031476e2350d5e257ec510de

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-manylinux_2_28_s390x.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 7c103a83b2917708ffe51ed5abfa2c58492b5984d3fb71aee1a44c8051c198cd
MD5 a01c354f98b2203731da3d3d1da06861
BLAKE2b-256 892b6574a6ac09a0b26517bc4fed34bbbc5f9115803f2e4c02c5205eb66153ba

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-manylinux_2_28_ppc64le.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 948410d39d54204abd69235b3eaed6d91f409caf01ab425e6a303c28ec967b26
MD5 a5a390734c0dd34c57bed31eae1ccac9
BLAKE2b-256 057ade16f9cf5ab5ab032f919d86e7457afd5e77aeb557bd5de36884f6a47b11

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-manylinux_2_28_i686.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-manylinux_2_28_i686.whl
Algorithm Hash digest
SHA256 d192cde9abb6bf36d2fdb2f06c4a1bbbfdb85366ca088b04f427f369d548859c
MD5 4c2983518600db4ca5a91516677589d3
BLAKE2b-256 db3f5b0a4e6ecadcb0a68c481259a5540c742f692e43c02072344f67e29e56f9

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-manylinux_2_28_armv7l.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 405241f6a2589af2965f2e6b7223ee6d385a51f970b9510daf82c9a47fd17c69
MD5 cae1c499ad819408a6eff7039d33f2e2
BLAKE2b-256 0e9f296c58db6eeffb0e0ab8a372e5cd8d20d21b734b77f184778eb4ffc1eafe

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6cd5253585dfbf5be0a901cd0b028f4be8771be933a7f7b974ebe78c83c01c47
MD5 2a36066bb43d3162d1484897952d30ed
BLAKE2b-256 c6c913933997464814cd974621066134c39588c2b420931be9be0018d0ee6058

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ed818f1986aa0ef822d4fba734ca604a2ec3af2ac775c41e94e787669360e798
MD5 052655ea9ce4843488215529f4f07d7e
BLAKE2b-256 386c7e80f6ef9ca52e67ff465d19ddfc39e3fbdca010d87ce63ba237c5ed04d7

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.9-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.9-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7b36ad5f690aa6ccef29dcfb7704d74df5cc7e72f9053dd5b12ad48db007998e
MD5 1e8354ffe5110d4f8a5c7f60edb8cd30
BLAKE2b-256 ca3f567eeb57e0174e1e91451664321a730f749fee6a5b3ea519090444608035

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